List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable
public ColorDrawable(@ColorInt int color)
From source file:co.taqat.call.assistant.AssistantActivity.java
public void displayRegistrationInProgressDialog() { if (LinphoneManager.getLc().isNetworkReachable()) { progress = ProgressDialog.show(this, null, null); Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorE)); d.setAlpha(200);//from w w w. j av a 2 s. c om progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); progress.getWindow().setBackgroundDrawable(d); progress.setContentView(R.layout.progress_dialog); progress.show(); } }
From source file:com.homeworkreminder.Main.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); registerReceiver(dateReceiver, intentFilter); setContentView(R.layout.home);//w ww .j a v a 2 s. co m inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); context = this; prefs = PreferenceManager.getDefaultSharedPreferences(context); theme = new ThemeManager(this) { @Override public void setColor(ColorScheme scheme) { // TODO Auto-generated method stub mDrawerList.setBackgroundColor(scheme.getUltraDarkColor()); mDrawerList.setSelector(new ColorDrawable(scheme.getNormalColor())); actionBar.setBackgroundDrawable(new ColorDrawable(scheme.getSuperDarkColor())); actionBarExtension.setBackgroundColor(scheme.getSuperDarkColor()); actionBarExtension.getChildAt(0).setBackgroundColor(scheme.getSuperDarkColor()); setColorComboForActionBar(scheme.getColorName()); if (Build.VERSION.SDK_INT >= 11) { VersionHelper.refreshActionBarMenu(activity); } } }; main_content = (RelativeLayout) findViewById(R.id.main_content_screen); actionBarExtension = (RelativeLayout) findViewById(R.id.actionbar_extension); main_container = (RelativeLayout) findViewById(R.id.main_container); notask_notify = (RelativeLayout) findViewById(R.id.notask_notify); notask = (TextView) findViewById(R.id.tv_notask); actionBarExtension.setVisibility(View.VISIBLE); caldroidFragment = new CaldroidFragment(); if (savedInstanceState != null) { caldroidFragment.restoreStatesFromKey(savedInstanceState, "CALDROID_SAVED_STATE"); } else { Bundle args = new Bundle(); Calendar cal = Calendar.getInstance(); args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1); args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR)); args.putBoolean(CaldroidFragment.ENABLE_SWIPE, true); args.putBoolean(CaldroidFragment.SIX_WEEKS_IN_CALENDAR, true); caldroidFragment.setArguments(args); } actionBar = getActionBar(); getActionBar().setHomeButtonEnabled(true); getActionBar().setIcon(R.drawable.ic_drawer); prevScreen = 0; firstStart = true; drawerAdapter = new DrawerListAdapter(this); DrawerItems = getResources().getStringArray(R.array.home_drawer); mDrawerLayout = (DrawerLayout) findViewById(R.id.home_drawer); mDrawerList = (ListView) findViewById(R.id.nav_drawer); mDrawerList.setAdapter(drawerAdapter); SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferences(this); int startupscreen = Integer.parseInt(getPrefs.getString("Startup_screen", "0")); UpcomingDate = Integer.parseInt(getPrefs.getString("Upcoming_date", "7")); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.home, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); getActionBar().setTitle(mTitle); invalidateOptionsMenu(); } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); getActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); Database = new CoreDatabase(this); swipelistview = (SwipeListView) findViewById(R.id.example_swipe_lv_list); swipelistview.setVisibility(View.GONE); subjectlistview = (ExpandableListView) findViewById(R.id.subject_listview); // add_subject_btn = (ImageButton) findViewById(R.id.add_subject_btn); subjectlistview.setVisibility(View.GONE); // add_subject_btn.setVisibility(View.GONE); notask.setText("Loading"); TaskHolder = Database.getAllTask("Pending"); Collections.sort(TaskHolder, new Comparator<Task>() { public int compare(Task o1, Task o2) { return o1.getDue().compareTo(o2.getDue()); } }); generateTaskMap(TaskHolder); // get subjects subjectArray = Database.querySubjectList(); subjectArray.add(0, DEFAULT_SUBJECT); generateSubjectMap(); Completed = Database.getAllTask("Completed"); adapter = new ItemAdapter(this, R.layout.custom_row, TaskHolder, swipelistview, prefs.getString("Color_scheme", "Default")); subject_adapter = new SubjectListAdapter(this, subjectArray, SubjectMap, subjectlistview); swipelistview.setSwipeListViewListener(new BaseSwipeListViewListener() { @Override public void onOpened(int position, boolean toRight) { } @Override public void onClosed(int position, boolean fromRight) { } @Override public void onListChanged() { } @Override public void onMove(int position, float x) { } @Override public void onStartOpen(int position, int action, boolean right) { } @Override public void onStartClose(int position, boolean right) { } @Override public void onClickFrontView(int position) { if (swipelistview.isOpen(position)) { swipelistview.openAnimate(position); } } @Override public void onClickBackView(int position) { } @Override public void onDismiss(int[] reverseSortedPositions) { } }); // These are the swipe listview settings. you can change these // setting as your requirement Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); DisplayMetrics outMetrics = new DisplayMetrics(); display.getMetrics(outMetrics); float density = getResources().getDisplayMetrics().density; dpWidth = outMetrics.widthPixels / density; swipelistview.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT); // modes swipelistview.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL); swipelistview.setOffsetLeft(Util.convertDpToPixel(dpWidth - 180 + 10, this)); // left side offset swipelistview.setOffsetRight(0); // right side offset swipelistview.setAnimationTime(300); // animation time swipelistview.setSwipeOpenOnLongPress(false); swipelistview.setAdapter(adapter); main_container.setBackgroundColor(context.getResources().getColor(R.color.pure_white)); if (startupscreen == 0) { mDrawerList.performItemClick(mDrawerList.getChildAt(0), 0, mDrawerList.getItemIdAtPosition(0)); } else if (startupscreen == 1) { mDrawerList.performItemClick(mDrawerList.getChildAt(1), 1, mDrawerList.getItemIdAtPosition(1)); } else if (startupscreen == 2) { mDrawerList.performItemClick(mDrawerList.getChildAt(2), 2, mDrawerList.getItemIdAtPosition(2)); } else if (startupscreen == 3) { mDrawerList.performItemClick(mDrawerList.getChildAt(3), 3, mDrawerList.getItemIdAtPosition(3)); } else if (startupscreen == 4) { mDrawerList.performItemClick(mDrawerList.getChildAt(4), 4, mDrawerList.getItemIdAtPosition(4)); } else { mDrawerList.performItemClick(mDrawerList.getChildAt(0), 0, mDrawerList.getItemIdAtPosition(0)); } firstStart = false; alarmHandler = new AlarmHandler(this); scheduleClient = new ScheduleClient(this.getApplicationContext()); scheduleClient.doBindService(); this.initActionBarExtension(); theme.loadColorScheme(PreferenceManager.getDefaultSharedPreferences(this)); }
From source file:cn.com.wo.bitmap.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./*from w ww .java 2 s . c o m*/ * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable, boolean isBackground) { if (mFadeInBitmap && !isBackground) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable }); // Set background to loading bitmap int index = 0; if (imageView.getTag() != null) index = (Integer) imageView.getTag(); imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap[index])); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); if (ImageFetcher.isDebug) Log.i(ImageFetcher.TAG, "setImageDrawable src"); } else { if (isBackground) { if (ImageFetcher.isDebug) Log.i(ImageFetcher.TAG, "setImageDrawable isBackground"); imageView.setBackgroundDrawable(null); imageView.setBackgroundDrawable(drawable); } else { if (ImageFetcher.isDebug) Log.i(ImageFetcher.TAG, "setImageDrawable src"); imageView.setImageDrawable(drawable); } } }
From source file:co.taqat.call.assistant.AssistantActivity.java
public void displayRemoteProvisioningInProgressDialog() { remoteProvisioningInProgress = true; progress = ProgressDialog.show(this, null, null); Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorE)); d.setAlpha(200);/*from www . jav a 2s. c om*/ progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); progress.getWindow().setBackgroundDrawable(d); progress.setContentView(R.layout.progress_dialog); progress.show(); }
From source file:com.ifeng.util.imagecache.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.// w w w . j a v a 2 s .c om * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { // Bug fix by XuWei 2013-09-09 // Drawable?bug?ViewDrawable??Drawable Drawable copyDrawable = new BitmapDrawable(mResources, ((BitmapDrawable) drawable).getBitmap()); if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final // drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(android.R.color.transparent), copyDrawable }); // Set background to loading bitmap imageView.setImageDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(copyDrawable); } }
From source file:com.birdeye.MainActivity.java
private void removeAdsDialog() { final Dialog dialog = new Dialog(MainActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.setContentView(R.layout.progress_pre); TextView tv_pay15 = (TextView) dialog.findViewById(R.id.tv_pay15); tv_pay15.setOnClickListener(new View.OnClickListener() { @Override/*from w w w.j a v a2s. c o m*/ public void onClick(View v) { if (!BillingProcessor.isIabServiceAvailable(MainActivity.this)) { showToast( "In-app billing service is unavailable, please upgrade Android Market/Play to version >= 3.9.16"); } else { // asdasd // onFuturePaymentPressed(v); bp.subscribe(MainActivity.this, SUBSCRIPTION_ID); } dialog.dismiss(); } }); dialog.setCancelable(true); dialog.show(); }
From source file:com.android.deskclock.alarms.AlarmActivity.java
private Animator getAlertAnimator(final View source, final int titleResId, final String infoText, final String accessibilityText, final int revealColor, final int backgroundColor) { final ViewGroup containerView = (ViewGroup) findViewById(android.R.id.content); final Rect sourceBounds = new Rect(0, 0, source.getHeight(), source.getWidth()); containerView.offsetDescendantRectToMyCoords(source, sourceBounds); final int centerX = sourceBounds.centerX(); final int centerY = sourceBounds.centerY(); final int xMax = Math.max(centerX, containerView.getWidth() - centerX); final int yMax = Math.max(centerY, containerView.getHeight() - centerY); final float startRadius = Math.max(sourceBounds.width(), sourceBounds.height()) / 2.0f; final float endRadius = (float) Math.sqrt(xMax * xMax + yMax * yMax); final CircleView revealView = new CircleView(this).setCenterX(centerX).setCenterY(centerY) .setFillColor(revealColor);// w w w . j ava 2 s .c o m containerView.addView(revealView); // TODO: Fade out source icon over the reveal (like LOLLIPOP version). final Animator revealAnimator = ObjectAnimator.ofFloat(revealView, CircleView.RADIUS, startRadius, endRadius); revealAnimator.setDuration(ALERT_REVEAL_DURATION_MILLIS); revealAnimator.setInterpolator(REVEAL_INTERPOLATOR); revealAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { mAlertView.setVisibility(View.VISIBLE); mAlertTitleView.setText(titleResId); if (infoText != null) { mAlertInfoView.setText(infoText); mAlertInfoView.setVisibility(View.VISIBLE); } mContentView.setVisibility(View.GONE); getWindow().setBackgroundDrawable(new ColorDrawable(backgroundColor)); } }); final ValueAnimator fadeAnimator = ObjectAnimator.ofFloat(revealView, View.ALPHA, 0.0f); fadeAnimator.setDuration(ALERT_FADE_DURATION_MILLIS); fadeAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { containerView.removeView(revealView); } }); final AnimatorSet alertAnimator = new AnimatorSet(); alertAnimator.play(revealAnimator).before(fadeAnimator); alertAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { mAlertView.announceForAccessibility(accessibilityText); mHandler.postDelayed(new Runnable() { @Override public void run() { finish(); } }, ALERT_DISMISS_DELAY_MILLIS); } }); return alertAnimator; }
From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java
void init() { // img=(ImageView)findViewById(R.id.logo); TextView build = (TextView) findViewById(R.id.checkfornew); build.setOnClickListener(new View.OnClickListener() { @Override//from w ww . ja v a 2 s . c om public void onClick(View v) { if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } CommonUtilities.logMe("about to check for version "); try { WebServiceHandler wsb = new WebServiceHandler(); ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>(); String result = wsb.getWebServiceData("http://doe.emergencyskills.com/api/version.php", postParameters); JSONObject jsonObject = new JSONObject(result); String version = jsonObject.getString("version"); String features = jsonObject.getString("features"); System.err.println("version is : " + version); if (!LoginActivity.myversion.equals(version)) { MyToast.popmessagelong( "There is a new build available. Please download for these features: " + features, TabsActivity.this); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://vireo.org/esiapp")); browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(browserIntent); } else { MyToast.popmessagelong("You have the most current version!", TabsActivity.this); } } catch (Exception exc) { exc.printStackTrace(); } } }); TextView maillog = (TextView) findViewById(R.id.maillog); maillog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_logout); TextView question = (TextView) dialog.findViewById(R.id.question); question.setText("Are you sure you want to email the log?"); TextView extra = (TextView) dialog.findViewById(R.id.extratext); extra.setText(""); dialog.getWindow().setBackgroundDrawable( new ColorDrawable(getResources().getColor(android.R.color.transparent))); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { "rachelc@gmail.com" }); i.putExtra(Intent.EXTRA_SUBJECT, "Sending Log"); i.putExtra(Intent.EXTRA_TEXT, "body of email"); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(TabsActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } finish(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }); listops listops = new listops(TabsActivity.this); CommonUtilities.logMe("logging in as: " + listops.getString("firstname")); TextView name = (TextView) findViewById(R.id.welcome); name.setText("Welcome, " + listops.getString("firstname")); TextView logoutname = (TextView) findViewById(R.id.logoutname); logoutname.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_logout); dialog.getWindow().setBackgroundDrawable( new ColorDrawable(getResources().getColor(android.R.color.transparent))); dialog.setContentView(R.layout.dialog_logout); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MyToast.popmessagelong("Logging out... ", TabsActivity.this); SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putString(Constants.loginkey, ""); editor.commit(); listops listops = new listops(TabsActivity.this); //make sure to remove the downloaded schools Intent intent = new Intent(TabsActivity.this, LoginActivity.class); startActivity(intent); ArrayList<Schoolinfomodel> ls = new ArrayList<Schoolinfomodel>(); listops.putdrilllist(ls); listops.putservicelist(ls); listops.putinstallllist(ls); ArrayList<PendingUploadModel> l = new ArrayList<PendingUploadModel>(); listops.putpendinglist(l); finish(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }); ll1 = (LinearLayout) findViewById(R.id.ll1); ll2 = (LinearLayout) findViewById(R.id.ll2); ll3 = (LinearLayout) findViewById(R.id.ll3); ll4 = (LinearLayout) findViewById(R.id.ll4); ll5 = (LinearLayout) findViewById(R.id.ll5); ll6 = (LinearLayout) findViewById(R.id.ll6); ll1.setBackgroundColor(getResources().getColor(R.color.White)); llPickSchools = (LinearLayout) findViewById(R.id.llPickSchool); llDrills = (LinearLayout) findViewById(R.id.llDrills); llServiceCalls = (LinearLayout) findViewById(R.id.llServiceCalls); llNewInstalls = (LinearLayout) findViewById(R.id.llNewInstalls); llPendingUploads = (LinearLayout) findViewById(R.id.llPendingUploads); frameLayout = (FrameLayout) findViewById(R.id.frame); }
From source file:com.ksharkapps.musicnow.ui.activities.ProfileActivity.java
public void changeActionBarColor(int newColor) { if (SettingsActivity.getTranslucentMode(this) && Utils.hasKitKat()) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayUseLogoEnabled(false); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000ff"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000ff"))); } else {//from w w w. ja v a2s.c o m /*int color = newColor != 0 ? newColor : SettingsActivity.getActionBarColor(this); Drawable colorDrawable = new ColorDrawable(color); Drawable bottomDrawable = getResources().getDrawable(R.drawable.transparent_overlay); LayerDrawable ld = new LayerDrawable(new Drawable[] { colorDrawable, bottomDrawable }); if (oldBackground == null) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { ld.setCallback(drawableCallback); } else { actionBar.setBackgroundDrawable(colorDrawable); } } else { TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, ld }); // workaround for broken ActionBarContainer drawable handling on // pre-API 17 builds // https://github.com/android/platform_frameworks_base/commit/a7cc06d82e45918c37429a59b14545c6a57db4e4 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { td.setCallback(drawableCallback); } else { actionBar.setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true);/ if (Utils.hasKitKat()) { if (SettingsActivity.getTranslucentMode(this)) { SystemBarTintManager tintManager = new SystemBarTintManager( this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(Color.parseColor("#000000ff")); } }*/ actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayUseLogoEnabled(false); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000ff"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000ff"))); } }