diff --git a/replugin-plugin-library/replugin-plugin-lib/src/main/java/com/qihoo360/replugin/loader/a/PluginAppCompatXActivity.java b/replugin-plugin-library/replugin-plugin-lib/src/main/java/com/qihoo360/replugin/loader/a/PluginAppCompatXActivity.java index e86121c3..7131ab85 100644 --- a/replugin-plugin-library/replugin-plugin-lib/src/main/java/com/qihoo360/replugin/loader/a/PluginAppCompatXActivity.java +++ b/replugin-plugin-library/replugin-plugin-lib/src/main/java/com/qihoo360/replugin/loader/a/PluginAppCompatXActivity.java @@ -18,6 +18,7 @@ import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.os.Build; import android.os.Bundle; @@ -26,6 +27,7 @@ import com.qihoo360.replugin.RePluginInternal; import com.qihoo360.replugin.helper.LogRelease; +import com.qihoo360.replugin.loader.PluginResource; import java.lang.reflect.Field; @@ -34,15 +36,25 @@ */ public abstract class PluginAppCompatXActivity extends AppCompatActivity { + private PluginResource pluginResource; + @Override protected void attachBaseContext(Context newBase) { newBase = RePluginInternal.createActivityContext(this, newBase); + pluginResource = new PluginResource(newBase); super.attachBaseContext(newBase); } @Override - public Context getBaseContext() { + public Resources getResources() { + if (pluginResource != null){ + return pluginResource; + } + return super.getResources(); + } + @Override + public Context getBaseContext() { return super.getBaseContext(); } diff --git a/replugin-plugin-library/replugin-plugin-lib/src/main/java/com/qihoo360/replugin/loader/a/PluginFragmentXActivity.java b/replugin-plugin-library/replugin-plugin-lib/src/main/java/com/qihoo360/replugin/loader/a/PluginFragmentXActivity.java index 95c86530..62f2120d 100644 --- a/replugin-plugin-library/replugin-plugin-lib/src/main/java/com/qihoo360/replugin/loader/a/PluginFragmentXActivity.java +++ b/replugin-plugin-library/replugin-plugin-lib/src/main/java/com/qihoo360/replugin/loader/a/PluginFragmentXActivity.java @@ -18,6 +18,7 @@ import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.os.Build; import android.os.Bundle; @@ -26,6 +27,7 @@ import com.qihoo360.replugin.RePluginInternal; import com.qihoo360.replugin.helper.LogRelease; +import com.qihoo360.replugin.loader.PluginResource; import java.lang.reflect.Field; @@ -34,15 +36,25 @@ */ public abstract class PluginFragmentXActivity extends FragmentActivity { + private PluginResource pluginResource; + @Override protected void attachBaseContext(Context newBase) { newBase = RePluginInternal.createActivityContext(this, newBase); + pluginResource = new PluginResource(newBase); super.attachBaseContext(newBase); } @Override - public Context getBaseContext() { + public Resources getResources() { + if (pluginResource != null){ + return pluginResource; + } + return super.getResources(); + } + @Override + public Context getBaseContext() { return super.getBaseContext(); }