Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrhaal <drhaal@protonmail.com>2021-06-08 22:36:47 +0300
committerdrhaal <drhaal@protonmail.com>2021-06-08 22:36:47 +0300
commit47d5d577fd4a0d2533a8402ca01fffe93c60fd51 (patch)
tree4428397d43d481f4dccdcd850cad857667449bce /app/src/main/java/it/niedermann/owncloud
parent21164560671222934d7517a8a92d3bda0e3330b3 (diff)
refactoring
Diffstat (limited to 'app/src/main/java/it/niedermann/owncloud')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/edit/NoteEditFragment.java36
1 files changed, 16 insertions, 20 deletions
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 79ac851a..56800527 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
@@ -144,16 +144,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment {
binding.editContent.addTextChangedListener(textWatcher);
if(keyboardShown){
- binding.editContent.postDelayed(() -> {
- binding.editContent.requestFocus();
-
- final InputMethodManager imm = (InputMethodManager) requireContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- if (imm != null) {
- imm.showSoftInput(binding.editContent, InputMethodManager.SHOW_IMPLICIT);
- } else {
- Log.e(TAG, InputMethodManager.class.getSimpleName() + " is null.");
- }
- },100);
+ openSoftKeyboard();
}
}
@@ -161,16 +152,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment {
protected void onNoteLoaded(Note note) {
super.onNoteLoaded(note);
if (TextUtils.isEmpty(note.getContent())) {
- binding.editContent.postDelayed(() -> {
- binding.editContent.requestFocus();
-
- final InputMethodManager imm = (InputMethodManager) requireContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- if (imm != null) {
- imm.showSoftInput(binding.editContent, InputMethodManager.SHOW_IMPLICIT);
- } else {
- Log.e(TAG, InputMethodManager.class.getSimpleName() + " is null.");
- }
- },100);
+ openSoftKeyboard();
}
binding.editContent.setMarkdownString(note.getContent());
@@ -183,6 +165,20 @@ public class NoteEditFragment extends SearchableBaseNoteFragment {
}
}
+ private void openSoftKeyboard(){
+ binding.editContent.postDelayed(() -> {
+ binding.editContent.requestFocus();
+
+ final InputMethodManager imm = (InputMethodManager) requireContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+ if (imm != null) {
+ imm.showSoftInput(binding.editContent, InputMethodManager.SHOW_IMPLICIT);
+ } else {
+ Log.e(TAG, InputMethodManager.class.getSimpleName() + " is null.");
+ }
+ //Without a small delay the keyboard does not show reliably
+ },100);
+ }
+
@Override
public void onPause() {
super.onPause();