Skip to content

Commit

Permalink
fix float checkPermission
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed May 4, 2024
1 parent 8d3bda0 commit 5a81f04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions app/src/main/java/com/github/uiautomator/ToastActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
String showFloat = intent.getStringExtra("showFloatWindow");
Log.i(TAG, "showFloat: " + showFloat);

boolean floatEnabled = FloatWindowManager.getInstance().checkFloatPermission(ToastActivity.this);
boolean floatEnabled = FloatWindowManager.getInstance().checkPermission(ToastActivity.this);
if (!floatEnabled) {
Log.w(TAG, "floatPermission is not enabled");
return;
} else {
if ("true".equals(showFloat)) {
getFloatView().show();
} else if ("false".equals(showFloat)) {
getFloatView().hide();
}
}
if ("true".equals(showFloat)) {
getFloatView().show();
} else if ("false".equals(showFloat)) {
getFloatView().hide();
}

moveTaskToBack(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public boolean checkFloatPermission(Context context) {
}
}

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

0 comments on commit 5a81f04

Please sign in to comment.