Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 266b3026 authored by Adam Powell's avatar Adam Powell Committed by Android Git Automerger
Browse files

am 20ba658b: am 31049d76: Use SCREEN Xfermode for keyguard badges; update SeekBar

* commit '20ba658b':
  Use SCREEN Xfermode for keyguard badges; update SeekBar
parents 62d3158f 20ba658b
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.graphics.Matrix;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF;
import android.graphics.Xfermode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
@@ -73,6 +74,7 @@ public class ImageView extends View {

    // these are applied to the drawable
    private ColorFilter mColorFilter;
    private Xfermode mXfermode;
    private int mAlpha = 255;
    private int mViewAlphaScale = 256;
    private boolean mColorMod = false;
@@ -1124,6 +1126,18 @@ public class ImageView extends View {
        setColorFilter(null);
    }

    /**
     * @hide Candidate for future API inclusion
     */
    public final void setXfermode(Xfermode mode) {
        if (mXfermode != mode) {
            mXfermode = mode;
            mColorMod = true;
            applyColorMod();
            invalidate();
        }
    }

    /**
     * Returns the active color filter for this ImageView.
     *
@@ -1200,6 +1214,7 @@ public class ImageView extends View {
        if (mDrawable != null && mColorMod) {
            mDrawable = mDrawable.mutate();
            mDrawable.setColorFilter(mColorFilter);
            mDrawable.setXfermode(mXfermode);
            mDrawable.setAlpha(mAlpha * mViewAlphaScale >> 8);
        }
    }
+9 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.Shader;
import android.graphics.Xfermode;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.LayoutDirection;
@@ -530,6 +531,14 @@ public class BitmapDrawable extends Drawable {
        invalidateSelf();
    }

    /**
     * @hide Candidate for future API inclusion
     */
    public void setXfermode(Xfermode xfermode) {
        mBitmapState.mPaint.setXfermode(xfermode);
        invalidateSelf();
    }

    /**
     * A mutable BitmapDrawable still shares its Bitmap with any other Drawable
     * that comes from the same resource.
+10 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.graphics.drawable;

import android.graphics.Insets;
import android.graphics.Xfermode;
import android.os.Trace;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -427,6 +428,15 @@ public abstract class Drawable {
    */
    public abstract void setColorFilter(ColorFilter cf);

    /**
     * @hide Consider for future API inclusion
     */
    public void setXfermode(Xfermode mode) {
        // Base implementation drops it on the floor for compatibility. Whee!
        // TODO: For this to be included in the API proper, all framework drawables need impls.
        // For right now only BitmapDrawable has it.
    }

    /**
     * Specify a color and porterduff mode to be the colorfilter for this
     * drawable.
+175 B
Loading image diff...
+413 B
Loading image diff...
Loading