Skip to content

Commit

Permalink
修复设置界面状态栏bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fg607 committed Sep 7, 2018
1 parent 95ecdb9 commit b770a46
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 42 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
minSdkVersion 18
targetSdkVersion 28

versionCode 32
versionName "3.0.4"
versionCode 33
versionName "3.0.4.1"
}

signingConfigs {
Expand Down Expand Up @@ -46,8 +46,8 @@ dependencies {
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'net.grandcentrix.tray:tray:0.12.0'
implementation 'com.jenzz:materialpreference:1.3'
implementation 'com.facebook.rebound:rebound:0.3.8'
Expand Down
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -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":{}}]
[{"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":{}}]
2 changes: 0 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public void developerInfo() {
dialog.setTitle("关于悬浮助手");
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
dialog.setMessage("版本:3.0.4\r\n作者:fg607\r\n邮箱:fg607@sina.com");
dialog.setMessage("版本:3.0.4.1\r\n作者:fg607\r\n邮箱:fg607@sina.com");
dialog.show();
}

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

AlertDialog dialog = new AlertDialog.Builder(this).create();
dialog.setTitle("悬浮助手-3.0.4版本更新内容");
dialog.setTitle("悬浮助手-3.0.4.1版本更新内容");
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
dialog.setMessage("" +
"1.完整的避让软键盘功能(自动避让,自动复原,只需一个输入法)。\r\n"+
"3.0.4.1版本更新内容:\r\n"+
"1.优化避让速度。\r\n"+
"2.修复设置界面状态栏bug。\r\n"+
"3.0.4版本更新内容:\r\n"+
"1.完整的避让软键盘功能,基本适用所有安卓版本(自动避让,自动复原,只需一个输入法)。\r\n"+
"2.恢复锁屏功能。\r\n"+
"");
dialog.show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class NavAccessibilityService extends AccessibilityService {

public static AccessibilityService instance = null;
private AppPreferences sp;
private InputMethodManager mIMM;
private InputMethodManager mIMM = null;
private Method getIMHeightMethod = null;

@Override
protected void onServiceConnected() {
Expand All @@ -40,6 +41,14 @@ protected void onServiceConnected() {

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

Class<InputMethodManager> iMSClass = InputMethodManager.class;
try {
getIMHeightMethod= iMSClass.getMethod("getInputMethodWindowVisibleHeight");
} catch (NoSuchMethodException e) {
e.printStackTrace();
}



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


//8.0以后选择输入法不在通知栏显示,此方法仅仅能识别输入法弹出事件,不能检测输入法关闭事件


if("android.inputmethodservice.SoftInputWindow".equals(accessibilityEvent.getClassName())){

notifyInputWindowShow(true);

if(getIMHeightMethod != null && mIMM != null){

new Thread(() -> {

new Thread(new Runnable() {
@Override
public void run() {
while (true){

while (true){
try {
Thread.sleep(255);

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

int imeHeight = (int) method.invoke(mIMM);
if(imeHeight == 0){
notifyInputWindowShow(false);

notifyInputWindowShow(false);
break;
}

break;
}
} catch (InterruptedException e) {
e.printStackTrace();
}catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}

} catch (InterruptedException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}

}).start();
}

}
}).start();
}


Expand Down

0 comments on commit b770a46

Please sign in to comment.