[Change]
修复弹窗提示bug The specified child already has a parent. You must call removeView() on the child's parent first. Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -90,7 +90,7 @@ internal class WarningFloatWindowHelper(
|
||||
val floatingView = config.layoutView?.also {
|
||||
try {
|
||||
val parent = (it.parent as ViewGroup)
|
||||
parent.removeView(it)
|
||||
parent.removeAllViews()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
@@ -220,12 +220,12 @@ internal class WarningFloatWindowHelper(
|
||||
* 退出动画执行结束/没有退出动画,进行回调、移除等操作
|
||||
*/
|
||||
fun remove(force: Boolean = false) = try {
|
||||
frameLayout?.removeAllViews()
|
||||
frameLayout?.removeCallbacks(closeWarningTask)
|
||||
config.isAnim = false
|
||||
WarningFloatWindowManager.remove(config.floatTag)
|
||||
// removeView是异步删除,在Activity销毁的时候会导致窗口泄漏,所以使用removeViewImmediate直接删除view
|
||||
windowManager.run {
|
||||
frameLayout?.removeAllViews()
|
||||
if (force) {
|
||||
removeViewImmediate(frameLayout)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user