Shadow
Shadow copied to clipboard
shadow插件里PluginDefaultProxyActivity 主题是透明的,导致onStop没有调用
我们在onStop里有对应的业务处理,但是使用shadow变成插件之后,会导致Activity的onStop没有调用。
看了一下代码发现PluginDefaultProxyActivity 这个主题需要设置成透明到,所以导致onStop没有调用
<activity
android:name="com.tencent.shadow.sample.plugin.runtime.PluginDefaultProxyActivity"
android:launchMode="standard"
android:screenOrientation="portrait"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:multiprocess="true" />
那确实是宿主中的container activity注意注册成不透明的才行。
因为我们当时只考虑了插件activity有的透明有的不透明,所以壳子注册成透明的,方便插件调整背景颜色。并没有用到onStop,所以忽略了这一点。
你的意思是PluginDefaultProxyActivity 这个的主题去除Translucent,就行了吗?
这样会引起其他问题吗?
如果PluginDefaultProxyActivity是自定义主题,例如
<style name="PluginContainerActivity" parent="@android:style/Theme.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item>
<item name="android:windowNoTitle">true</item>
</style>
也会导致Activity的onStop没有调用,这个是什么原因?怎么解决呢?