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

Commit 38f93bcb authored by Alan Viverette's avatar Alan Viverette
Browse files

Always apply ImageView's tint attribute using SRC_ATOP by default

Preserves pre-L behavior and avoids requiring developers to manually
set the tintMode to SRC_ATOP when targeting SDK 21+.

BUG: 17507827
Change-Id: I43f86cbcb9662172254f46700441ca85a54428f6
parent 5ff1d4f8
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -173,12 +173,11 @@ public class ImageView extends View {
            mDrawableTintList = a.getColorStateList(R.styleable.ImageView_tint);
            mHasDrawableTint = true;

            // Prior to L, the tint mode was always SRC_ATOP.
            if (mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.L) {
            // Prior to L, this attribute would always set a color filter with
            // blending mode SRC_ATOP. Preserve that default behavior.
            mDrawableTintMode = PorterDuff.Mode.SRC_ATOP;
            mHasDrawableTintMode = true;
        }
        }

        if (a.hasValue(R.styleable.ImageView_tintMode)) {
            mDrawableTintMode = Drawable.parseTintMode(a.getInt(
+1 −1
Original line number Diff line number Diff line
@@ -3446,7 +3446,7 @@
        <!-- An optional argument to supply a maximum height for this view.
             See {see android.widget.ImageView#setMaxHeight} for details. -->
        <attr name="maxHeight" format="dimension" />
        <!-- Set a tinting color for the image. -->
        <!-- Set a tinting color for the image. By default, the tint will blend using SRC_ATOP mode. -->
        <attr name="tint" format="color" />
        <!-- If true, the image view will be baseline aligned with based on its
             bottom edge. -->