From ebb9f3a1a3cb405dac7f98815b37c198c65739cd Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Fri, 7 Mar 2014 17:04:52 -0800 Subject: [PATCH] Cleanup ContextThemeWrapper - remove reference to base Context as we can get it thru getBaseContext() call Change-Id: I2687c15db12624243fadba44d624e2e4bdae240d --- core/java/android/view/ContextThemeWrapper.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/java/android/view/ContextThemeWrapper.java b/core/java/android/view/ContextThemeWrapper.java index 1de9c352b58f3..0afbde9ee14f6 100644 --- a/core/java/android/view/ContextThemeWrapper.java +++ b/core/java/android/view/ContextThemeWrapper.java @@ -26,7 +26,6 @@ import android.content.res.Resources; * wrapped context. */ public class ContextThemeWrapper extends ContextWrapper { - private Context mBase; private int mThemeResource; private Resources.Theme mTheme; private LayoutInflater mInflater; @@ -39,13 +38,11 @@ public class ContextThemeWrapper extends ContextWrapper { public ContextThemeWrapper(Context base, int themeres) { super(base); - mBase = base; mThemeResource = themeres; } @Override protected void attachBaseContext(Context newBase) { super.attachBaseContext(newBase); - mBase = newBase; } /** @@ -109,11 +106,11 @@ public class ContextThemeWrapper extends ContextWrapper { @Override public Object getSystemService(String name) { if (LAYOUT_INFLATER_SERVICE.equals(name)) { if (mInflater == null) { - mInflater = LayoutInflater.from(mBase).cloneInContext(this); + mInflater = LayoutInflater.from(getBaseContext()).cloneInContext(this); } return mInflater; } - return mBase.getSystemService(name); + return getBaseContext().getSystemService(name); } /** @@ -135,7 +132,7 @@ public class ContextThemeWrapper extends ContextWrapper { final boolean first = mTheme == null; if (first) { mTheme = getResources().newTheme(); - Resources.Theme theme = mBase.getTheme(); + Resources.Theme theme = getBaseContext().getTheme(); if (theme != null) { mTheme.setTo(theme); }