Loading app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NoteEditFragment.java +10 −6 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ import static it.niedermann.owncloud.notes.util.NoteUtil.getFontSizeFromPreferen public class NoteEditFragment extends SearchableBaseNoteFragment { private static final String TAG = NoteEditFragment.class.getSimpleName(); private static final String LOG_TAG_AUTOSAVE = "AutoSave"; private static final long DELAY = 2000; // Wait for this time after typing before saving Loading Loading @@ -148,10 +150,12 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { requireActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); InputMethodManager imm = (InputMethodManager) requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE); 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."); } } // workaround for issue yydcdut/RxMarkdown#41 Loading @@ -160,7 +164,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { binding.editContent.setText(note.getContent()); binding.editContent.setEnabled(true); MarkdownProcessor markdownProcessor = new MarkdownProcessor(requireContext()); final MarkdownProcessor markdownProcessor = new MarkdownProcessor(requireContext()); markdownProcessor.config(MarkDownUtil.getMarkDownConfiguration(binding.editContent.getContext()).build()); markdownProcessor.factory(EditFactory.create()); markdownProcessor.live(binding.editContent); Loading @@ -169,7 +173,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { binding.editContent.setCustomInsertionActionModeCallback(new ContextBasedFormattingCallback(binding.editContent)); } SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(requireContext().getApplicationContext()); final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(requireContext().getApplicationContext()); binding.editContent.setTextSize(TypedValue.COMPLEX_UNIT_PX, getFontSizeFromPreferences(requireContext(), sp)); if (sp.getBoolean(getString(R.string.pref_key_font), false)) { binding.editContent.setTypeface(Typeface.MONOSPACE); Loading app/src/main/res/layout/fragment_note_edit.xml +9 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,15 @@ android:layout_height="match_parent" tools:background="?attr/colorPrimary"> <!-- Dummy item to prevent editContent from receiving focus --> <LinearLayout android:id="@+id/focus_workaround" android:layout_width="0dp" android:layout_height="0dp" android:focusable="true" android:focusableInTouchMode="true" android:orientation="horizontal" /> <ScrollView android:id="@+id/scrollView" android:layout_width="match_parent" Loading Loading
app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NoteEditFragment.java +10 −6 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ import static it.niedermann.owncloud.notes.util.NoteUtil.getFontSizeFromPreferen public class NoteEditFragment extends SearchableBaseNoteFragment { private static final String TAG = NoteEditFragment.class.getSimpleName(); private static final String LOG_TAG_AUTOSAVE = "AutoSave"; private static final long DELAY = 2000; // Wait for this time after typing before saving Loading Loading @@ -148,10 +150,12 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { requireActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); InputMethodManager imm = (InputMethodManager) requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE); 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."); } } // workaround for issue yydcdut/RxMarkdown#41 Loading @@ -160,7 +164,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { binding.editContent.setText(note.getContent()); binding.editContent.setEnabled(true); MarkdownProcessor markdownProcessor = new MarkdownProcessor(requireContext()); final MarkdownProcessor markdownProcessor = new MarkdownProcessor(requireContext()); markdownProcessor.config(MarkDownUtil.getMarkDownConfiguration(binding.editContent.getContext()).build()); markdownProcessor.factory(EditFactory.create()); markdownProcessor.live(binding.editContent); Loading @@ -169,7 +173,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { binding.editContent.setCustomInsertionActionModeCallback(new ContextBasedFormattingCallback(binding.editContent)); } SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(requireContext().getApplicationContext()); final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(requireContext().getApplicationContext()); binding.editContent.setTextSize(TypedValue.COMPLEX_UNIT_PX, getFontSizeFromPreferences(requireContext(), sp)); if (sp.getBoolean(getString(R.string.pref_key_font), false)) { binding.editContent.setTypeface(Typeface.MONOSPACE); Loading
app/src/main/res/layout/fragment_note_edit.xml +9 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,15 @@ android:layout_height="match_parent" tools:background="?attr/colorPrimary"> <!-- Dummy item to prevent editContent from receiving focus --> <LinearLayout android:id="@+id/focus_workaround" android:layout_width="0dp" android:layout_height="0dp" android:focusable="true" android:focusableInTouchMode="true" android:orientation="horizontal" /> <ScrollView android:id="@+id/scrollView" android:layout_width="match_parent" Loading