Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit a0d26fc

Browse files
lucky-chenYorkShen
authored andcommitted
[Android] fix whiteScreen check for 1pixel height/width (#2595)
1 parent 7a20e9b commit a0d26fc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

android/sdk/src/main/java/com/taobao/weex/performance/WhiteScreenUtils.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,26 @@ public static boolean isWhiteScreen(WXSDKInstance instance) {
6262
if (group.getChildCount() == 0) {
6363
return true;
6464
}
65-
return !hasLeafView(group);
65+
return !hasLeafViewOrSizeIgnore(group,3);
6666
}
6767

68-
private static boolean hasLeafView(View v) {
68+
private static boolean hasLeafViewOrSizeIgnore(View v,int checkDeep) {
69+
6970
if (!(v instanceof ViewGroup)) {
7071
return true;
7172
}
7273

74+
if (checkDeep > 0){
75+
if ( v.getHeight() < 10 || v.getWidth() < 10) {
76+
return true;
77+
}
78+
checkDeep--;
79+
}
80+
7381
ViewGroup group = (ViewGroup)v;
7482
for (int i = 0; i < group.getChildCount(); i++) {
7583
View child = group.getChildAt(i);
76-
boolean res = hasLeafView(child);
84+
boolean res = hasLeafViewOrSizeIgnore(child,checkDeep);
7785
if (res) {
7886
return true;
7987
}

0 commit comments

Comments
 (0)