Search in sources :

Example 81 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project xabber-android by redsolution.

the class AvatarManager method getDefaultAvatarDrawable.

private Drawable getDefaultAvatarDrawable(BaseAvatarSet.DefaultAvatar defaultAvatar) {
    Drawable[] layers = new Drawable[2];
    layers[0] = new ColorDrawable(defaultAvatar.getBackgroundColor());
    layers[1] = application.getResources().getDrawable(defaultAvatar.getIconResource());
    return new LayerDrawable(layers);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Example 82 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project xabber-android by redsolution.

the class AvatarManager method getDefaultAccountAvatar.

@NonNull
public Drawable getDefaultAccountAvatar(String account) {
    Drawable[] layers = new Drawable[2];
    layers[0] = new ColorDrawable(ColorManager.getInstance().getAccountPainter().getAccountMainColor(account));
    layers[1] = application.getResources().getDrawable(R.drawable.ic_avatar_1);
    return new LayerDrawable(layers);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) NonNull(android.support.annotation.NonNull)

Example 83 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project robolectric by robolectric.

the class ShadowResourcesTest method testGetColorDrawable.

@Test
public void testGetColorDrawable() {
    Drawable drawable = resources.getDrawable(R.color.color_with_alpha);
    assertThat(drawable).isInstanceOf(ColorDrawable.class);
    assertThat(((ColorDrawable) drawable).getColor()).isEqualTo(0x802C76AD);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) AnimationDrawable(android.graphics.drawable.AnimationDrawable) Drawable(android.graphics.drawable.Drawable) NinePatchDrawable(android.graphics.drawable.NinePatchDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Test(org.junit.Test)

Example 84 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project robolectric by robolectric.

the class ShadowThemeTest method whenNotSetOnActivityInManifest_activityGetsThemeFromApplicationInManifest.

@Test
public void whenNotSetOnActivityInManifest_activityGetsThemeFromApplicationInManifest() throws Exception {
    TestActivity activity = buildActivity(TestActivity.class).create().get();
    Button theButton = (Button) activity.findViewById(R.id.button);
    ColorDrawable background = (ColorDrawable) theButton.getBackground();
    assertThat(background.getColor()).isEqualTo(0xff00ff00);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) Button(android.widget.Button) Test(org.junit.Test)

Example 85 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project MyDiary by erttyy8821.

the class SettingActivity method setThemeColor.

private void setThemeColor() {
    IV_setting_theme_main_color.setImageDrawable(new ColorDrawable(themeManager.getThemeMainColor(this)));
    IV_setting_theme_dark_color.setImageDrawable(new ColorDrawable(themeManager.getThemeDarkColor(this)));
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable)

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