Search in sources :

Example 46 with ColorDrawable

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);
}
Also used : TransitionDrawable(android.graphics.drawable.TransitionDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) TransitionDrawable(android.graphics.drawable.TransitionDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Example 47 with ColorDrawable

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)));
        }
    }
}
Also used : Window(android.view.Window) ColorDrawable(android.graphics.drawable.ColorDrawable) TypedArray(android.content.res.TypedArray) RelativeLayout(android.widget.RelativeLayout)

Example 48 with ColorDrawable

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();
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable)

Example 49 with ColorDrawable

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();
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable)

Example 50 with ColorDrawable

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));
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) Point(android.graphics.Point) Test(org.junit.Test)

Aggregations

ColorDrawable (android.graphics.drawable.ColorDrawable)530 View (android.view.View)113 Drawable (android.graphics.drawable.Drawable)103 BitmapDrawable (android.graphics.drawable.BitmapDrawable)69 ImageView (android.widget.ImageView)62 TextView (android.widget.TextView)55 Bitmap (android.graphics.Bitmap)52 AdapterView (android.widget.AdapterView)32 LinearLayout (android.widget.LinearLayout)32 Test (org.junit.Test)31 Canvas (android.graphics.Canvas)30 ListView (android.widget.ListView)27 FrameLayout (android.widget.FrameLayout)23 ViewGroup (android.view.ViewGroup)22 Handler (android.os.Handler)20 Paint (android.graphics.Paint)19 StateListDrawable (android.graphics.drawable.StateListDrawable)19 TransitionDrawable (android.graphics.drawable.TransitionDrawable)19 WindowManager (android.view.WindowManager)17 Intent (android.content.Intent)16