Drawable mutate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Drawable mutate method.

This code example shows how to use the following methods:mutate
 
	public static void applyBackground(final View view, final int color) {
		if (view == null) return;
		final Drawable bg = view.getBackground();
		if (bg == null) return;
		bg.mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
		view.invalidate();
	} 
 
	public static int getThemeColor(final Context context) {
		final Resources res = context.getResources();
		final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
		final boolean dark_theme = prefs.getBoolean(PREFERENCE_KEY_DARK_THEME, false);
		final int def = res.getColor(dark_theme ? R.color.holo_blue_dark : R.color.holo_blue_light);
		final String key = dark_theme ? PREFERENCE_KEY_DARK_THEME_COLOR : PREFERENCE_KEY_LIGHT_THEME_COLOR;
		return prefs.getInt(key, def);
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:mutate
 
        if (ENABLE_VERBOSE) {
            DebugLog.vfmt("ImageLruCache", "put %d", key);
        } 
 
        mImageMemCache.put(key, thumb);
        sGlobalMemCache.put(key, thumb.mutate());
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:mutate
 
    @Override 
    public Drawable mutate() {
        if (!mMutated && super.mutate() == this) {
            mLeftCapDrawable.mutate();
            mBottomAnchorDrawable.mutate();
            mRightCapDrawable.mutate();
            mMutated = true;
        } 
        return this;
    } 
 
    @Override 
    public boolean getPadding(Rect padding) {
        // The padding for this Drawable is a composition of some of the 
        // paddings of the underlying Drawables. 
        final Rect rect = mTempRect;
 
        mLeftCapDrawable.getPadding(rect);
        int pLeft = rect.left;
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:mutate
    } 
 
    @Override 
    public Drawable mutate() {
        if (mProxy != null && !mMutated && super.mutate() == this) {
            mProxy.mutate();
            mMutated = true;
        } 
        return this;
    } 
} 
     
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:mutate
    } 
 
    @Override 
    public Drawable mutate() {
        if (mProxy != null && !mMutated && super.mutate() == this) {
            mProxy.mutate();
            mMutated = true;
        } 
        return this;
    } 
} 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:mutate
	public boolean getPadding(Rect padding) {
		return mCurrDrawable.getPadding(padding);
	} 
 
	public Drawable mutate() {
		return mCurrDrawable.mutate();
	} 
 
	public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs)
			throws XmlPullParserException, IOException { 
		mCurrDrawable.inflate(r, parser, attrs);
	} 
 
	public ConstantState getConstantState() {
		return mCurrDrawable.getConstantState();
	} 
 
	public String toString() {
		return TAG+mCurrDrawable.toString();
	} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Drawable mutate Questions & Answers:

mutate Method Overview
Make this drawable mutable.
See Code Examples for other Android Drawable Methods: