diff --git a/app/src/main/java/it/niedermann/owncloud/notes/edit/NoteEditFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/edit/NoteEditFragment.java index 630d878a..6ba09432 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/edit/NoteEditFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/edit/NoteEditFragment.java @@ -141,7 +141,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { super.onResume(); binding.editContent.addTextChangedListener(textWatcher); - if(keyboardShown){ + if (keyboardShown) { openSoftKeyboard(); } } @@ -163,7 +163,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { } } - private void openSoftKeyboard(){ + private void openSoftKeyboard() { binding.editContent.postDelayed(() -> { binding.editContent.requestFocus(); @@ -174,7 +174,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { Log.e(TAG, InputMethodManager.class.getSimpleName() + " is null."); } //Without a small delay the keyboard does not show reliably - },100); + }, 100); } @Override diff --git a/app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java b/app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java index 80ac7de4..297c843c 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java @@ -58,11 +58,12 @@ public class DisplayUtils { } /** - * Android does not provide a way to get keyboard visibility prior to API 30 so we use a workaround + * Android does not provide a way to get keyboard visibility prior to API 30 so we use a workaround + * * @param parentView View * @return keyboardVisibility Boolean */ - public static boolean isSoftKeyboardVisible(View parentView){ + public static boolean isSoftKeyboardVisible(View parentView) { //Arbitrary keyboard height final int defaultKeyboardHeightDP = 100; final int EstimatedKeyboardDP = defaultKeyboardHeightDP + (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 48 : 0);