下面列出了android.widget.TextView#setAlpha ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void setCaptionViewVisibilities(
@CaptionDisplayState int captionToHide, @CaptionDisplayState int captionToShow) {
if (captionToHide == captionToShow) {
return;
}
if (captionToShow != CAPTION_STATE_NONE) {
TextView captionViewToShow = getCaptionViewFromDisplayState(captionToShow);
if (captionViewToShow != null) {
captionViewToShow.setVisibility(VISIBLE);
captionViewToShow.setAlpha(1f);
}
}
if (captionToHide != CAPTION_STATE_NONE) {
TextView captionViewDisplayed = getCaptionViewFromDisplayState(captionToHide);
if (captionViewDisplayed != null) {
captionViewDisplayed.setVisibility(View.INVISIBLE);
// Only set the caption text to null if it's the error.
if (captionToHide == CAPTION_STATE_ERROR) {
captionViewDisplayed.setText(null);
}
}
}
captionDisplayed = captionToShow;
}
private void addTab(final int position, CharSequence title, View tabView) {
TextView tabTitle = (TextView) tabView.findViewById(R.id.tab_title);
if (tabTitle != null) {
if (title != null) {
tabTitle.setText(title);
}
float alpha = pager.getCurrentItem() == position ? tabTextSelectedAlpha : tabTextAlpha;
tabTitle.setAlpha(alpha);
}
tabView.setFocusable(true);
tabView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (pager.getCurrentItem() != position) {
notSelectedItem(pager.getCurrentItem());
pager.setCurrentItem(position % tabCount);
} else if (tabReselectedListener != null) {
tabReselectedListener.onTabReselected(position);
}
}
});
tabsContainer.addView(tabView, position,
shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams);
}
public void enDisBrokerAddressPort(boolean en,String brokerAddress, String brokerPort) {
TextView t = (TextView)v.findViewById(R.id.cloud_broker_address_label);
EditText e = (EditText)v.findViewById(R.id.cloud_broker_address);
TextView tP = (TextView)v.findViewById(R.id.cloud_broker_port_label);
EditText eP = (EditText)v.findViewById(R.id.cloud_broker_port);
e.setEnabled(en);
eP.setEnabled(en);
e.setText(brokerAddress);
eP.setText(brokerPort);
if (en) {
t.setAlpha(1.0f);
e.setAlpha(1.0f);
tP.setAlpha(1.0f);
eP.setAlpha(1.0f);
}
else {
t.setAlpha(0.4f);
tP.setAlpha(0.4f);
e.setAlpha(0.4f);
eP.setAlpha(0.4f);
}
}
public void enDisTopic(boolean en, String topic) {
TextView t = (TextView)v.findViewById(R.id.cloud_publish_topic_label);
EditText e = (EditText)v.findViewById(R.id.cloud_publish_topic);
e.setEnabled(en);
e.setText(topic);
if (en) {
t.setAlpha(1.0f);
e.setAlpha(1.0f);
}
else {
t.setAlpha(0.4f);
e.setAlpha(0.4f);
}
}
private TextView createHeaderItem(int position, String headerText) {
TextView header = new TextView(getContext());
LayoutParams linearParams = new LayoutParams(headerWidth / headerPerView, LayoutParams.WRAP_CONTENT);
header.setLayoutParams(linearParams);
header.setScaleX(textViewAttr.getHvMinScale());
header.setScaleY(textViewAttr.getHvMinScale());
header.setAlpha(textViewAttr.getHvTextAlpha());
header.setTextColor(textViewAttr.getHvTextColor());
header.setPadding(0, (int) textViewAttr.getHvPadding(), 0, (int) textViewAttr.getHvPadding());
header.setMaxLines(1);
header.setGravity(Gravity.CENTER);
header.setEllipsize(TextUtils.TruncateAt.END);
header.setText(headerText);
header.setTextSize(TypedValue.COMPLEX_UNIT_PX, textViewAttr.getHvTextSize());
textViews[position] = header;
return header;
}
private void animateToolbar() {
// this is gross but toolbar doesn't expose it's children to animate them :(
View t = toolbar.getChildAt(0);
if (t != null && t instanceof TextView) {
TextView title = (TextView) t;
// fade in and space out the title. Animating the letterSpacing performs horribly so
// fake it by setting the desired letterSpacing then animating the scaleX ¯\_(ツ)_/¯
title.setAlpha(0f);
title.setScaleX(0.8f);
title.animate()
.alpha(1f)
.scaleX(1f)
.setStartDelay(300)
.setDuration(900)
.setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this));
}
}
private void setViewText(TextView view, CharSequence text, boolean animate) {
if (view.getText().toString().equals(text)) return;
view.animate().cancel();
if (animate) {
view.setAlpha(0.0f);
view.setText(text);
view.animate().alpha(1.f).setDuration(mAnimationDuration).setListener(null);
} else {
view.setText(text);
}
}
private void notSelected(View tab) {
TextView title = (TextView) tab.findViewById(R.id.tab_title);
if (title != null) {
title.setTypeface(tabTypeface, tabTypefaceStyle);
title.setAlpha(tabTextAlpha);
}
}
@Override
public void configurePinnedHeader(final View v,final int position,final int alpha)
{
final TextView header=(TextView)v;
final int sectionIndex=getSectionForPosition(position);
final Object[] sections=getSections();
if(sections!=null&§ions.length!=0)
{
final CharSequence title=getSectionTitle(sectionIndex);
header.setText(title);
}
if(VERSION.SDK_INT<VERSION_CODES.HONEYCOMB)
if(alpha==255)
{
header.setBackgroundColor(_pinnedHeaderBackgroundColor);
header.setTextColor(_pinnedHeaderTextColor);
}
else
{
header.setBackgroundColor(Color.argb(alpha,Color.red(_pinnedHeaderBackgroundColor),
Color.green(_pinnedHeaderBackgroundColor),Color.blue(_pinnedHeaderBackgroundColor)));
header.setTextColor(Color.argb(alpha,Color.red(_pinnedHeaderTextColor),
Color.green(_pinnedHeaderTextColor),Color.blue(_pinnedHeaderTextColor)));
}
else
{
header.setBackgroundColor(_pinnedHeaderBackgroundColor);
header.setTextColor(_pinnedHeaderTextColor);
header.setAlpha(alpha/255.0f);
}
}
public void enDisPassword (boolean enable,String password) {
TextView t = (TextView)v.findViewById(R.id.cloud_password_label);
EditText e = (EditText)v.findViewById(R.id.cloud_password);
e.setEnabled(enable);
e.setText(password);
if (enable) {
t.setAlpha(1.0f);
e.setAlpha(1.0f);
}
else {
t.setAlpha(0.4f);
e.setAlpha(0.4f);
}
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (dotRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(dotRunnable);
dotRunnable = null;
}
if (currentAnimation != null) {
currentAnimation.cancel();
currentAnimation = null;
}
for (int a = 0; a < 4; a++) {
if (a < stringBuilder.length()) {
TextView textView = characterTextViews.get(a);
textView.setAlpha(0);
textView.setScaleX(1);
textView.setScaleY(1);
textView.setTranslationY(0);
textView.setTranslationX(getXForTextView(a));
textView = dotTextViews.get(a);
textView.setAlpha(1);
textView.setScaleX(1);
textView.setScaleY(1);
textView.setTranslationY(0);
textView.setTranslationX(getXForTextView(a));
} else {
characterTextViews.get(a).setAlpha(0);
dotTextViews.get(a).setAlpha(0);
}
}
super.onLayout(changed, left, top, right, bottom);
}
private void setViewText(TextView view, CharSequence text, boolean animate) {
if (view.getText().toString().equals(text)) return;
view.animate().cancel();
if (animate) {
view.setAlpha(0.0f);
view.setText(text);
view.animate().alpha(1.f).setDuration(mAnimationDuration).setListener(null);
} else {
view.setText(text);
}
}
@Override
public void onWeightAnimated(float animationPercent)
{
TextView descriptionLabel=findViewById(R.id.descriptionLabel);
descriptionLabel.setAlpha(animationPercent);
LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
(int)(animationPercent*getResources().getDimensionPixelSize(R.dimen.default_emoji_description_label_height)));
params.bottomMargin=getResources().getDimensionPixelSize(R.dimen.default_emoji_description_label_bottom_margin);
params.gravity=Gravity.CENTER_HORIZONTAL;
descriptionLabel.setLayoutParams(params);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Thread.setDefaultUncaughtExceptionHandler(
new UnhandledExceptionHandler(this));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Point displaySize = new Point();
getWindowManager().getDefaultDisplay().getRealSize(displaySize);
vsv = new AppRTCGLView(this, displaySize);
VideoRendererGui.setView(vsv);
remoteRender = VideoRendererGui.create(0, 0, 100, 100);
localRender = VideoRendererGui.create(70, 5, 25, 25);
vsv.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
toggleHUD();
}
});
setContentView(vsv);
logAndToast("Tap the screen to toggle stats visibility");
hudView = new TextView(this);
hudView.setTextColor(Color.BLACK);
hudView.setBackgroundColor(Color.WHITE);
hudView.setAlpha(0.4f);
hudView.setTextSize(TypedValue.COMPLEX_UNIT_PT, 5);
hudView.setVisibility(View.INVISIBLE);
addContentView(hudView, hudLayout);
if (!factoryStaticInitialized) {
abortUnless(PeerConnectionFactory.initializeAndroidGlobals(
this, true, true),
"Failed to initializeAndroidGlobals");
factoryStaticInitialized = true;
}
AudioManager audioManager =
((AudioManager) getSystemService(AUDIO_SERVICE));
// TODO(fischman): figure out how to do this Right(tm) and remove the
// suppression.
@SuppressWarnings("deprecation")
boolean isWiredHeadsetOn = audioManager.isWiredHeadsetOn();
audioManager.setMode(isWiredHeadsetOn ?
AudioManager.MODE_IN_CALL : AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(!isWiredHeadsetOn);
sdpMediaConstraints = new MediaConstraints();
sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
"OfferToReceiveAudio", "true"));
sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
"OfferToReceiveVideo", "true"));
final Intent intent = getIntent();
if ("android.intent.action.VIEW".equals(intent.getAction())) {
connectToRoom(intent.getData().toString());
return;
}
showGetRoomUI();
}
/**
* 初始化公共的控件
*/
private void initCommonView() {
// 实例化灰色半透明蒙版控件
_backMaskView = new View(_context);
_backMaskView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (_currentInfo.getEventDelegate() != null)
_currentInfo.getEventDelegate().onMaskTouch(LemonHelloView.this, _currentInfo);
}
});
// 设置全屏宽
_backMaskView.setLayoutParams(new RelativeLayout.LayoutParams(_PST.dpToPx(_PST.screenWidthDp()), _PST.dpToPx(_PST.screenHeightDp())));
_rootLayout.setAlpha(0);// 设置全透明,也就是默认不可见,后期通过动画改变来显示
// 实例化内容面板控件
_contentPanel = new LemonHelloPanel(_context);
_contentPanel.setX(_PST.dpToPx((int) (_PST.screenWidthDp() / 2.0)));
_contentPanel.setY(_PST.dpToPx((int) (_PST.screenHeightDp() / 2.0)));
// 实例化内容面板控件的布局
_contentLayout = new RelativeLayout(_context);
// 实例化绘图动画和帧图片显示的控件
_paintView = new LemonPaintView(_context);
// 实例化标题显示标签控件
_titleView = new TextView(_context);
_titleView.setX(0);
_titleView.setY(0);
_titleView.setGravity(Gravity.CENTER);
_contentView = new TextView(_context);
_contentView.setX(0);
_contentView.setY(0);
_contentView.setGravity(Gravity.CENTER);
_actionContainer = new RelativeLayout(_context);
_actionContainer.setX(0);
_actionContainer.setY(0);
_contentView.setAlpha(0);
_titleView.setAlpha(0);
_contentPanel.setAlpha(0);
// 把所有控件添加到根视图上
_rootLayout.addView(_backMaskView);// 半透明灰色背景
_rootLayout.addView(_contentPanel);// 主内容面板
_contentPanel.addView(_contentLayout);
_contentLayout.addView(_paintView);// 动画和帧图标显示控件放置到内容面板上
_contentLayout.addView(_titleView);// 标题显示标签控件放置到内容面板上
_contentLayout.addView(_contentView);// 正文内容显示标签控件放到内容面板上
_contentLayout.addView(_actionContainer);// action事件容器放到内容面板中
}
@Override
public View getView(int position, View view, ViewGroup parent) {
final CalendarItem currentItem = days.get(position);
if (view == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(layoutResId, null);
}
if (viewInteractor != null && viewInteractor.hasImplementedMonthCellBinding()) {
view = viewInteractor.onMonthCellBindView(view, currentItem);
} else {
final TextView dayView = view.findViewById(android.R.id.title);
final View background = view.findViewById(android.R.id.background);
final View startSelectionView = view.findViewById(android.R.id.startSelectingText);
final View endSelectionView = view.findViewById(android.R.id.stopSelectingText);
startSelectionView.setVisibility(View.GONE);
endSelectionView.setVisibility(View.GONE);
if (currentItem == null) {
background.setBackground(null);
dayView.setText(null);
} else if (currentItem.compareTo(calendar.getFirstMonth().withMillisOfDay(0)) < 0) {
currentItem.setSelectable(false);
background.setBackground(null);
dayView.setTextColor(Color.BLACK);
dayView.setText(currentItem.getDayString());
dayView.setAlpha(0.6f);
} else {
currentItem.setSelectable(true);
dayView.setAlpha(1f);
Integer backgroundResource = null;
if (firstSelectedDay != null) {
int startSelectedCompared = currentItem.compareTo(firstSelectedDay);
if (!multipleSelection) {
if (startSelectedCompared == 0) {
backgroundResource = R.drawable.empty_circle;
}
} else if (startSelectedCompared == 0) {
if (lastSelectedDay == null || lastSelectedDay.equals(currentItem.getDateTime())) {
backgroundResource = R.drawable.circle;
} else {
backgroundResource = R.drawable.left_rounded_rectangle;
endSelectionView.setVisibility(View.VISIBLE);
}
} else if (startSelectedCompared > 0 && lastSelectedDay != null) {
int endSelectedCompared = currentItem.compareTo(lastSelectedDay);
if (endSelectedCompared == 0) {
backgroundResource = R.drawable.right_rounded_rectangle;
startSelectionView.setVisibility(View.VISIBLE);
} else if (endSelectedCompared < 0) {
backgroundResource = R.drawable.rectangle;
startSelectionView.setVisibility(View.VISIBLE);
endSelectionView.setVisibility(View.VISIBLE);
}
}
}
int color = Color.BLACK;
if (backgroundResource != null) {
background.setBackgroundResource(backgroundResource);
if (multipleSelection) {
color = Color.WHITE;
}
} else {
background.setBackground(null);
}
dayView.setTextColor(color);
dayView.setText(currentItem.getDayString());
}
}
return view;
}
public void onBindViewHolder(final ViewHolder holder, int position) {
if (identifier != null) {
final TextView title = holder.v.findViewById(R.id.title);
TextView subtitle = holder.v.findViewById(R.id.subtitle);
AppCompatCheckBox checkBox = holder.v.findViewById(R.id.checkBox);
if (title != null)
title.setText(identifier.getTitle());
if (subtitle != null) {
String text = identifier.getSubtitle();
if (text.length() > 0) {
subtitle.setVisibility(View.VISIBLE);
subtitle.setText(text);
} else subtitle.setVisibility(View.GONE);
}
if (checkBox != null) {
checkBox.setVisibility(isNullable ? View.VISIBLE : View.GONE);
if (isNullable) {
Object value = identifier.getPreferenceValue(getContext());
boolean isNonNull = value != null && !value.equals(nullValue);
if (title != null)
title.setAlpha(isNonNull ? 1 : 0.5f);
checkBox.setOnCheckedChangeListener(null);
checkBox.setChecked(isNonNull);
checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (title != null)
title.animate().alpha(isChecked ? 1 : 0.5f).start();
if (isChecked)
onClick(holder.itemView);
else {
identifier.setPreferenceValue(getContext(), null);
onPreferenceChange(null);
}
onBindViewHolder(holder, -1);
});
}
}
}
holder.v.setOnClickListener(this);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Thread.setDefaultUncaughtExceptionHandler(
new UnhandledExceptionHandler(this));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Point displaySize = new Point();
getWindowManager().getDefaultDisplay().getRealSize(displaySize);
vsv = new AppRTCGLView(this, displaySize);
VideoRendererGui.setView(vsv);
remoteRender = VideoRendererGui.create(0, 0, 100, 100);
localRender = VideoRendererGui.create(70, 5, 25, 25);
vsv.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
toggleHUD();
}
});
setContentView(vsv);
logAndToast("Tap the screen to toggle stats visibility");
hudView = new TextView(this);
hudView.setTextColor(Color.BLACK);
hudView.setBackgroundColor(Color.WHITE);
hudView.setAlpha(0.4f);
hudView.setTextSize(TypedValue.COMPLEX_UNIT_PT, 5);
hudView.setVisibility(View.INVISIBLE);
addContentView(hudView, hudLayout);
if (!factoryStaticInitialized) {
abortUnless(PeerConnectionFactory.initializeAndroidGlobals(
this, true, true),
"Failed to initializeAndroidGlobals");
factoryStaticInitialized = true;
}
AudioManager audioManager =
((AudioManager) getSystemService(AUDIO_SERVICE));
// TODO(fischman): figure out how to do this Right(tm) and remove the
// suppression.
@SuppressWarnings("deprecation")
boolean isWiredHeadsetOn = audioManager.isWiredHeadsetOn();
audioManager.setMode(isWiredHeadsetOn ?
AudioManager.MODE_IN_CALL : AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(!isWiredHeadsetOn);
sdpMediaConstraints = new MediaConstraints();
sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
"OfferToReceiveAudio", "true"));
sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
"OfferToReceiveVideo", "true"));
final Intent intent = getIntent();
if ("android.intent.action.VIEW".equals(intent.getAction())) {
connectToRoom(intent.getData().toString());
return;
}
showGetRoomUI();
}
@Override
public void onDreamingStarted() {
super.onDreamingStarted();
if (use_gravity) {
mSensorManager.registerListener(
this,
gravitySensor,
SensorManager.SENSOR_DELAY_NORMAL);
}
final DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int screen_width = dm.widthPixels;
int screen_height = dm.heightPixels;
// TODO test on various screens
double screen_scale = (dm.densityDpi / 160f);
graph_width = (int) (230 * screen_scale);
graph_height = (int) (128 * screen_scale);
int widget_width = (int) (180 * screen_scale);
int widget_height = (int) (100 * screen_scale);
Log.d(TAG, "Width: " + graph_width + " Height: " + graph_height);
// sanity check
if (graph_height >= screen_height) graph_height = screen_height - 20;
if (graph_width >= screen_width) graph_width = screen_width - 20;
if (widget_height >= screen_height) widget_height = screen_height - 20;
if (widget_width >= screen_width) widget_width = screen_width - 20;
final FrameLayout.LayoutParams gl = new FrameLayout.LayoutParams(graph_width, graph_height);
final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(150, 150);
mBouncer = new Bouncer(this);
mBouncer.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
mBouncer.setSpeed(0.1f);
graphimage = new ImageView(this);
updateGraph();
// image.setBackgroundColor(0xFF004000);
mBouncer.addView(graphimage, gl);
for (int i = 0; i < 1; i++) {
image = new ImageView(this);
image.setImageResource(R.drawable.ic_launcher);
image.setAlpha(0.3f);
// image.setBackgroundColor(0xFF004000);
mBouncer.addView(image, lp);
}
// final View tv = new View(this);
final LayoutInflater inflater = LayoutInflater.from(this);
inflatedLayout = inflater.inflate(R.layout.x_drip_widget, null, false);
inflatedLayout.setBackgroundColor(Color.TRANSPARENT);
//frame = inflatedLayout.findViewById(R.id.widgetLinear);
widgetbg = (TextView) inflatedLayout.findViewById(R.id.widgetBg);
widgetArrow = (TextView) inflatedLayout.findViewById(R.id.widgetArrow);
widgetDelta = (TextView) inflatedLayout.findViewById(R.id.widgetDelta);
widgetStatusLine = (TextView) inflatedLayout.findViewById(R.id.widgetStatusLine);
widgetReadingAge = (TextView) inflatedLayout.findViewById(R.id.readingAge);
final float alpha = 0.6f;
widgetbg.setAlpha(alpha);
widgetArrow.setAlpha(alpha);
widgetDelta.setAlpha(alpha);
widgetReadingAge.setAlpha(alpha);
keep_running = true;
if (!updated) {
mainHandler.post(mRunnable);
}
mBouncer.addView(inflatedLayout, new FrameLayout.LayoutParams(widget_width, widget_height));
setContentView(mBouncer);
if (Build.VERSION.SDK_INT >= 21) {
try {
getWindow().setNavigationBarColor(Color.BLACK);
getWindow().setStatusBarColor(Color.BLACK);
} catch (Exception e) {
//
}
}
}
@Override
public void onDreamingStarted() {
super.onDreamingStarted();
if (use_gravity) {
mSensorManager.registerListener(
this,
gravitySensor,
SensorManager.SENSOR_DELAY_NORMAL);
}
final DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int screen_width = dm.widthPixels;
int screen_height = dm.heightPixels;
// TODO test on various screens
double screen_scale = (dm.densityDpi / 160f);
graph_width = (int) (230 * screen_scale);
graph_height = (int) (128 * screen_scale);
int widget_width = (int) (180 * screen_scale);
int widget_height = (int) (100 * screen_scale);
Log.d(TAG, "Width: " + graph_width + " Height: " + graph_height);
// sanity check
if (graph_height >= screen_height) graph_height = screen_height - 20;
if (graph_width >= screen_width) graph_width = screen_width - 20;
if (widget_height >= screen_height) widget_height = screen_height - 20;
if (widget_width >= screen_width) widget_width = screen_width - 20;
final FrameLayout.LayoutParams gl = new FrameLayout.LayoutParams(graph_width, graph_height);
final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(150, 150);
mBouncer = new Bouncer(this);
mBouncer.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
mBouncer.setSpeed(0.1f);
graphimage = new ImageView(this);
updateGraph();
// image.setBackgroundColor(0xFF004000);
mBouncer.addView(graphimage, gl);
for (int i = 0; i < 1; i++) {
image = new ImageView(this);
image.setImageResource(R.drawable.ic_launcher);
image.setAlpha(0.3f);
// image.setBackgroundColor(0xFF004000);
mBouncer.addView(image, lp);
}
// final View tv = new View(this);
final LayoutInflater inflater = LayoutInflater.from(this);
inflatedLayout = inflater.inflate(R.layout.x_drip_widget, null, false);
inflatedLayout.setBackgroundColor(Color.TRANSPARENT);
//frame = inflatedLayout.findViewById(R.id.widgetLinear);
widgetbg = (TextView) inflatedLayout.findViewById(R.id.widgetBg);
widgetArrow = (TextView) inflatedLayout.findViewById(R.id.widgetArrow);
widgetDelta = (TextView) inflatedLayout.findViewById(R.id.widgetDelta);
widgetStatusLine = (TextView) inflatedLayout.findViewById(R.id.widgetStatusLine);
widgetReadingAge = (TextView) inflatedLayout.findViewById(R.id.readingAge);
final float alpha = 0.6f;
widgetbg.setAlpha(alpha);
widgetArrow.setAlpha(alpha);
widgetDelta.setAlpha(alpha);
widgetReadingAge.setAlpha(alpha);
keep_running = true;
if (!updated) {
mainHandler.post(mRunnable);
}
mBouncer.addView(inflatedLayout, new FrameLayout.LayoutParams(widget_width, widget_height));
setContentView(mBouncer);
if (Build.VERSION.SDK_INT >= 21) {
try {
getWindow().setNavigationBarColor(Color.BLACK);
getWindow().setStatusBarColor(Color.BLACK);
} catch (Exception e) {
//
}
}
}