mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 15:02:48 +00:00
add setting to show first popup key as hint label
This commit is contained in:
parent
c5f3d4bfcf
commit
bb7c1f5242
9 changed files with 23 additions and 5 deletions
|
@ -1246,10 +1246,12 @@ public class Key implements Comparable<Key> {
|
|||
mHintLabel = null;
|
||||
} else {
|
||||
// maybe also always null for comma and period keys
|
||||
final boolean hintLabelAlwaysFromFirstLongPressKey = false; // todo (later): add the setting, and use it (store in params?)
|
||||
String hintLabel;
|
||||
if (hintLabelAlwaysFromFirstLongPressKey) {
|
||||
if (mKeyboardParams.mHintLabelFromFirstMoreKey) {
|
||||
hintLabel = mMoreKeys == null ? null : mMoreKeys[0].mLabel;
|
||||
if (hintLabel != null && backgroundType == BACKGROUND_TYPE_FUNCTIONAL && mKeyboardParams.mId.isAlphabetKeyboard())
|
||||
// bad workaround for the ugly comma label on period key, todo: do it better when re-working moreKey stuff
|
||||
hintLabel = null;
|
||||
} else {
|
||||
hintLabel = layoutMoreKeys == null ? null : KeySpecParser.getLabel(layoutMoreKeys[0]); // note that some entries may have been changed to other string or null
|
||||
// todo: this should be adjusted when re-working moreKey stuff... also KeySpecParser.getLabel may throw, which is bad when users do uncommon things
|
||||
|
|
|
@ -67,11 +67,11 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
return this
|
||||
|
||||
// todo: further plan
|
||||
// re-check the LayoutInfos, they should really to the right things!
|
||||
// some keyboard_layout_set have supportedScript that is enum synced with script id in ScriptUtils
|
||||
// that's one more reason for using language tags...
|
||||
// currently it's still read from xml outside the keyboard parser, but should still go to some other place
|
||||
// maybe use scriptUtils to determine, just make sure it's correct (also for hindi and serbian!)
|
||||
// next release, and possibly don't continue working here for a while (should allow finding more regressions)
|
||||
// remove the old parser
|
||||
// then finally the spanish/german/swiss/nordic layouts can be removed and replaced by some hasExtraKeys parameter
|
||||
// also the eo check could then be removed
|
||||
|
|
|
@ -89,6 +89,7 @@ public class KeyboardParams {
|
|||
@NonNull
|
||||
private final UniqueKeysCache mUniqueKeysCache;
|
||||
public boolean mAllowRedundantMoreKeys;
|
||||
public final boolean mHintLabelFromFirstMoreKey = Settings.getInstance().getCurrent().mHintLabelFromFirstMoreKey;
|
||||
@NonNull
|
||||
public LocaleKeyTexts mLocaleKeyTexts;
|
||||
|
||||
|
|
|
@ -820,7 +820,7 @@ data class LayoutInfos(
|
|||
val allowRedundantMoreKeys: Boolean = true, // only false for nordic and serbian_qwertz
|
||||
// there is holo, default and null
|
||||
// null only for moreKeys keyboard
|
||||
// currently read as part of readAttributes, and thus wrong with the new parser
|
||||
// currently read as part of readAttributes, and thus wrong with the new parser (but we set it correctly in parser)
|
||||
val touchPositionCorrectionData: Int? = null,
|
||||
val hasZwnjKey: Boolean = false,
|
||||
val hasShiftKey: Boolean = true,
|
||||
|
|
|
@ -67,6 +67,7 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
setupHistoryRetentionTimeSettings();
|
||||
refreshEnablingsOfKeypressSoundAndVibrationAndHistRetentionSettings();
|
||||
setLocalizedNumberRowVisibility();
|
||||
findPreference(Settings.PREF_HINT_LABEL_FROM_FIRST_MORE_KEY).setVisible(getSharedPreferences().getBoolean(Settings.PREF_SHOW_HINTS, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,10 +78,13 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
@Override
|
||||
public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) {
|
||||
refreshEnablingsOfKeypressSoundAndVibrationAndHistRetentionSettings();
|
||||
if (Settings.PREF_SHOW_POPUP_HINTS.equals(key))
|
||||
if (Settings.PREF_SHOW_POPUP_HINTS.equals(key) || Settings.PREF_HINT_LABEL_FROM_FIRST_MORE_KEY.equals(key))
|
||||
mReloadKeyboard = true;
|
||||
if (key.equals(Settings.PREF_LOCALIZED_NUMBER_ROW))
|
||||
KeyboardLayoutSet.onSystemLocaleChanged();
|
||||
if (Settings.PREF_SHOW_HINTS.equals(key)) {
|
||||
findPreference(Settings.PREF_HINT_LABEL_FROM_FIRST_MORE_KEY).setVisible(prefs.getBoolean(Settings.PREF_SHOW_HINTS, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -112,6 +112,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
public static final String PREF_LOCALIZED_NUMBER_ROW = "pref_localized_number_row";
|
||||
|
||||
public static final String PREF_SHOW_HINTS = "pref_show_hints";
|
||||
public static final String PREF_HINT_LABEL_FROM_FIRST_MORE_KEY = "pref_hint_label_from_first_more_key";
|
||||
public static final String PREF_SHOW_POPUP_HINTS = "pref_show_popup_hints";
|
||||
|
||||
public static final String PREF_SPACE_TO_CHANGE_LANG = "prefs_long_press_keyboard_to_change_lang";
|
||||
|
|
|
@ -66,6 +66,7 @@ public class SettingsValues {
|
|||
public final boolean mShowsNumberRow;
|
||||
public final boolean mLocalizedNumberRow;
|
||||
public final boolean mShowsHints;
|
||||
public final boolean mHintLabelFromFirstMoreKey;
|
||||
public final boolean mShowsPopupHints;
|
||||
public final boolean mSpaceForLangChange;
|
||||
public final boolean mSpaceLanguageSlide;
|
||||
|
@ -151,6 +152,7 @@ public class SettingsValues {
|
|||
mShowsNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false);
|
||||
mLocalizedNumberRow = prefs.getBoolean(Settings.PREF_LOCALIZED_NUMBER_ROW, true);
|
||||
mShowsHints = prefs.getBoolean(Settings.PREF_SHOW_HINTS, true);
|
||||
mHintLabelFromFirstMoreKey = mShowsHints && prefs.getBoolean(Settings.PREF_HINT_LABEL_FROM_FIRST_MORE_KEY, false);
|
||||
mShowsPopupHints = prefs.getBoolean(Settings.PREF_SHOW_POPUP_HINTS, false);
|
||||
mSpaceForLangChange = prefs.getBoolean(Settings.PREF_SPACE_TO_CHANGE_LANG, true);
|
||||
mSpaceLanguageSlide = prefs.getBoolean(Settings.PREF_SPACE_LANGUAGE_SLIDE, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue