From 8881688d5c573fb97af3f2e8c06dc82eb52315c1 Mon Sep 17 00:00:00 2001 From: Akash Yadav Date: Fri, 10 Nov 2023 14:34:07 +0530 Subject: [PATCH] fix(preferences): remove 'Hide file tree' action --- .../itsaky/androidide/preferences/editor.kt | 11 --------- .../preferences/internal/editorPreferences.kt | 23 +++---------------- resources/src/main/res/values/strings.xml | 2 -- 3 files changed, 3 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/com/itsaky/androidide/preferences/editor.kt b/app/src/main/java/com/itsaky/androidide/preferences/editor.kt index a59fbb2fce..b91f90e558 100644 --- a/app/src/main/java/com/itsaky/androidide/preferences/editor.kt +++ b/app/src/main/java/com/itsaky/androidide/preferences/editor.kt @@ -32,7 +32,6 @@ import com.itsaky.androidide.preferences.internal.DELETE_TABS_ON_BACKSPACE import com.itsaky.androidide.preferences.internal.FLAG_PASSWORD import com.itsaky.androidide.preferences.internal.FONT_LIGATURES import com.itsaky.androidide.preferences.internal.FONT_SIZE -import com.itsaky.androidide.preferences.internal.HIDE_FILE_TREE_BUTTON import com.itsaky.androidide.preferences.internal.PIN_LINE_NUMBERS import com.itsaky.androidide.preferences.internal.PRINTABLE_CHARS import com.itsaky.androidide.preferences.internal.STICKY_SCROLL_ENABLED @@ -54,7 +53,6 @@ import com.itsaky.androidide.preferences.internal.drawLineBreak import com.itsaky.androidide.preferences.internal.drawTrailingWs import com.itsaky.androidide.preferences.internal.fontLigatures import com.itsaky.androidide.preferences.internal.fontSize -import com.itsaky.androidide.preferences.internal.hideFileTreeButton import com.itsaky.androidide.preferences.internal.pinLineNumbers import com.itsaky.androidide.preferences.internal.stickyScrollEnabled import com.itsaky.androidide.preferences.internal.tabSize @@ -100,7 +98,6 @@ private class CommonConfigurations( addPreference(UseCustomFont()) addPreference(UseSoftTab()) addPreference(WordWrap()) - addPreference(HideFileTreeButton()) addPreference(UseMagnifier()) addPreference(UseICU()) addPreference(AutoSave()) @@ -272,14 +269,6 @@ private class WordWrap( override val icon: Int? = drawable.ic_wrap_text, ) : SwitchPreference(setValue = ::wordwrap::set, getValue = ::wordwrap::get) -@Parcelize -private class HideFileTreeButton( - override val key: String = HIDE_FILE_TREE_BUTTON, - override val title: Int = string.idepref_editor_hide_file_tree_button_title, - override val summary: Int? = string.idepref_editor_hide_file_tree_button_summary, - override val icon: Int? = drawable.ic_folder, -) : SwitchPreference(setValue = ::hideFileTreeButton::set, getValue = ::hideFileTreeButton::get) - @Parcelize private class UseMagnifier( override val key: String = USE_MAGNIFER, diff --git a/preferences/src/main/java/com/itsaky/androidide/preferences/internal/editorPreferences.kt b/preferences/src/main/java/com/itsaky/androidide/preferences/internal/editorPreferences.kt index 6672f0b867..8489b82ab9 100644 --- a/preferences/src/main/java/com/itsaky/androidide/preferences/internal/editorPreferences.kt +++ b/preferences/src/main/java/com/itsaky/androidide/preferences/internal/editorPreferences.kt @@ -17,9 +17,6 @@ package com.itsaky.androidide.preferences.internal -import com.itsaky.androidide.app.BaseApplication -import com.itsaky.androidide.utils.NavigationBar - const val COMPLETIONS_MATCH_LOWER = "idepref_editor_completions_matchLower" const val FLAG_WS_LEADING = "idepref_editor_wsLeading" @@ -34,7 +31,6 @@ const val AUTO_SAVE = "idepref_editor_autoSave" const val FONT_LIGATURES = "idepref_editor_fontLigatures" const val FLAG_PASSWORD = "idepref_editor_flagPassword" const val WORD_WRAP = "idepref_editor_word_wrap" -const val HIDE_FILE_TREE_BUTTON = "idepref_hide_file_tree_button" const val USE_MAGNIFER = "idepref_editor_use_magnifier" const val USE_ICU = "idepref_editor_useIcu" const val USE_SOFT_TAB = "idepref_editor_useSoftTab" @@ -119,19 +115,6 @@ var wordwrap: Boolean prefManager.putBoolean(WORD_WRAP, value) } -/** By default the File Tree button is hidden into the overflow menu on devices where - * Gesture Navigation is enabled at the moment of accessing the preference. - */ -var hideFileTreeButton: Boolean - get() { - val navigationMode = NavigationBar.getInteractionMode(BaseApplication.getBaseInstance()) - val gestureNavigationDisabled = navigationMode != NavigationBar.MODE_GESTURES - return prefManager.getBoolean(HIDE_FILE_TREE_BUTTON, gestureNavigationDisabled) - } - set(value) { - prefManager.putBoolean(HIDE_FILE_TREE_BUTTON, value) - } - var useMagnifier: Boolean get() = prefManager.getBoolean(USE_MAGNIFER, true) set(value) { @@ -162,19 +145,19 @@ var colorScheme: String prefManager.putString(COLOR_SCHEME, value) } -var deleteEmptyLines : Boolean +var deleteEmptyLines: Boolean get() = prefManager.getBoolean(DELETE_EMPTY_LINES, true) set(value) { prefManager.putBoolean(DELETE_EMPTY_LINES, value) } -var deleteTabsOnBackspace : Boolean +var deleteTabsOnBackspace: Boolean get() = prefManager.getBoolean(DELETE_TABS_ON_BACKSPACE, true) set(value) { prefManager.putBoolean(DELETE_TABS_ON_BACKSPACE, value) } -var stickyScrollEnabled : Boolean +var stickyScrollEnabled: Boolean get() = prefManager.getBoolean(STICKY_SCROLL_ENABLED, false) set(value) { prefManager.putBoolean(STICKY_SCROLL_ENABLED, value) diff --git a/resources/src/main/res/values/strings.xml b/resources/src/main/res/values/strings.xml index c6d800f722..b83c254881 100644 --- a/resources/src/main/res/values/strings.xml +++ b/resources/src/main/res/values/strings.xml @@ -209,8 +209,6 @@ Should the editor draw hex color string? Word Wrap Use wordwrap of the editor - Hide the File Tree button - Move the "File Tree" button into the overflow menu of the editor\'s toolbar. Enable Magnifier Magnify text at cursor position while selecting text in editor Editor