File tree Expand file tree Collapse file tree
app/src/main/java/com/github/uiautomator
permission/src/main/java/com/android/permission Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ()) {
You can’t perform that action at this time.
0 commit comments