Search in sources :

Example 86 with ColorDrawable

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

the class ThemeManager method getContactsBgDrawable.

public Drawable getContactsBgDrawable(Context context, long topicId) {
    Drawable bgDrawable;
    File memoBg = new File(new FileManager(context, FileManager.CONTACTS_ROOT_DIR).getDirAbsolutePath() + "/" + topicId + "/" + CUSTOM_TOPIC_BG_FILENAME);
    if (memoBg.exists()) {
        bgDrawable = Drawable.createFromPath(memoBg.getAbsolutePath());
    } else {
        switch(currentTheme) {
            case TAKI:
                bgDrawable = ViewTools.getDrawable(context, R.drawable.contacts_bg_taki);
                break;
            case MITSUHA:
                bgDrawable = ViewTools.getDrawable(context, R.drawable.contacts_bg_mitsuha);
                break;
            default:
                bgDrawable = new ColorDrawable(SPFManager.getMainColor(context));
                break;
        }
    }
    return bgDrawable;
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) StateListDrawable(android.graphics.drawable.StateListDrawable) GradientDrawable(android.graphics.drawable.GradientDrawable) File(java.io.File)

Example 87 with ColorDrawable

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

the class ThemeManager method getMemoBgDrawable.

public Drawable getMemoBgDrawable(Context context, long topicId) {
    Drawable bgDrawable;
    File memoBg = new File(new FileManager(context, FileManager.MEMO_ROOT_DIR).getDirAbsolutePath() + "/" + topicId + "/" + CUSTOM_TOPIC_BG_FILENAME);
    if (memoBg.exists()) {
        bgDrawable = Drawable.createFromPath(memoBg.getAbsolutePath());
    } else {
        switch(currentTheme) {
            case TAKI:
                bgDrawable = new ColorDrawable(Color.WHITE);
                break;
            case MITSUHA:
                bgDrawable = new ColorDrawable(Color.WHITE);
                break;
            default:
                bgDrawable = new ColorDrawable(Color.WHITE);
                break;
        }
    }
    return bgDrawable;
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) StateListDrawable(android.graphics.drawable.StateListDrawable) GradientDrawable(android.graphics.drawable.GradientDrawable) File(java.io.File)

Example 88 with ColorDrawable

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

the class ThemeManager method createTopicItemSelectBg.

private Drawable createTopicItemSelectBg(Context context) {
    StateListDrawable stateListDrawable = new StateListDrawable();
    stateListDrawable.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(getThemeMainColor(context)));
    stateListDrawable.addState(new int[] {}, new ColorDrawable(Color.WHITE));
    return stateListDrawable;
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) StateListDrawable(android.graphics.drawable.StateListDrawable)

Example 89 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project photo-picker-plus-android by chute.

the class BaseActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setEnterTransition(new Explode());
        getWindow().setExitTransition(new Explode());
    }
    setContentView(getLayoutResource());
    Toolbar toolBar = (Toolbar) findViewById(R.id.toolbar);
    if (toolBar != null) {
        toolBar.bringToFront();
        setSupportActionBar(toolBar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setIcon(new ColorDrawable(android.R.color.transparent));
        getSupportActionBar().setTitle(R.string.choose_service);
        setToolBar(toolBar);
    }
}
Also used : Explode(android.transition.Explode) ColorDrawable(android.graphics.drawable.ColorDrawable) Toolbar(android.support.v7.widget.Toolbar)

Example 90 with ColorDrawable

use of android.graphics.drawable.ColorDrawable in project FastAdapter by mikepenz.

the class FastAdapterUIUtils method getSelectablePressedBackground.

/**
     * helper to get the system default selectable background inclusive an active and pressed state
     *
     * @param ctx            the context
     * @param selected_color the selected color
     * @param pressed_alpha  0-255
     * @param animate        true if you want to fade over the states (only animates if API newer than Build.VERSION_CODES.HONEYCOMB)
     * @return the StateListDrawable
     */
public static StateListDrawable getSelectablePressedBackground(Context ctx, @ColorInt int selected_color, int pressed_alpha, boolean animate) {
    StateListDrawable states = getSelectableBackground(ctx, selected_color, animate);
    ColorDrawable clrPressed = new ColorDrawable(adjustAlpha(selected_color, pressed_alpha));
    states.addState(new int[] { android.R.attr.state_pressed }, clrPressed);
    return states;
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) StateListDrawable(android.graphics.drawable.StateListDrawable)

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