Skip to content

Commit 30eebad

Browse files
author
Blankj
committed
see 02/20 log
1 parent 6117368 commit 30eebad

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

utilcode/lib/src/main/java/com/blankj/utilcode/util/KeyboardUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ public static void fixSoftInputLeaks(final Activity activity) {
267267
(InputMethodManager) Utils.getApp().getSystemService(Context.INPUT_METHOD_SERVICE);
268268
if (imm == null) return;
269269
String[] leakViews = new String[]{"mLastSrvView", "mCurRootView", "mServedView", "mNextServedView"};
270-
try {
271-
for (String leakView : leakViews) {
270+
for (String leakView : leakViews) {
271+
try {
272272
Field leakViewField = InputMethodManager.class.getDeclaredField(leakView);
273273
if (leakViewField == null) continue;
274274
if (!leakViewField.isAccessible()) {
@@ -280,8 +280,8 @@ public static void fixSoftInputLeaks(final Activity activity) {
280280
if (view.getRootView() == activity.getWindow().getDecorView().getRootView()) {
281281
leakViewField.set(imm, null);
282282
}
283-
}
284-
} catch (Throwable ignore) { /**/ }
283+
} catch (Throwable ignore) { /**/ }
284+
}
285285
}
286286

287287
/**

utilcode/lib/src/main/java/com/blankj/utilcode/util/Utils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ private static void fixSoftInputLeaks(final Activity activity) {
340340
(InputMethodManager) Utils.getApp().getSystemService(Context.INPUT_METHOD_SERVICE);
341341
if (imm == null) return;
342342
String[] leakViews = new String[]{"mLastSrvView", "mCurRootView", "mServedView", "mNextServedView"};
343-
try {
344-
for (String leakView : leakViews) {
343+
for (String leakView : leakViews) {
344+
try {
345345
Field leakViewField = InputMethodManager.class.getDeclaredField(leakView);
346346
if (leakViewField == null) continue;
347347
if (!leakViewField.isAccessible()) {
@@ -353,8 +353,8 @@ private static void fixSoftInputLeaks(final Activity activity) {
353353
if (view.getRootView() == activity.getWindow().getDecorView().getRootView()) {
354354
leakViewField.set(imm, null);
355355
}
356-
}
357-
} catch (Throwable ignore) { /**/ }
356+
} catch (Throwable ignore) { /**/ }
357+
}
358358
}
359359
}
360360

0 commit comments

Comments
 (0)