Skip to content

Commit b770a46

Browse files
committed
修复设置界面状态栏bug
1 parent 95ecdb9 commit b770a46

File tree

6 files changed

+45
-42
lines changed

6 files changed

+45
-42
lines changed
0 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
minSdkVersion 18
1010
targetSdkVersion 28
1111

12-
versionCode 32
13-
versionName "3.0.4"
12+
versionCode 33
13+
versionName "3.0.4.1"
1414
}
1515

1616
signingConfigs {
@@ -46,8 +46,8 @@ dependencies {
4646
implementation 'de.hdodenhof:circleimageview:2.2.0'
4747
implementation 'com.jakewharton:butterknife:8.8.1'
4848
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
49-
implementation 'com.android.support:cardview-v7:27.1.1'
50-
implementation 'com.android.support:design:27.1.1'
49+
implementation 'com.android.support:cardview-v7:27.0.2'
50+
implementation 'com.android.support:design:27.0.2'
5151
implementation 'net.grandcentrix.tray:tray:0.12.0'
5252
implementation 'com.jenzz:materialpreference:1.3'
5353
implementation 'com.facebook.rebound:rebound:0.3.8'

app/release/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":32,"versionName":"3.0.4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
1+
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":33,"versionName":"3.0.4.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1414
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
1515
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
16-
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
1716
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
1817
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
1918
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
2019
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
21-
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
2220
<uses-permission android:name="android.permission.FLASHLIGHT" />
2321
<uses-permission android:name="android.permission.CAMERA" />
2422
<uses-permission android:name="android.permission.WAKE_LOCK" />

app/src/main/java/com/hardwork/fg607/relaxfinger/SettingActivity.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public void developerInfo() {
430430
dialog.setTitle("关于悬浮助手");
431431
dialog.setCancelable(true);
432432
dialog.setCanceledOnTouchOutside(true);
433-
dialog.setMessage("版本:3.0.4\r\n作者:fg607\r\n邮箱:[email protected]");
433+
dialog.setMessage("版本:3.0.4.1\r\n作者:fg607\r\n邮箱:[email protected]");
434434
dialog.show();
435435
}
436436

@@ -443,8 +443,7 @@ public void questionsAnswer() {
443443
dialog.setMessage("1.不能卸载软件:在设置界面关闭“开启锁屏”选项后,即可正常卸载。\r\n" +
444444
"2.屏幕截图没反应:部分手机在第一次屏幕截图时需要稍等片刻,弹出授权框后,点击允许即可。\r\n" +
445445
"3.截图保存在哪里:截图保存在系统存储卡根目录RelaxFinger文件夹里面。\r\n" +
446-
"4.避让软键盘无效:安卓7.0以下系统避让软键盘功能最好安装两个及以上输入法(单个输入法也可以用,但需要手动点击悬浮球恢复初始位置)(包含系统自带输入法)。" +
447-
"如果仍然无效,打开输入法,把通知栏打开看一下选择输入法通知的标题,反馈给我,我加到软件里面就可以了。\r\n" +
446+
"4.避让软键盘无效:安卓7.0以下系统避让软键盘功能最好安装两个及以上输入法(包含系统自带输入法)。\r\n" +
448447
"5.不能开机自启动:首先确保设置界面“开机启动”选项已开启,如果仍然不能启动,到系统设置->" +
449448
"安全->应用程序许可中找到RelaxFinger,点击进去后打开自动运行开关即可。\r\n" +
450449
"6.自定义主题不好看:在系统存储卡根目录找到RelaxFinger目录,将里面的DIY.png换成喜欢的图片" +
@@ -464,11 +463,15 @@ public void questionsAnswer() {
464463
public void showUpdateInfo() {
465464

466465
AlertDialog dialog = new AlertDialog.Builder(this).create();
467-
dialog.setTitle("悬浮助手-3.0.4版本更新内容");
466+
dialog.setTitle("悬浮助手-3.0.4.1版本更新内容");
468467
dialog.setCancelable(true);
469468
dialog.setCanceledOnTouchOutside(true);
470469
dialog.setMessage("" +
471-
"1.完整的避让软键盘功能(自动避让,自动复原,只需一个输入法)。\r\n"+
470+
"3.0.4.1版本更新内容:\r\n"+
471+
"1.优化避让速度。\r\n"+
472+
"2.修复设置界面状态栏bug。\r\n"+
473+
"3.0.4版本更新内容:\r\n"+
474+
"1.完整的避让软键盘功能,基本适用所有安卓版本(自动避让,自动复原,只需一个输入法)。\r\n"+
472475
"2.恢复锁屏功能。\r\n"+
473476
"");
474477
dialog.show();

app/src/main/java/com/hardwork/fg607/relaxfinger/service/NavAccessibilityService.java

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public class NavAccessibilityService extends AccessibilityService {
2828

2929
public static AccessibilityService instance = null;
3030
private AppPreferences sp;
31-
private InputMethodManager mIMM;
31+
private InputMethodManager mIMM = null;
32+
private Method getIMHeightMethod = null;
3233

3334
@Override
3435
protected void onServiceConnected() {
@@ -40,6 +41,14 @@ protected void onServiceConnected() {
4041

4142
mIMM = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
4243

44+
Class<InputMethodManager> iMSClass = InputMethodManager.class;
45+
try {
46+
getIMHeightMethod= iMSClass.getMethod("getInputMethodWindowVisibleHeight");
47+
} catch (NoSuchMethodException e) {
48+
e.printStackTrace();
49+
}
50+
51+
4352

4453
/* //动态配置
4554
AccessibilityServiceInfo config = new AccessibilityServiceInfo();
@@ -70,48 +79,41 @@ public void onAccessibilityEvent(final AccessibilityEvent accessibilityEvent) {
7079
}
7180

7281

73-
//8.0以后选择输入法不在通知栏显示,此方法仅仅能识别输入法弹出事件,不能检测输入法关闭事件
74-
75-
7682
if("android.inputmethodservice.SoftInputWindow".equals(accessibilityEvent.getClassName())){
7783

7884
notifyInputWindowShow(true);
7985

86+
if(getIMHeightMethod != null && mIMM != null){
87+
88+
new Thread(() -> {
8089

81-
new Thread(new Runnable() {
82-
@Override
83-
public void run() {
90+
while (true){
8491

85-
while (true){
92+
try {
93+
Thread.sleep(255);
8694

87-
try {
88-
Thread.sleep(500);
89-
//反射判断键盘高度,为0则表明键盘关闭!
90-
Class<InputMethodManager> iMSClass = InputMethodManager.class;
91-
Method method = iMSClass.getMethod("getInputMethodWindowVisibleHeight");
95+
//反射判断键盘高度,为0则表明键盘关闭!
96+
int imeHeight = (int) getIMHeightMethod.invoke(mIMM);
97+
if(imeHeight == 0){
9298

93-
int imeHeight = (int) method.invoke(mIMM);
94-
if(imeHeight == 0){
99+
notifyInputWindowShow(false);
95100

96-
notifyInputWindowShow(false);
101+
break;
102+
}
97103

98-
break;
99-
}
104+
} catch (InterruptedException e) {
105+
e.printStackTrace();
106+
}catch (IllegalAccessException e) {
107+
e.printStackTrace();
108+
} catch (InvocationTargetException e) {
109+
e.printStackTrace();
110+
}
111+
}
100112

101-
} catch (InterruptedException e) {
102-
e.printStackTrace();
103-
} catch (NoSuchMethodException e) {
104-
e.printStackTrace();
105-
} catch (IllegalAccessException e) {
106-
e.printStackTrace();
107-
} catch (InvocationTargetException e) {
108-
e.printStackTrace();
109-
}
110-
}
111113

114+
}).start();
115+
}
112116

113-
}
114-
}).start();
115117
}
116118

117119

0 commit comments

Comments
 (0)