Shadow icon indicating copy to clipboard operation
Shadow copied to clipboard

shadow插件里PluginDefaultProxyActivity 主题是透明的,导致onStop没有调用

Open yqshi opened this issue 1 year ago • 3 comments

我们在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" />

yqshi avatar Aug 26 '24 11:08 yqshi

那确实是宿主中的container activity注意注册成不透明的才行。

因为我们当时只考虑了插件activity有的透明有的不透明,所以壳子注册成透明的,方便插件调整背景颜色。并没有用到onStop,所以忽略了这一点。

shifujun avatar Aug 26 '24 11:08 shifujun

你的意思是PluginDefaultProxyActivity 这个的主题去除Translucent,就行了吗?

这样会引起其他问题吗?

yqshi avatar Aug 26 '24 12:08 yqshi

如果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没有调用,这个是什么原因?怎么解决呢?

arlong avatar Aug 06 '25 09:08 arlong