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 e0fc214bb..9ba17f95a 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 @@ -109,11 +109,6 @@ protected FloatingActionButton getSearchPrevButton() { return binding.directEditing; } - protected ExtendedFloatingActionButton getNormalEditButton() { - // the edit fragment does not have a button - return null; - } - @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { diff --git a/app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java index 72766a556..37048d6ac 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java @@ -52,10 +52,6 @@ public class NotePreviewFragment extends SearchableBaseNoteFragment implements O public void onPrepareOptionsMenu(@NonNull Menu menu) { super.onPrepareOptionsMenu(menu); menu.findItem(R.id.menu_edit).setVisible(true); - if(getNormalEditButton().getVisibility() == View.VISIBLE) { - menu.findItem(R.id.menu_edit).setVisible(false); - } - menu.findItem(R.id.menu_preview).setVisible(false); } @@ -90,11 +86,6 @@ protected FloatingActionButton getSearchPrevButton() { return binding.directEditing; } - @Override - protected ExtendedFloatingActionButton getNormalEditButton() { - return binding.edit; - } - @Override protected Layout getLayout() { binding.singleNoteContent.onPreDraw(); diff --git a/app/src/main/java/it/niedermann/owncloud/notes/edit/SearchableBaseNoteFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/edit/SearchableBaseNoteFragment.java index bfc8cdb2c..f1e86980a 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/edit/SearchableBaseNoteFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/edit/SearchableBaseNoteFragment.java @@ -15,7 +15,6 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; import androidx.core.content.ContextCompat; -import androidx.preference.PreferenceManager; import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton; @@ -42,7 +41,7 @@ public abstract class SearchableBaseNoteFragment extends BaseNoteFragment { private SearchView searchView; private String searchQuery = null; private static final int delay = 50; // If the search string does not change after $delay ms, then the search task starts. - private boolean directEditRemotelyAvailable = false; // avoid using this directly, instead use: isDirectEditEnabled() + private boolean directEditAvailable = false; @ColorInt private int color; @@ -67,7 +66,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) { @Override protected void onScroll(int scrollY, int oldScrollY) { super.onScroll(scrollY, oldScrollY); - if (isDirectEditEnabled()) { + if (directEditAvailable) { // only show FAB if search is not active if (getSearchNextButton() == null || getSearchNextButton().getVisibility() != View.VISIBLE) { final ExtendedFloatingActionButton directFab = getDirectEditingButton(); @@ -80,7 +79,7 @@ protected void onScroll(int scrollY, int oldScrollY) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); checkDirectEditingAvailable(); - if (isDirectEditEnabled()) { + if (directEditAvailable) { final ExtendedFloatingActionButton directEditingButton = getDirectEditingButton(); directEditingButton.setExtended(false); ExtendedFabUtil.toggleExtendedOnLongClick(directEditingButton); @@ -91,15 +90,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat }); } else { getDirectEditingButton().setVisibility(View.GONE); - ExtendedFloatingActionButton edit = getNormalEditButton(); - if(edit!=null) { - edit.setVisibility(View.VISIBLE); - edit.setOnClickListener(v -> { - if (listener != null) { - listener.changeMode(NoteFragmentListener.Mode.EDIT, true); - } - }); - } } } @@ -107,19 +97,11 @@ private void checkDirectEditingAvailable() { try { final SingleSignOnAccount ssoAccount = SingleAccountHelper.getCurrentSingleSignOnAccount(requireContext()); final Account localAccount = repo.getAccountByName(ssoAccount.name); - directEditRemotelyAvailable = localAccount != null && localAccount.isDirectEditingAvailable(); + directEditAvailable = localAccount != null && localAccount.isDirectEditingAvailable(); } catch (NextcloudFilesAppAccountNotFoundException | NoCurrentAccountSelectedException e) { Log.w(TAG, "checkDirectEditingAvailable: ", e); - directEditRemotelyAvailable = false; - } - } - - protected boolean isDirectEditEnabled() { - if (!directEditRemotelyAvailable) { - return false; + directEditAvailable = false; } - final var sp = PreferenceManager.getDefaultSharedPreferences(requireContext().getApplicationContext()); - return sp.getBoolean(getString(R.string.pref_key_enable_direct_edit), true); } @Override @@ -270,7 +252,6 @@ public void onSaveInstanceState(@NonNull Bundle outState) { @NonNull protected abstract ExtendedFloatingActionButton getDirectEditingButton(); - protected abstract ExtendedFloatingActionButton getNormalEditButton(); private void showSearchFabs() { ExtendedFabUtil.setExtendedFabVisibility(getDirectEditingButton(), false); @@ -366,9 +347,5 @@ public void applyBrand(int color) { util.material.themeFAB(getSearchNextButton()); util.material.themeFAB(getSearchPrevButton()); util.material.themeExtendedFAB(getDirectEditingButton()); - var editFab = getNormalEditButton(); - if(editFab != null) { - util.material.themeExtendedFAB(editFab); - } } } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/preferences/PreferencesFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/preferences/PreferencesFragment.java index 55f1f37de..c3d532cbe 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/preferences/PreferencesFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/preferences/PreferencesFragment.java @@ -34,7 +34,6 @@ public class PreferencesFragment extends PreferenceFragmentCompat implements Bra private BrandedSwitchPreference preventScreenCapturePref; private BrandedSwitchPreference backgroundSyncPref; private BrandedSwitchPreference keepScreenOnPref; - private BrandedSwitchPreference enableDirectEditorPref; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { @@ -109,8 +108,6 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { SyncWorker.update(requireContext(), (Boolean) newValue); return true; }); - - enableDirectEditorPref = findPreference(getString(R.string.pref_key_enable_direct_edit)); } @@ -138,6 +135,5 @@ public void applyBrand(int color) { preventScreenCapturePref.applyBrand(color); backgroundSyncPref.applyBrand(color); keepScreenOnPref.applyBrand(color); - enableDirectEditorPref.applyBrand(color); } } diff --git a/app/src/main/res/drawable/ic_rich_editing_grey600_24dp.xml b/app/src/main/res/drawable/ic_rich_editing_grey600_24dp.xml deleted file mode 100644 index 0121669af..000000000 --- a/app/src/main/res/drawable/ic_rich_editing_grey600_24dp.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/fragment_note_preview.xml b/app/src/main/res/layout/fragment_note_preview.xml index 74cbb2ecb..c4215c2df 100644 --- a/app/src/main/res/layout/fragment_note_preview.xml +++ b/app/src/main/res/layout/fragment_note_preview.xml @@ -75,19 +75,4 @@ app:layout_anchor="@id/scrollView" app:layout_anchorGravity="bottom|end" app:icon="@drawable/ic_rich_editing" /> - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b94ece4d8..c45fa5ba5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -51,8 +51,6 @@ Background synchronization Prevent screen capture Grid view - Direct Edit - When disabled, the advanced editor will be hidden. Keep screen on When viewing or editing a note @@ -124,7 +122,6 @@ security lastNoteMode backgroundSync - directEditPreference edit directEdit preview diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 471c073e0..e9a13a5d1 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -45,15 +45,6 @@ android:summary="%s" android:title="@string/settings_note_mode_new" /> - - -