diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2014-06-09 19:55:41 -0700 |
---|---|---|
committer | Deepanshu Gupta <deepanshu@google.com> | 2014-06-10 17:44:37 -0700 |
commit | b54b78e21554b8450893d4c28e0fe3e9b8c4425e (patch) | |
tree | 9da9d596e1367e6b36ba1e21cc14c21089fedb31 /tools | |
parent | 1160e6d2f7018117b0c29a7e2adba9ece36faec1 (diff) | |
download | frameworks_base-b54b78e21554b8450893d4c28e0fe3e9b8c4425e.zip frameworks_base-b54b78e21554b8450893d4c28e0fe3e9b8c4425e.tar.gz frameworks_base-b54b78e21554b8450893d4c28e0fe3e9b8c4425e.tar.bz2 |
LayoutLib: Support more ContextThemeWrappers
ContextThemeWrapper may be the base context for another
ContextThemeWrapper. We now extract the base context till we reach the
final context.
Change-Id: I034444a2d1579241543fd24248530b299e72498a
Diffstat (limited to 'tools')
3 files changed, 4 insertions, 4 deletions
diff --git a/tools/layoutlib/bridge/src/android/view/BridgeInflater.java b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java index af22f44..36102f1 100644 --- a/tools/layoutlib/bridge/src/android/view/BridgeInflater.java +++ b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java @@ -151,7 +151,7 @@ public final class BridgeInflater extends LayoutInflater { @Override public View inflate(int resource, ViewGroup root) { Context context = getContext(); - if (context instanceof ContextThemeWrapper) { + while (context instanceof ContextThemeWrapper) { context = ((ContextThemeWrapper) context).getBaseContext(); } if (context instanceof BridgeContext) { @@ -217,7 +217,7 @@ public final class BridgeInflater extends LayoutInflater { private void setupViewInContext(View view, AttributeSet attrs) { Context context = getContext(); - if (context instanceof ContextThemeWrapper) { + while (context instanceof ContextThemeWrapper) { context = ((ContextThemeWrapper) context).getBaseContext(); } if (context instanceof BridgeContext) { diff --git a/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java b/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java index 0dddf3d..dafc96b 100644 --- a/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java +++ b/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java @@ -48,7 +48,7 @@ public class MenuInflater_Delegate { AttributeSet attrs) { if (menuItem instanceof BridgeMenuItemImpl) { Context context = thisInflater.getContext(); - if (context instanceof ContextThemeWrapper) { + while (context instanceof ContextThemeWrapper) { context = ((ContextThemeWrapper) context).getBaseContext(); } if (context instanceof BridgeContext) { diff --git a/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java b/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java index cdb839a..8d1d0c1 100644 --- a/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java +++ b/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java @@ -42,7 +42,7 @@ public class BridgeMenuItemImpl extends MenuItemImpl { CharSequence title, int showAsAction) { super(menu, group, id, categoryOrder, ordering, title, showAsAction); Context context = menu.getContext(); - if (context instanceof ContextThemeWrapper) { + while (context instanceof ContextThemeWrapper) { context = ((ContextThemeWrapper) context).getBaseContext(); } if (context instanceof BridgeContext) { |