reformat code

This commit is contained in:
drhaal 2021-06-08 21:58:08 +02:00
parent 2405959324
commit 988ce872cc
2 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -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);