List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable
public ColorDrawable(@ColorInt int color)
From source file:co.taqat.call.LinphoneActivity.java
public Dialog displayWrongPasswordDialog(final String username, final String realm, final String domain) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC)); d.setAlpha(200);/* w ww .jav a 2 s. co m*/ dialog.setContentView(R.layout.input_dialog); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); dialog.getWindow().setBackgroundDrawable(d); TextView customText = (TextView) dialog.findViewById(R.id.customText); customText.setText(getString(R.string.error_bad_credentials)); Button retry = (Button) dialog.findViewById(R.id.retry); Button cancel = (Button) dialog.findViewById(R.id.cancel); retry.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { String newPassword = ((EditText) dialog.findViewById(R.id.password)).getText().toString(); LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, newPassword, null, realm, domain); LinphoneManager.getLc().addAuthInfo(authInfo); LinphoneManager.getLc().refreshRegisters(); dialog.dismiss(); } }); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); return dialog; }
From source file:ab.util.AbDialogUtil.java
/** * popupwindow//from w w w . jav a2s .co m */ public static PopupWindow showPopWindow3(Context context, View targetView, View contentView, Integer width) { PopupWindow popupWindow = null; popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); if (width != null) { popupWindow.setWidth(width); } popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); return popupWindow; }
From source file:com.channelsoft.common.bitmapUtil.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView/*from www . j av a 2 s. c o m*/ * @param bitmap */ private void setImageBitmap(ImageView imageView, Bitmap bitmap) { if ("0".equals(imageView.getTag())) { // ?? bitmap = toGrayscale(bitmap); } if (mFadeInBitmap) { // Transition drawable with a transparent drwabale and the final bitmap final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mResources, bitmap) }); // Set background to loading bitmap //TODO: miaolikui delete 20121229 // imageView.setBackgroundDrawable( // new BitmapDrawable(mResources, mLoadingBitmap)); Log.d(TAG, tagStr + ":imageView.setImageDrawable:" + System.currentTimeMillis()); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { Log.d(TAG, tagStr + ":imageView.setImageBitmap:" + System.currentTimeMillis()); imageView.setImageBitmap(bitmap); } }
From source file:ca.co.rufus.androidboilerplate.ui.DebugDrawerLayout.java
/** * Set a drawable to draw in the insets area for the status bar. * Note that this will only be activated if this DrawerLayout fitsSystemWindows. * * @param color Color to use as a background drawable to draw behind the status bar * in 0xAARRGGBB format./*from www. ja v a 2 s .c o m*/ */ public void setStatusBarBackgroundColor(int color) { mStatusBarBackground = new ColorDrawable(color); invalidate(); }
From source file:ab.util.AbDialogUtil.java
public static MyPop showDatePopWindow(Context context, View contentView, View targetView) { // /*from w w w. j a v a2s .c o m*/ yearArrayString = getYEARArray(2016, 30); monthArrayString = getDayArray(12); hourArrayString = getHMArray(24); minuteArrayString = getHMArray(60); // ?? c = Calendar.getInstance(); PopupWindow popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); popupWindow.setWidth(context.getResources().getDisplayMetrics().widthPixels); popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.BOTTOM, 0, 0); yearWV = (WheelView) contentView.findViewById(R.id.time_year); monthWV = (WheelView) contentView.findViewById(R.id.time_month); dayWV = (WheelView) contentView.findViewById(R.id.time_day); hourWV = (WheelView) contentView.findViewById(R.id.time_hour); minuteWV = (WheelView) contentView.findViewById(R.id.time_minute); // ? yearWV.setVisibleItems(5); monthWV.setVisibleItems(5); dayWV.setVisibleItems(5); hourWV.setVisibleItems(5); minuteWV.setVisibleItems(5); // yearWV.setLabel(""); monthWV.setLabel(""); dayWV.setLabel(""); hourWV.setLabel(""); minuteWV.setLabel(""); yearWV.setCyclic(true); monthWV.setCyclic(true); dayWV.setCyclic(true); hourWV.setCyclic(true); minuteWV.setCyclic(true); setData(); return new MyPop(popupWindow, yearWV, monthWV, dayWV, hourWV, minuteWV); }
From source file:com.android.launcher2.Launcher.java
/** * Finds all the views we need and configure them properly. *//*from ww w . j av a2 s.c om*/ private void setupViews() { final DragController dragController = mDragController; mLauncherView = findViewById(R.id.launcher); mDragLayer = (DragLayer) findViewById(R.id.drag_layer); mWorkspace = (Workspace) mDragLayer.findViewById(R.id.workspace); mQsbDivider = findViewById(R.id.qsb_divider); mDockDivider = findViewById(R.id.dock_divider); mLauncherView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); mWorkspaceBackgroundDrawable = getResources().getDrawable(R.drawable.workspace_bg); mBlackBackgroundDrawable = new ColorDrawable(Color.BLACK); // Setup the drag layer mDragLayer.setup(this, dragController); // Setup the hotseat mHotseat = (Hotseat) findViewById(R.id.hotseat); if (mHotseat != null) { mHotseat.setup(this); } // Setup the workspace mWorkspace.setHapticFeedbackEnabled(false); mWorkspace.setOnLongClickListener(this); mWorkspace.setup(dragController); dragController.addDragListener(mWorkspace); // Get the search/delete bar mSearchDropTargetBar = (SearchDropTargetBar) mDragLayer.findViewById(R.id.qsb_bar); // Setup AppsCustomize mAppsCustomizeTabHost = (AppsCustomizeTabHost) findViewById(R.id.apps_customize_pane); mAppsCustomizeContent = (AppsCustomizePagedView) mAppsCustomizeTabHost .findViewById(R.id.apps_customize_pane_content); mAppsCustomizeContent.setup(this, dragController); // Setup the drag controller (drop targets have to be added in reverse order in priority) dragController.setDragScoller(mWorkspace); dragController.setScrollView(mDragLayer); dragController.setMoveTarget(mWorkspace); dragController.addDropTarget(mWorkspace); if (mSearchDropTargetBar != null) { mSearchDropTargetBar.setup(this, dragController); } }
From source file:ab.util.AbDialogUtil.java
/** * /*from w w w .ja v a 2 s.c om*/ */ public static MyPop showDatePopWindowDate(Context context, View contentView, View targetView) { // yearArrayString = getYEARArray(2016, 36); monthArrayString = getDayArray(12); hourArrayString = getHMArray(24); minuteArrayString = getHMArray(60); // ?? c = Calendar.getInstance(); PopupWindow popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.BLACK)); popupWindow.setWidth(context.getResources().getDisplayMetrics().widthPixels); popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.BOTTOM, 0, 0); yearWV = (WheelView) contentView.findViewById(R.id.time_year); monthWV = (WheelView) contentView.findViewById(R.id.time_month); dayWV = (WheelView) contentView.findViewById(R.id.time_day); hourWV = (WheelView) contentView.findViewById(R.id.time_hour); minuteWV = (WheelView) contentView.findViewById(R.id.time_minute); hourWV.setVisibility(View.GONE); minuteWV.setVisibility(View.GONE); // ? yearWV.setVisibleItems(5); monthWV.setVisibleItems(5); dayWV.setVisibleItems(5); hourWV.setVisibleItems(5); minuteWV.setVisibleItems(5); // yearWV.setLabel(""); monthWV.setLabel(""); dayWV.setLabel(""); hourWV.setLabel(""); minuteWV.setLabel(""); yearWV.setCyclic(true); monthWV.setCyclic(true); dayWV.setCyclic(true); hourWV.setCyclic(true); minuteWV.setCyclic(true); setData(); return new MyPop(popupWindow, yearWV, monthWV, dayWV, hourWV, minuteWV); }
From source file:com.javielinux.tweettopics2.TweetTopicsActivity.java
public void refreshTheme() { layoutBackgroundApp.setBackgroundColor( Color.parseColor("#" + themeManager.getStringColor("color_background_new_status"))); themeManager.setColors();// w w w .j a va2s .c o m layoutBackgroundBar.setBackgroundDrawable( ImageUtils.createBackgroundDrawable(this, themeManager.getColor("color_top_bar"), false, 0)); layoutBackgroundColumnsBarContainer.setBackgroundDrawable( ImageUtils.createBackgroundDrawable(this, themeManager.getColor("color_top_bar"), false, 0)); StateListDrawable statesButtonBg = new StateListDrawable(); statesButtonBg.addState(new int[] { android.R.attr.state_pressed }, ImageUtils .createBackgroundDrawable(this, themeManager.getColor("color_button_press_default"), false, 0)); statesButtonBg.addState(new int[] { -android.R.attr.state_pressed }, ImageUtils.createBackgroundDrawable(this, themeManager.getColor("color_top_bar"), false, 0)); imgBarAvatarBg.setBackgroundDrawable(statesButtonBg); StateListDrawable statesButton = new StateListDrawable(); statesButton.addState(new int[] { android.R.attr.state_pressed }, ImageUtils.createBackgroundDrawable(this, themeManager.getColor("color_button_press_default"), false, 0)); statesButton.addState(new int[] { -android.R.attr.state_pressed }, ImageUtils.createBackgroundDrawable(this, themeManager.getColor("color_top_bar"), false, 0)); imgNewStatus.setBackgroundDrawable(statesButton); float size = getResources().getDimension(R.dimen.actionbar_height) - Utils.dip2px(this, 12); imgBarCounter.setBackgroundDrawable(new BitmapDrawable(getResources(), ImageUtils.getBackgroundBitmapInBubble(this, Color.RED, Utils.TYPE_RECTANGLE, size, size))); //(findViewById(R.id.tweettopics_bar_divider1)).setBackgroundDrawable(ImageUtils.createBackgroundDrawable(this, themeManager.getColor("color_top_bar"), false, 0)); //(findViewById(R.id.tweettopics_bar_divider2)).setBackgroundDrawable(ImageUtils.createBackgroundDrawable(this, themeManager.getColor("color_top_bar"), false, 0)); Drawable d = new ColorDrawable(android.R.color.transparent); StateListDrawable states = new StateListDrawable(); states.addState(new int[] { android.R.attr.state_pressed }, d); states.addState(new int[] { android.R.attr.state_window_focused }, d); states.addState(new int[] { android.R.attr.state_pressed }, d); states.addState(new int[] { android.R.attr.state_selected }, d); states.addState(new int[] { android.R.attr.color }, new ColorDrawable(themeManager.getColor("color_indicator_text"))); indicator.setBackgroundDrawable(states); indicator.setTextSize(getResources().getDimension(R.dimen.text_size_title_page_indicator)); }
From source file:es.javocsoft.android.lib.toolbox.ToolBox.java
/** * "Coach mark" (help overlay image)//www . j a va 2s.c om * * @param context * @param coachMarkLayoutId Is "Help overlay" layout id in UX talk :-) * [coach_mark.xml is your coach mark layout] * @param coachMarkMasterViewId is the id of the top most view in coach_mark.xml */ public static void dialog_onCoachMark(Context context, int coachMarkLayoutId, int coachMarkMasterViewId, int bgColor) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(bgColor)); dialog.setContentView(coachMarkLayoutId); dialog.setCanceledOnTouchOutside(true); //for dismissing anywhere you touch View masterView = dialog.findViewById(coachMarkMasterViewId); masterView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.show(); }
From source file:com.ecom.consumer.customviews.HorizontalListView.java
@Override protected void dispatchDraw(Canvas canvas) { canvas.save();// w ww . j av a 2 s .c o m super.dispatchDraw(canvas); if (outRect != null && !mIsBeingDragged) { ColorDrawable drawable = new ColorDrawable(0x884193C9);// 77318fd5new // ColorDrawable(0x440000ff // & // Color.BLUE); drawable.setBounds(outRect); drawable.draw(canvas); } outRect = null; drawEdgeGlow(canvas); canvas.restore(); }