diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2015-11-04 17:49:16 -0800 |
---|---|---|
committer | Deepanshu Gupta <deepanshu@google.com> | 2015-11-05 09:20:07 -0800 |
commit | c9b8f95c99688c71184d90f53dcf90e52816d02f (patch) | |
tree | bbb790466d7252bc9d5e48fd36e87a28583ed8a1 /tools | |
parent | c5b905f50069233c2769352a0614605b3ad348f8 (diff) | |
download | frameworks_base-c9b8f95c99688c71184d90f53dcf90e52816d02f.zip frameworks_base-c9b8f95c99688c71184d90f53dcf90e52816d02f.tar.gz frameworks_base-c9b8f95c99688c71184d90f53dcf90e52816d02f.tar.bz2 |
Fix Switch colors
The conversion of the PorterDuff mode from int to enum was incorrect
resulting in the wrong PorterDuff Mode being used.
Change-Id: I7607d505b6e4382e6101869971154f6a77db279c
Diffstat (limited to 'tools')
-rw-r--r-- | tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java index 9588035..80d7c68 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java @@ -21,6 +21,7 @@ import com.android.layoutlib.bridge.Bridge; import android.graphics.BlendComposite; import android.graphics.BlendComposite.BlendingMode; +import android.graphics.PorterDuff; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffColorFilter_Delegate; import android.graphics.PorterDuffXfermode_Delegate; @@ -34,6 +35,8 @@ import java.awt.Composite; */ public final class PorterDuffUtility { + private static final int MODES_COUNT = Mode.values().length; + // Make the class non-instantiable. private PorterDuffUtility() { } @@ -43,12 +46,11 @@ public final class PorterDuffUtility { * {@link Mode#SRC_OVER} for invalid modes. */ public static Mode getPorterDuffMode(int porterDuffMode) { - Mode[] values = Mode.values(); - if (porterDuffMode >= 0 && porterDuffMode < values.length) { - return values[porterDuffMode]; + if (porterDuffMode >= 0 && porterDuffMode < MODES_COUNT) { + return PorterDuff.intToMode(porterDuffMode); } Bridge.getLog().error(LayoutLog.TAG_BROKEN, - String.format("Unknown PorterDuff.Mode: %1$d", porterDuffMode), null /*data*/); + String.format("Unknown PorterDuff.Mode: %1$d", porterDuffMode), null); assert false; return Mode.SRC_OVER; } |