diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2015-11-05 17:21:16 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-11-05 17:21:16 +0000 |
commit | 71093465abbdf887c705b40fb0cb8a2919894c4b (patch) | |
tree | 263c1c834abf89d0d8d757a0ecdc51667174a91b | |
parent | 6c1144dc0f8b2452ca2a204ca471e2d23339d5a3 (diff) | |
parent | c9b8f95c99688c71184d90f53dcf90e52816d02f (diff) | |
download | frameworks_base-71093465abbdf887c705b40fb0cb8a2919894c4b.zip frameworks_base-71093465abbdf887c705b40fb0cb8a2919894c4b.tar.gz frameworks_base-71093465abbdf887c705b40fb0cb8a2919894c4b.tar.bz2 |
Merge "Fix Switch colors" into mnc-ub-dev
-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; } |