[Fix]修复弹窗
java.lang.IllegalArgumentException: View=com.mogo.eagle.core.function.hmi.notification.widget.ParentFrameLayout{5d9c8ea V.E...... ......I. 0,0-551,186} not attached to window manager
Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -139,7 +139,7 @@ internal class WarningFloatWindowHelper(
|
||||
config.statusListenerMapIMoGo.forEach { listener ->
|
||||
listener.onShow()
|
||||
}
|
||||
if (frameLayout == null || config.isAnim) return
|
||||
if (frameLayout == null|| frameLayout?.isAttachedToWindow == false || config.isAnim) return
|
||||
enterAnimator = AnimatorManager(frameLayout!!, params, windowManager, config)
|
||||
.enterAnim()?.apply {
|
||||
// 可以延伸到屏幕外,动画结束按需去除该属性,不然旋转屏幕可能置于屏幕外部
|
||||
@@ -180,7 +180,7 @@ internal class WarningFloatWindowHelper(
|
||||
config.statusListenerMapIMoGo.forEach { listener ->
|
||||
listener.onDismiss()
|
||||
}
|
||||
if (frameLayout == null || (config.isAnim && enterAnimator == null)) return
|
||||
if (frameLayout == null|| frameLayout?.isAttachedToWindow == false || (config.isAnim && enterAnimator == null)) return
|
||||
enterAnimator?.cancel()
|
||||
val animator: Animator? =
|
||||
AnimatorManager(frameLayout!!, params, windowManager, config).exitAnim()
|
||||
@@ -223,7 +223,7 @@ internal class WarningFloatWindowHelper(
|
||||
*/
|
||||
@SuppressLint("RtlHardcoded")
|
||||
private fun setGravity(view: View?) {
|
||||
if (config.locationPair != Pair(0, 0) || view == null) return
|
||||
if (config.locationPair != Pair(0, 0) || view == null || !view.isAttachedToWindow) return
|
||||
val parentRect = Rect()
|
||||
// 获取浮窗所在的矩形
|
||||
windowManager.defaultDisplay.getRectSize(parentRect)
|
||||
|
||||
Reference in New Issue
Block a user