List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable
public ColorDrawable(@ColorInt int color)
From source file:com.android.beez.loadimage.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./*from ww w . ja va2 s . c o m*/ * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { 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), drawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setVisibility(View.VISIBLE); imageView.setImageDrawable(drawable); } }
From source file:com.jcsoluciones.superdt.utilities.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 o m * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable( new Drawable[] { new ColorDrawable(R.color.colorPrimary), drawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.appgeneration.magmanager.imagefetcher.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView//from www . ja v a 2 s . c om * @param bitmap */ @SuppressWarnings("deprecation") private void setImageBitmap(ImageView imageView, Bitmap bitmap) { if (mFadeInBitmap) { // Use TransitionDrawable to fade in final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mResources, bitmap) }); imageView.setBackgroundDrawable(imageView.getDrawable()); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageBitmap(bitmap); } }
From source file:com.krava.vkmessenger.domain.image.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from w w w .j av a 2 s . com * * @param imageView * @param drawable */ private void setImageDrawable(ImageView imageView, Drawable drawable) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable and the final drawable final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(imageView.getResources().getColor(android.R.color.transparent)), drawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.apptentive.android.sdk.module.engagement.interaction.fragment.ApptentiveBaseFragment.java
private void showToolbarElevationPreLollipop(boolean visible) { if (!isAdded()) { return;/* w w w. j a v a 2 s . c o m*/ } FrameLayout pager = (FrameLayout) getActivity().findViewById(R.id.apptentive_vp_container); if (pager != null) { if (visible) { Drawable shadow = ContextCompat.getDrawable(getContext(), R.drawable.apptentive_actionbar_compat_shadow); pager.setForeground(shadow); } else { pager.setForeground(new ColorDrawable(0)); } } }
From source file:com.chenl.widgets.flippablestackview.indicator.OrientedPagerSlidingTabLayout.java
private static final StateListDrawable createStateDrawable() { StateListDrawable stateListDrawable = new StateListDrawable(); ColorDrawable normal = new ColorDrawable(Color.TRANSPARENT); ColorDrawable pressed = new ColorDrawable(Color.parseColor("#66000000")); stateListDrawable.addState(new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled }, pressed);//from w ww . j av a 2 s. c o m stateListDrawable.addState(new int[] { android.R.attr.state_pressed }, pressed); stateListDrawable.addState(new int[] { android.R.attr.state_enabled }, normal); stateListDrawable.addState(new int[] {}, normal); return stateListDrawable; }
From source file:com.filemanager.free.fragments.Main.java
void switchToList() { IS_LIST = true;/*from ww w . j ava 2 s .c om*/ if (theme1 == 1) { setBackground(new ColorDrawable(ContextCompat.getColor(getContext(), R.color.holo_dark_background))); } else { if (IS_LIST) setBackground( new ColorDrawable(ContextCompat.getColor(getContext(), android.R.color.background_light))); else setBackground(new ColorDrawable(Color.parseColor("#f2f2f2"))); } ic = new IconHolder(getActivity(), SHOW_THUMBS, !IS_LIST); folder = ContextCompat.getDrawable(getContext(), R.drawable.ic_grid_folder_new); fixIcons(); if (mLayoutManager == null) mLayoutManager = new LinearLayoutManager(getActivity()); listView.setLayoutManager(mLayoutManager); adapter = null; }
From source file:com.amaze.filemanager.fragments.Main.java
void switchToList() { IS_LIST = true;//from w w w. ja v a 2 s . c om if (theme1 == 1) { setBackground(new ColorDrawable(getResources().getColor(R.color.holo_dark_background))); } else { if (IS_LIST) setBackground(new ColorDrawable(getResources().getColor(android.R.color.background_light))); else setBackground(new ColorDrawable(Color.parseColor("#f2f2f2"))); } ic = new IconHolder(getActivity(), SHOW_THUMBS, !IS_LIST); folder = res.getDrawable(R.drawable.ic_grid_folder_new); fixIcons(); if (mLayoutManager == null) mLayoutManager = new LinearLayoutManager(getActivity()); listView.setLayoutManager(mLayoutManager); adapter = null; }
From source file:com.android.gallery3d.v5.filtershow.FilterShowActivity.java
private void loadXML() { setContentView(R.layout.filtershow_activity); ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(LayoutInflater.from(this).inflate(R.layout.filtershow_actionbar, null), new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT)); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.background_screen))); View v = actionBar.getCustomView(); mEditorCancelButton = v.findViewById(R.id.editor_action_cancel); mEditorCancelButton.setOnClickListener(new View.OnClickListener() { @Override/*from w w w. j av a 2 s . c om*/ public void onClick(View v) { Fragment fragment = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG); Fragment editorFrament = fragment.getChildFragmentManager() .findFragmentByTag(CategoryPanel.FRAGMENT_TAG); if (editorFrament instanceof LewaEditorBaseFragment) { ((LewaEditorBaseFragment) editorFrament).restorePreset(); showDefaultImageView(); } onBackPressed(); } }); mEditorApplyButton = v.findViewById(R.id.editor_action_apply); mEditorApplyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Fragment fragment = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG); Fragment editorFrament = fragment.getChildFragmentManager() .findFragmentByTag(CategoryPanel.FRAGMENT_TAG); if (editorFrament instanceof EditorPanel) { ((EditorPanel) editorFrament).apply(); if (((EditorPanel) editorFrament).getEditorId() == R.id.editorCrop) { backToMain(); } if (((EditorPanel) editorFrament).getEditorId() != R.id.editorCrop) { onBackPressed(); } } if (editorFrament instanceof CategoryPanel) { backToMain(); } } }); mResetButton = v.findViewById(R.id.filtershow_reset); mResetButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { resetHistory(); } }); mSaveButton = v.findViewById(R.id.filtershow_done); mSaveButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { saveImage(); } }); mReturnButton = (ImageButton) actionBar.getCustomView().findViewById(R.id.filtershow_return); mReturnButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); mImageShow = (ImageShow) findViewById(R.id.imageShow); mImageViews.add(mImageShow); setupEditors(); mEditorPlaceHolder.hide(); mImageShow.attach(); setupStatePanel(); }
From source file:com.heinrichreimersoftware.materialdrawer.DrawerView.java
private void updateProfile() { Log.d(TAG, "updateProfile()"); if (mProfileAdapter.getCount() > 0) { final DrawerProfile currentProfile = mProfileAdapter.getItem(0); if (mProfileAdapter.getCount() > 2) { /* More than two profiles. Should show a little badge. */ imageViewProfileAvatarSecondary.setVisibility(GONE); textViewProfileAvatarCount.setVisibility(VISIBLE); textViewProfileAvatarCount.setText("+" + (mProfileAdapter.getCount() - 1)); textViewProfileAvatarCount.setOnClickListener(new OnClickListener() { @Override//from ww w . ja v a2 s . c om public void onClick(View v) { openProfileList(); } }); if (currentProfile.getBackground() instanceof BitmapDrawable) { Palette.generateAsync(((BitmapDrawable) currentProfile.getBackground()).getBitmap(), new Palette.PaletteAsyncListener() { @Override public void onGenerated(Palette palette) { Palette.Swatch vibrantSwatch = palette.getVibrantSwatch(); if (vibrantSwatch != null) { textViewProfileAvatarCount.setTextColor(vibrantSwatch.getTitleTextColor()); textViewProfileAvatarCount.getBackground() .setColorFilter(vibrantSwatch.getRgb(), PorterDuff.Mode.SRC_IN); } } }); } } else if (mProfileAdapter.getCount() == 2) { /* Two profiles. Should show the second profile avatar. */ final DrawerProfile secondProfile = mProfileAdapter.getItem(1); imageViewProfileAvatarSecondary.setVisibility(VISIBLE); imageViewProfileAvatarSecondary.setImageDrawable(secondProfile.getAvatar()); imageViewProfileAvatarSecondary.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectProfile(secondProfile); } }); textViewProfileAvatarCount.setVisibility(GONE); closeProfileList(); } if (currentProfile.getAvatar() != null) { imageViewProfileAvatar.setImageDrawable(currentProfile.getAvatar()); } if (currentProfile.getName() != null && !currentProfile.getName().equals("")) { textViewProfileName.setText(currentProfile.getName()); } if (currentProfile.getBackground() != null) { imageViewProfileBackground.setImageDrawable(currentProfile.getBackground()); } else { int colorPrimary = getResources().getColor(R.color.primary_dark_material_light); TypedArray a = getContext().getTheme().obtainStyledAttributes(new int[] { R.attr.colorPrimary }); try { colorPrimary = a.getColor(0, 0); } finally { a.recycle(); } imageViewProfileBackground.setImageDrawable(new ColorDrawable(colorPrimary)); } if (currentProfile.getDescription() != null && !currentProfile.getDescription().equals("")) { textViewProfileDescription.setVisibility(VISIBLE); textViewProfileDescription.setText(currentProfile.getDescription()); } else { textViewProfileDescription.setVisibility(GONE); } if (currentProfile.hasOnProfileClickListener()) { frameLayoutProfile.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { currentProfile.getOnProfileClickListener().onClick(currentProfile, currentProfile.getId()); } }); frameLayoutProfile.setEnabled(true); } else { if (hasOnProfileClickListener()) { frameLayoutProfile.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { getOnProfileClickListener().onClick(currentProfile, currentProfile.getId()); } }); frameLayoutProfile.setEnabled(true); } else { frameLayoutProfile.setEnabled(false); } } if (getWidth() > 0 && frameLayoutProfile.getVisibility() != View.VISIBLE) { frameLayoutProfile .startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.abc_slide_in_top)); } frameLayoutProfile.setVisibility(VISIBLE); layout.setPadding(0, 0, 0, 0); } else { frameLayoutProfile.setVisibility(GONE); layout.setPadding(0, statusBarHeight, 0, 0); closeProfileList(); } }