diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2013-04-09 18:04:29 -0700 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2013-04-11 13:38:57 -0700 |
commit | dc25d25333d3fac96dccfb9bd31d2474d6bc2d78 (patch) | |
tree | e0b30286b2622b51482770d2a3b7fec11208c7bc | |
parent | 94d6170b67bcfb5dc5a0c988752d34e64a5f5272 (diff) | |
download | frameworks_base-dc25d25333d3fac96dccfb9bd31d2474d6bc2d78.zip frameworks_base-dc25d25333d3fac96dccfb9bd31d2474d6bc2d78.tar.gz frameworks_base-dc25d25333d3fac96dccfb9bd31d2474d6bc2d78.tar.bz2 |
More fix for bug #8159072 Spinner widget should be RTL'ized
- fix DrawableContainerState.getChangingConfigurations() to take care about its children
- make Resources.verifyPreloadConfig() return false when the changing configuration
contains layout direction bits (this is when a Drawable is having different version
for LTR and RTL layout directions)
- use constant state instead of the resource type value for checking if we can
preload the drawable
- fix typo
Change-Id: Idd64caf0fbe0f5cfd5ffe09343e84bafa9446ea5
-rw-r--r-- | core/java/android/content/pm/ActivityInfo.java | 2 | ||||
-rw-r--r-- | core/java/android/content/res/Resources.java | 19 | ||||
-rw-r--r-- | graphics/java/android/graphics/drawable/DrawableContainer.java | 2 |
3 files changed, 13 insertions, 10 deletions
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index 8f3b62d..712a3a4 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -398,7 +398,7 @@ public class ActivityInfo extends ComponentInfo * Bit in {@link #configChanges} that indicates that the activity * can itself handle changes to the font scaling factor. Set from the * {@link android.R.attr#configChanges} attribute. This is - * not a core resource configutation, but a higher-level value, so its + * not a core resource configuration, but a higher-level value, so its * constant starts at the high bits. */ public static final int CONFIG_FONT_SCALE = 0x40000000; diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 0152615..9338f3d 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -1977,17 +1977,20 @@ public class Resources { } } - private boolean verifyPreloadConfig(TypedValue value, String name) { - if ((value.changingConfigurations&~(ActivityInfo.CONFIG_FONT_SCALE - | ActivityInfo.CONFIG_DENSITY)) != 0) { + static private final int VARYING_CONFIGS = ActivityInfo.activityInfoConfigToNative( + ActivityInfo.CONFIG_LAYOUT_DIRECTION); + + private boolean verifyPreloadConfig(int changingConfigurations, int resourceId, String name) { + if (((changingConfigurations&~(ActivityInfo.CONFIG_FONT_SCALE | + ActivityInfo.CONFIG_DENSITY)) & VARYING_CONFIGS) != 0) { String resName; try { - resName = getResourceName(value.resourceId); + resName = getResourceName(resourceId); } catch (NotFoundException e) { resName = "?"; } Log.w(TAG, "Preloaded " + name + " resource #0x" - + Integer.toHexString(value.resourceId) + + Integer.toHexString(resourceId) + " (" + resName + ") that varies with configuration!!"); return false; } @@ -2090,7 +2093,7 @@ public class Resources { cs = dr.getConstantState(); if (cs != null) { if (mPreloading) { - if (verifyPreloadConfig(value, "drawable")) { + if (verifyPreloadConfig(cs.getChangingConfigurations(), value.resourceId, "drawable")) { if (isColorDrawable) { sPreloadedColorDrawables.put(key, cs); } else { @@ -2160,7 +2163,7 @@ public class Resources { csl = ColorStateList.valueOf(value.data); if (mPreloading) { - if (verifyPreloadConfig(value, "color")) { + if (verifyPreloadConfig(value.changingConfigurations, value.resourceId, "color")) { sPreloadedColorStateLists.put(key, csl); } } @@ -2206,7 +2209,7 @@ public class Resources { if (csl != null) { if (mPreloading) { - if (verifyPreloadConfig(value, "color")) { + if (verifyPreloadConfig(value.changingConfigurations, value.resourceId, "color")) { sPreloadedColorStateLists.put(key, csl); } } else { diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java index a0c9701..8a4d598 100644 --- a/graphics/java/android/graphics/drawable/DrawableContainer.java +++ b/graphics/java/android/graphics/drawable/DrawableContainer.java @@ -512,7 +512,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback { @Override public int getChangingConfigurations() { - return mChangingConfigurations; + return mChangingConfigurations | mChildrenChangingConfigurations; } public final int addChild(Drawable dr) { |