use of android.graphics.drawable.ColorDrawable in project NotificationPeekPort by lzanita09.
the class AppearanceSettingsFragment method initPreviewBackgroundDrawable.
/**
* Create a new {@link android.graphics.drawable.TransitionDrawable} object with correct order
* of Drawables based on user selection.
*
* @return TransitionDrawable object created.
*/
private TransitionDrawable initPreviewBackgroundDrawable() {
boolean isWallpaperSelected = WallpaperFactory.isWallpaperThemeSelected(getActivity());
Drawable black = new ColorDrawable(Color.BLACK);
Drawable wallpaper = mUseLiveWallpaper ? new ColorDrawable(Color.TRANSPARENT) : new BitmapDrawable(getResources(), mWallpaperFactory.getPrefSystemWallpaper());
mChangeDrawables = !isWallpaperSelected ? new Drawable[] { black, wallpaper } : new Drawable[] { wallpaper, black };
mBlackDrawableIndex = !isWallpaperSelected ? 0 : 1;
return new TransitionDrawable(mChangeDrawables);
}
use of android.graphics.drawable.ColorDrawable in project AdvancedMaterialDrawer by madcyph3r.
the class MaterialNavigationDrawer method initKitKatDependencies.
private void initKitKatDependencies(Resources.Theme theme) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
TypedArray windowTraslucentAttribute = theme.obtainStyledAttributes(new int[] { android.R.attr.windowTranslucentStatus });
kitkatTraslucentStatusbar = windowTraslucentAttribute.getBoolean(0, false);
if (kitkatTraslucentStatusbar) {
Window window = this.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
RelativeLayout.LayoutParams statusParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, resources.getDimensionPixelSize(R.dimen.traslucentStatusMargin));
statusBar.setLayoutParams(statusParams);
statusBar.setImageDrawable(new ColorDrawable(darkenColor(primaryColor)));
}
}
}
use of android.graphics.drawable.ColorDrawable in project AdvancedMaterialDrawer by madcyph3r.
the class MaterialRippleLayout method setRippleBackground.
public void setRippleBackground(int color) {
rippleBackground = new ColorDrawable(color);
rippleBackground.setBounds(bounds);
invalidate();
}
use of android.graphics.drawable.ColorDrawable in project AdvancedMaterialDrawer by madcyph3r.
the class MaterialRippleLayoutNineOld method setRippleBackground.
public void setRippleBackground(int color) {
rippleBackground = new ColorDrawable(color);
rippleBackground.setBounds(bounds);
invalidate();
}
use of android.graphics.drawable.ColorDrawable in project robolectric by robolectric.
the class ShadowViewTest method shouldSetBackgroundColor.
@Test
public void shouldSetBackgroundColor() {
int red = 0xffff0000;
view.setBackgroundColor(red);
assertThat((ColorDrawable) view.getBackground()).isEqualTo(new ColorDrawable(red));
}
Aggregations