[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:
16
TestHmiWarning.sh
Executable file
16
TestHmiWarning.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
for index in `seq 300`;
|
||||||
|
do
|
||||||
|
b=$(( $index % 2 ))
|
||||||
|
if [ $b = 0 ]
|
||||||
|
then
|
||||||
|
echo "200011"
|
||||||
|
adb shell am broadcast -a com.hmi.v2x.notification --ez v2xIsShow true --es tag "200011" --ei v2xType 20011 --es alertContent "测试外部传入数据1" --es ttsContent "测试TTS1"
|
||||||
|
else
|
||||||
|
echo "200012"
|
||||||
|
adb shell am broadcast -a com.hmi.v2x.notification --ez v2xIsShow true --es tag "200012" --ei v2xType 20012 --es alertContent "测试外部传入数据2" --es ttsContent "测试TTS2"
|
||||||
|
fi
|
||||||
|
sleep 0.5
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "\033[32m 恭喜你完成了所有 测试脚本 \033[0m"
|
||||||
@@ -90,7 +90,7 @@ internal class WarningFloatWindowHelper(
|
|||||||
val floatingView = config.layoutView?.also {
|
val floatingView = config.layoutView?.also {
|
||||||
try {
|
try {
|
||||||
val parent = (it.parent as ViewGroup)
|
val parent = (it.parent as ViewGroup)
|
||||||
parent.removeView(it)
|
parent.removeAllViews()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
@@ -220,12 +220,12 @@ internal class WarningFloatWindowHelper(
|
|||||||
* 退出动画执行结束/没有退出动画,进行回调、移除等操作
|
* 退出动画执行结束/没有退出动画,进行回调、移除等操作
|
||||||
*/
|
*/
|
||||||
fun remove(force: Boolean = false) = try {
|
fun remove(force: Boolean = false) = try {
|
||||||
|
frameLayout?.removeAllViews()
|
||||||
frameLayout?.removeCallbacks(closeWarningTask)
|
frameLayout?.removeCallbacks(closeWarningTask)
|
||||||
config.isAnim = false
|
config.isAnim = false
|
||||||
WarningFloatWindowManager.remove(config.floatTag)
|
WarningFloatWindowManager.remove(config.floatTag)
|
||||||
// removeView是异步删除,在Activity销毁的时候会导致窗口泄漏,所以使用removeViewImmediate直接删除view
|
// removeView是异步删除,在Activity销毁的时候会导致窗口泄漏,所以使用removeViewImmediate直接删除view
|
||||||
windowManager.run {
|
windowManager.run {
|
||||||
frameLayout?.removeAllViews()
|
|
||||||
if (force) {
|
if (force) {
|
||||||
removeViewImmediate(frameLayout)
|
removeViewImmediate(frameLayout)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user