diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2015-03-17 14:16:50 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-03-17 14:16:50 +0000 |
commit | 1f9a26af95abba385b612c734d1d5e32d9e3f363 (patch) | |
tree | e1f46f503b86a6d7c2cedfc11e8687bb762b6143 /tools/layoutlib/bridge/src/android | |
parent | 9a00f1c84b7a7936a12415a08604ac8fb98ec5ea (diff) | |
parent | 158c08bcf1cd0bc702748ee2a4cf6aa259c26147 (diff) | |
download | frameworks_base-1f9a26af95abba385b612c734d1d5e32d9e3f363.zip frameworks_base-1f9a26af95abba385b612c734d1d5e32d9e3f363.tar.gz frameworks_base-1f9a26af95abba385b612c734d1d5e32d9e3f363.tar.bz2 |
am 158c08bc: am ada85905: Fix AppCompat action bar theming.
* commit '158c08bcf1cd0bc702748ee2a4cf6aa259c26147':
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(); } |