Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 47525030 authored by Georg Veichtlbauer's avatar Georg Veichtlbauer Committed by Michael Bestas
Browse files

LatinIME: Make long-press key hints configurable

Change-Id: I194caa97e32f330a6cd43ecb6f04e77714495ccd
parent 88f6d49e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -39,4 +39,8 @@ disposition rather than other common dispositions for Latin languages. [CHAR LIM
    <!-- Preference item for the space bar track pad -->
    <string name="space_trackpad">Space bar trackpad</string>
    <string name="space_trackpad_summary">Swipe on the spacebar to move the cursor</string>

    <!-- Preference item for enabling longpress key hints -->
    <string name="show_longpress_hints">Show long-press key hints</string>
    <string name="show_longpress_hints_summary">Shows long-press hints for supported keys</string>
</resources>
+6 −0
Original line number Diff line number Diff line
@@ -30,6 +30,12 @@
        android:summary="@string/number_row_summary"
        android:defaultValue="false"
        android:persistent="true" />
    <CheckBoxPreference
        android:key="pref_show_longpress_hints"
        android:title="@string/show_longpress_hints"
        android:summary="@string/show_longpress_hints_summary"
        android:defaultValue="true"
        android:persistent="true" />
    <CheckBoxPreference
        android:key="pref_key_use_double_space_period"
        android:title="@string/use_double_space_period"
+2 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.inputmethod.keyboard.internal.KeyDrawParams;
import com.android.inputmethod.keyboard.internal.KeyVisualAttributes;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.settings.Settings;
import com.android.inputmethod.latin.utils.TypefaceUtils;

import java.util.HashSet;
@@ -442,7 +443,7 @@ public class KeyboardView extends View {

        // Draw hint label.
        final String hintLabel = key.getHintLabel();
        if (hintLabel != null) {
        if (hintLabel != null && Settings.getInstance().getCurrent().mShowLongpressHints) {
            paint.setTextSize(key.selectHintTextSize(params));
            paint.setColor(key.selectHintTextColor(params));
            // TODO: Should add a way to specify type face for hint letters
+2 −0
Original line number Diff line number Diff line
@@ -103,6 +103,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang

    public static final String PREF_ENABLE_METRICS_LOGGING = "pref_enable_metrics_logging";
    public static final String PREF_SHOW_NUMBER_ROW = "pref_show_number_row";

    public static final String PREF_SHOW_LONGPRESS_HINTS = "pref_show_longpress_hints";
    // This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
    // This is being used only for the backward compatibility.
    private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY =
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ public class SettingsValues {
    public final boolean mKeyPreviewPopupOn;
    public final boolean mShowsVoiceInputKey;
    public final boolean mShowNumberRow;
    public final boolean mShowLongpressHints;
    public final boolean mIncludesOtherImesInLanguageSwitchList;
    public final boolean mShowsLanguageSwitchKey;
    public final boolean mUseContactsDict;
@@ -142,6 +143,7 @@ public class SettingsValues {
                && mInputAttributes.mShouldShowVoiceInputKey
                && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
        mShowNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false);
        mShowLongpressHints = prefs.getBoolean(Settings.PREF_SHOW_LONGPRESS_HINTS, true);
        mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
                ? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
                : true /* forcibly */;