Skip to content

Commit 5a81f04

Browse files
committed
fix float checkPermission
1 parent 8d3bda0 commit 5a81f04

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

app/src/main/java/com/github/uiautomator/ToastActivity.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
2929
String showFloat = intent.getStringExtra("showFloatWindow");
3030
Log.i(TAG, "showFloat: " + showFloat);
3131

32-
boolean floatEnabled = FloatWindowManager.getInstance().checkFloatPermission(ToastActivity.this);
32+
boolean floatEnabled = FloatWindowManager.getInstance().checkPermission(ToastActivity.this);
3333
if (!floatEnabled) {
3434
Log.w(TAG, "floatPermission is not enabled");
35-
return;
35+
} else {
36+
if ("true".equals(showFloat)) {
37+
getFloatView().show();
38+
} else if ("false".equals(showFloat)) {
39+
getFloatView().hide();
40+
}
3641
}
37-
if ("true".equals(showFloat)) {
38-
getFloatView().show();
39-
} else if ("false".equals(showFloat)) {
40-
getFloatView().hide();
41-
}
42-
4342
moveTaskToBack(true);
4443
}
4544

permission/src/main/java/com/android/permission/FloatWindowManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public boolean checkFloatPermission(Context context) {
6262
}
6363
}
6464

65-
private boolean checkPermission(Context context) {
65+
public boolean checkPermission(Context context) {
6666
//6.0 版本之后由于 google 增加了对悬浮窗权限的管理,所以方式就统一了
6767
if (Build.VERSION.SDK_INT < 23) {
6868
if (RomUtils.checkIsMiuiRom()) {

0 commit comments

Comments
 (0)