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
path: root/app/src
diff options
context:
space:
mode:
authorStefan Niedermann <info@niedermann.it>2021-04-20 10:55:40 +0300
committerStefan Niedermann <info@niedermann.it>2021-04-20 10:55:40 +0300
commit9a1dbaeae3d4b47b9489518dbebf14325641985e (patch)
tree9c48778d65f954d23f14c1bcd48f9dccd52efde4 /app/src
parentfa03e56883e93d3181c48c5eb9dc1d6c325469ad (diff)
#831 Fix hidden soft keyboard when creating a new note
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/edit/NoteEditFragment.java24
1 files changed, 12 insertions, 12 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 99b50663..298a6c3f 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
@@ -8,6 +8,7 @@ import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.Layout;
+import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.util.TypedValue;
@@ -15,7 +16,6 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
-import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.ScrollView;
@@ -143,17 +143,17 @@ public class NoteEditFragment extends SearchableBaseNoteFragment {
@Override
protected void onNoteLoaded(Note note) {
super.onNoteLoaded(note);
- if (note.getContent().isEmpty()) {
- binding.editContent.requestFocus();
-
- requireActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
-
- final InputMethodManager imm = (InputMethodManager) requireContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- if (imm != null) {
- imm.showSoftInput(getView(), InputMethodManager.SHOW_IMPLICIT);
- } else {
- Log.e(TAG, InputMethodManager.class.getSimpleName() + " is null.");
- }
+ if (TextUtils.isEmpty(note.getContent())) {
+ binding.editContent.post(() -> {
+ 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.");
+ }
+ });
}
binding.editContent.setMarkdownString(note.getContent());