Skip to content

Commit 948b514

Browse files
authored
Merge pull request #224 from mvanhorn/feat/218-toolbar-longpress-hint-toggle
feat: add toggle to disable long-press hint dots on toolbar keys
2 parents 8ff93c9 + c5787c3 commit 948b514

5 files changed

Lines changed: 17 additions & 1 deletion

File tree

app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ object Defaults {
184184
const val PREF_TOOLBAR_MODE = "EXPANDABLE"
185185
const val PREF_TOOLBAR_HIDING_GLOBAL = true
186186
const val PREF_QUICK_PIN_TOOLBAR_KEYS = true
187+
const val PREF_TOOLBAR_LONG_PRESS_HINT = true
187188
val PREF_PINNED_TOOLBAR_KEYS = defaultPinnedToolbarPref
188189
val PREF_TOOLBAR_KEYS = defaultToolbarPref
189190
const val PREF_AUTO_SHOW_TOOLBAR = false

app/src/main/java/helium314/keyboard/latin/settings/Settings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
189189
public static final String PREF_URL_DETECTION = "url_detection";
190190
public static final String PREF_DONT_SHOW_MISSING_DICTIONARY_DIALOG = "dont_show_missing_dict_dialog";
191191
public static final String PREF_QUICK_PIN_TOOLBAR_KEYS = "quick_pin_toolbar_keys";
192+
public static final String PREF_TOOLBAR_LONG_PRESS_HINT = "toolbar_long_press_hint";
192193
public static final String PREF_DISABLE_NETWORK = "disable_network";
193194
public static final String PREF_PINNED_TOOLBAR_KEYS = "pinned_toolbar_keys";
194195
public static final String PREF_TOOLBAR_KEYS = "toolbar_keys";

app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ fun createToolbarKey(context: Context, key: ToolbarKey): ImageButton {
8080
KeyboardIconsSet.instance.getNewDrawable(key.name, context)
8181
}
8282

83-
val finalDrawable = if (rawDrawable != null && getCodeForToolbarKeyLongClick(key) != KeyCode.UNSPECIFIED) {
83+
val showLongPressHint = context.prefs()
84+
.getBoolean(Settings.PREF_TOOLBAR_LONG_PRESS_HINT, Defaults.PREF_TOOLBAR_LONG_PRESS_HINT)
85+
val finalDrawable = if (rawDrawable != null && showLongPressHint
86+
&& getCodeForToolbarKeyLongClick(key) != KeyCode.UNSPECIFIED
87+
) {
8488
LongPressHintDrawable(rawDrawable)
8589
} else {
8690
rawDrawable

app/src/main/java/helium314/keyboard/settings/screens/ToolbarScreen.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ fun ToolbarScreen(
7676
if (!isSplitToolbar) Settings.PREF_PINNED_TOOLBAR_KEYS else null,
7777
Settings.PREF_CLIPBOARD_TOOLBAR_KEYS,
7878
Settings.PREF_TOOLBAR_CUSTOM_KEY_CODES,
79+
Settings.PREF_TOOLBAR_LONG_PRESS_HINT,
7980
if (toolbarMode == ToolbarMode.EXPANDABLE && !isSplitToolbar) Settings.PREF_QUICK_PIN_TOOLBAR_KEYS else null,
8081
if (toolbarMode == ToolbarMode.EXPANDABLE && !isSplitToolbar) Settings.PREF_AUTO_SHOW_TOOLBAR else null,
8182
if (toolbarMode == ToolbarMode.EXPANDABLE && !isSplitToolbar) Settings.PREF_AUTO_SHOW_TOOLBAR_ON_SELECT else null,
@@ -145,6 +146,11 @@ fun createToolbarSettings(context: Context): List<Setting> {
145146
{
146147
SwitchPreference(it, Defaults.PREF_QUICK_PIN_TOOLBAR_KEYS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
147148
},
149+
Setting(context, Settings.PREF_TOOLBAR_LONG_PRESS_HINT,
150+
R.string.toolbar_long_press_hint, R.string.toolbar_long_press_hint_summary)
151+
{
152+
SwitchPreference(it, Defaults.PREF_TOOLBAR_LONG_PRESS_HINT) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
153+
},
148154
Setting(context, Settings.PREF_AUTO_SHOW_TOOLBAR, R.string.auto_show_toolbar_open, R.string.auto_show_toolbar_summary)
149155
{
150156
SwitchPreference(it, Defaults.PREF_AUTO_SHOW_TOOLBAR)

app/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,10 @@
629629
<string name="quick_pin_toolbar_keys">Pin toolbar key on long press</string>
630630
<!-- Description of the setting to quick-pin toolbar keys -->
631631
<string name="quick_pin_toolbar_keys_summary">This will disable other long press actions for toolbar keys that are not pinned</string>
632+
<!-- Title of the setting to show long-press hint dots on toolbar keys -->
633+
<string name="toolbar_long_press_hint">Show long-press hint dots</string>
634+
<!-- Description of the setting to show long-press hint dots on toolbar keys -->
635+
<string name="toolbar_long_press_hint_summary">Show dots on toolbar keys that have a long-press action</string>
632636
<!-- Title of the setting to show "..." as hints for more functionality on long-press -->
633637
<string name="show_popup_hints">Show functional hints</string>
634638
<!-- Description of the show_popup_hints setting -->

0 commit comments

Comments
 (0)