diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2015-03-17 14:53:17 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-03-17 14:53:17 +0000 |
commit | 74bf54037cdf23759530da0560aede33e6a35c5c (patch) | |
tree | 7ca6057af0e881fcbba24c2d949341fd20b9dd14 /tools/layoutlib/bridge/src/android | |
parent | a0c3191b74d1119999d94c71de8d916e128ea009 (diff) | |
parent | 199a70f1820c38a9f1db1697ad91c4f5f07d00aa (diff) | |
download | frameworks_base-74bf54037cdf23759530da0560aede33e6a35c5c.zip frameworks_base-74bf54037cdf23759530da0560aede33e6a35c5c.tar.gz frameworks_base-74bf54037cdf23759530da0560aede33e6a35c5c.tar.bz2 |
am 199a70f1: am 576801ff: am 842eee9f: am 1f9a26af: am 158c08bc: am ada85905: Fix AppCompat action bar theming.
* commit '199a70f1820c38a9f1db1697ad91c4f5f07d00aa':
Fix AppCompat action bar theming.
Diffstat (limited to 'tools/layoutlib/bridge/src/android')
3 files changed, 12 insertions, 13 deletions
diff --git a/tools/layoutlib/bridge/src/android/view/BridgeInflater.java b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java index 8192b5f..4acbd1c 100644 --- a/tools/layoutlib/bridge/src/android/view/BridgeInflater.java +++ b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java @@ -39,6 +39,8 @@ import android.util.AttributeSet; import java.io.File; +import static com.android.layoutlib.bridge.android.BridgeContext.getBaseContext; + /** * Custom implementation of {@link LayoutInflater} to handle custom views. */ @@ -60,7 +62,12 @@ public final class BridgeInflater extends LayoutInflater { protected BridgeInflater(LayoutInflater original, Context newContext) { super(original, newContext); - mProjectCallback = null; + newContext = getBaseContext(newContext); + if (newContext instanceof BridgeContext) { + mProjectCallback = ((BridgeContext) newContext).getProjectCallback(); + } else { + mProjectCallback = null; + } } /** @@ -154,9 +161,7 @@ public final class BridgeInflater extends LayoutInflater { @Override public View inflate(int resource, ViewGroup root) { Context context = getContext(); - while (context instanceof ContextThemeWrapper) { - context = ((ContextThemeWrapper) context).getBaseContext(); - } + context = getBaseContext(context); if (context instanceof BridgeContext) { BridgeContext bridgeContext = (BridgeContext)context; @@ -219,9 +224,7 @@ public final class BridgeInflater extends LayoutInflater { private void setupViewInContext(View view, AttributeSet attrs) { Context context = getContext(); - while (context instanceof ContextThemeWrapper) { - context = ((ContextThemeWrapper) context).getBaseContext(); - } + context = getBaseContext(context); if (context instanceof BridgeContext) { BridgeContext bc = (BridgeContext) context; // get the view key diff --git a/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java b/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java index dafc96b..08a97d6 100644 --- a/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java +++ b/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java @@ -48,9 +48,7 @@ public class MenuInflater_Delegate { AttributeSet attrs) { if (menuItem instanceof BridgeMenuItemImpl) { Context context = thisInflater.getContext(); - while (context instanceof ContextThemeWrapper) { - context = ((ContextThemeWrapper) context).getBaseContext(); - } + context = BridgeContext.getBaseContext(context); if (context instanceof BridgeContext) { Object viewKey = BridgeInflater.getViewKeyFromParser( attrs, ((BridgeContext) context), null, false); diff --git a/tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java b/tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java index 3915046..82ae1df 100644 --- a/tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java +++ b/tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java @@ -122,9 +122,7 @@ public class ViewGroup_Delegate { @NonNull private static DisplayMetrics getMetrics(View view) { Context context = view.getContext(); - while (context instanceof ContextThemeWrapper) { - context = ((ContextThemeWrapper) context).getBaseContext(); - } + context = BridgeContext.getBaseContext(context); if (context instanceof BridgeContext) { return ((BridgeContext) context).getMetrics(); } |