Skip to content

Commit

Permalink
fix:(utils) 删除工具库中对然键盘操作,在30版本中有兼容问题,导致状态栏改版失效
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOnlyone committed Dec 31, 2021
1 parent c10b568 commit e3ca344
Showing 1 changed file with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,30 +314,31 @@ public void onActivityPostDestroyed(@NonNull Activity activity) {/**/}
* the keyboard from closing when curActivity onDestroy.
*/
private void processHideSoftInputOnActivityDestroy(final Activity activity, boolean isSave) {
try {
if (isSave) {
Window window = activity.getWindow();
final WindowManager.LayoutParams attrs = window.getAttributes();
final int softInputMode = attrs.softInputMode;
window.getDecorView().setTag(-123, softInputMode);
} else {
final Object tag = activity.getWindow().getDecorView().getTag(-123);
if (!(tag instanceof Integer)) return;
UtilsBridge.runOnUiThreadDelayed(new Runnable() {
@Override
public void run() {
try {
Window window = activity.getWindow();
if (window != null) {
window.setSoftInputMode(((Integer) tag));
}
} catch (Exception ignore) {
}
}
}, 100);
}
} catch (Exception ignore) {
}
// try {
// if (isSave) {
// Window window = activity.getWindow();
// final WindowManager.LayoutParams attrs = window.getAttributes();
// final int softInputMode = attrs.softInputMode;
// window.getDecorView().setTag(-123, softInputMode);
// window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
// } else {
// final Object tag = activity.getWindow().getDecorView().getTag(-123);
// if (!(tag instanceof Integer)) return;
// UtilsBridge.runOnUiThreadDelayed(new Runnable() {
// @Override
// public void run() {
// try {
// Window window = activity.getWindow();
// if (window != null) {
// window.setSoftInputMode(((Integer) tag));
// }
// } catch (Exception ignore) {
// }
// }
// }, 100);
// }
// } catch (Exception ignore) {
// }
}

private void postStatus(final Activity activity, final boolean isForeground) {
Expand Down

0 comments on commit e3ca344

Please sign in to comment.