Skip to content

Commit

Permalink
Tweaks to address some edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 committed Oct 31, 2023
1 parent cbd54be commit 36dcce4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public void insertOrReplaceTextOnCursor(final String newText) {

if (newCursorPos >= 0) {
setSelection(sel[0] + newCursorPos);
TextViewUtils.showSelection(this);
postDelayed(() -> TextViewUtils.showSelection(this), 500);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,10 @@ public static boolean isViewVisible(final View view) {
// Check if keyboard open. Only available after android 11 :(
public static Boolean isImeOpen(final View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return view.getRootWindowInsets().isVisible(WindowInsets.Type.ime());
final WindowInsets insets = view.getRootWindowInsets();
if (insets != null) {
insets.isVisible(WindowInsets.Type.ime());
}
}
return null; // Uncertain
}
Expand Down

0 comments on commit 36dcce4

Please sign in to comment.