mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-19 16:30:19 +00:00
Add toggle to disable long-press hints
This commit is contained in:
parent
d997325daf
commit
24a945e4fb
5 changed files with 21 additions and 2 deletions
|
@ -36,6 +36,7 @@ import org.dslul.openboard.inputmethod.keyboard.internal.KeyDrawParams;
|
||||||
import org.dslul.openboard.inputmethod.keyboard.internal.KeyVisualAttributes;
|
import org.dslul.openboard.inputmethod.keyboard.internal.KeyVisualAttributes;
|
||||||
import org.dslul.openboard.inputmethod.latin.R;
|
import org.dslul.openboard.inputmethod.latin.R;
|
||||||
import org.dslul.openboard.inputmethod.latin.common.Constants;
|
import org.dslul.openboard.inputmethod.latin.common.Constants;
|
||||||
|
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||||
import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils;
|
import org.dslul.openboard.inputmethod.latin.utils.TypefaceUtils;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -115,6 +116,8 @@ public class KeyboardView extends View {
|
||||||
private final Rect mClipRect = new Rect();
|
private final Rect mClipRect = new Rect();
|
||||||
/** The keyboard bitmap buffer for faster updates */
|
/** The keyboard bitmap buffer for faster updates */
|
||||||
private Bitmap mOffscreenBuffer;
|
private Bitmap mOffscreenBuffer;
|
||||||
|
/** Flag for whether the key hints should be displayed */
|
||||||
|
private boolean mShowsHints;
|
||||||
/** The canvas for the above mutable keyboard bitmap */
|
/** The canvas for the above mutable keyboard bitmap */
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final Canvas mOffscreenCanvas = new Canvas();
|
private final Canvas mOffscreenCanvas = new Canvas();
|
||||||
|
@ -284,6 +287,7 @@ public class KeyboardView extends View {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mShowsHints = Settings.getInstance().getCurrent().mShowsHints;
|
||||||
final Paint paint = mPaint;
|
final Paint paint = mPaint;
|
||||||
final Drawable background = getBackground();
|
final Drawable background = getBackground();
|
||||||
// Calculate clip region and set.
|
// Calculate clip region and set.
|
||||||
|
@ -438,7 +442,7 @@ public class KeyboardView extends View {
|
||||||
|
|
||||||
// Draw hint label.
|
// Draw hint label.
|
||||||
final String hintLabel = key.getHintLabel();
|
final String hintLabel = key.getHintLabel();
|
||||||
if (hintLabel != null) {
|
if (hintLabel != null && mShowsHints) {
|
||||||
paint.setTextSize(key.selectHintTextSize(params));
|
paint.setTextSize(key.selectHintTextSize(params));
|
||||||
paint.setColor(key.selectHintTextColor(params));
|
paint.setColor(key.selectHintTextColor(params));
|
||||||
// TODO: Should add a way to specify type face for hint letters
|
// TODO: Should add a way to specify type face for hint letters
|
||||||
|
|
|
@ -106,6 +106,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static final String PREF_SHOW_NUMBER_ROW =
|
public static final String PREF_SHOW_NUMBER_ROW =
|
||||||
"pref_show_number_row";
|
"pref_show_number_row";
|
||||||
|
|
||||||
|
public static final String PREF_SHOW_HINTS = "pref_show_hints";
|
||||||
|
|
||||||
// This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
|
// This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
|
||||||
// This is being used only for the backward compatibility.
|
// This is being used only for the backward compatibility.
|
||||||
private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY =
|
private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY =
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class SettingsValues {
|
||||||
public final boolean mShowsVoiceInputKey;
|
public final boolean mShowsVoiceInputKey;
|
||||||
public final boolean mIncludesOtherImesInLanguageSwitchList;
|
public final boolean mIncludesOtherImesInLanguageSwitchList;
|
||||||
public final boolean mShowsNumberRow;
|
public final boolean mShowsNumberRow;
|
||||||
|
public final boolean mShowsHints;
|
||||||
public final boolean mShowsLanguageSwitchKey;
|
public final boolean mShowsLanguageSwitchKey;
|
||||||
public final boolean mShowsEmojiKey;
|
public final boolean mShowsEmojiKey;
|
||||||
public final boolean mUsePersonalizedDicts;
|
public final boolean mUsePersonalizedDicts;
|
||||||
|
@ -145,6 +146,7 @@ public class SettingsValues {
|
||||||
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res) && mInputAttributes.mShouldShowVoiceInputKey;
|
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res) && mInputAttributes.mShouldShowVoiceInputKey;
|
||||||
mIncludesOtherImesInLanguageSwitchList = !Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS || prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false) /* forcibly */;
|
mIncludesOtherImesInLanguageSwitchList = !Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS || prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false) /* forcibly */;
|
||||||
mShowsNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false);
|
mShowsNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false);
|
||||||
|
mShowsHints = prefs.getBoolean(Settings.PREF_SHOW_HINTS, true);
|
||||||
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
|
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
|
||||||
mShowsEmojiKey = prefs.getBoolean(Settings.PREF_SHOW_EMOJI_KEY, false);
|
mShowsEmojiKey = prefs.getBoolean(Settings.PREF_SHOW_EMOJI_KEY, false);
|
||||||
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
|
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
|
||||||
|
|
|
@ -208,6 +208,11 @@
|
||||||
<!-- Description of the settings to enable number row -->
|
<!-- Description of the settings to enable number row -->
|
||||||
<string name="number_row_summary">Always show number row</string>
|
<string name="number_row_summary">Always show number row</string>
|
||||||
|
|
||||||
|
<!-- Title of the settings to show key hints -->
|
||||||
|
<string name="show_hints">Show key hints</string>
|
||||||
|
<!-- Description of the settings to show hints -->
|
||||||
|
<string name="show_hints_summary">Show long-press hints</string>
|
||||||
|
|
||||||
<!-- Title of the settings to enable keyboard resizing -->
|
<!-- Title of the settings to enable keyboard resizing -->
|
||||||
<string name="prefs_resize_keyboard">Enable keyboard resizing</string>
|
<string name="prefs_resize_keyboard">Enable keyboard resizing</string>
|
||||||
<!-- Title of the settings for setting keyboard height -->
|
<!-- Title of the settings for setting keyboard height -->
|
||||||
|
|
|
@ -28,6 +28,12 @@
|
||||||
android:summary="@string/number_row_summary"
|
android:summary="@string/number_row_summary"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:persistent="true" />
|
android:persistent="true" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_show_hints"
|
||||||
|
android:title="@string/show_hints"
|
||||||
|
android:summary="@string/show_hints_summary"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:persistent="true" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="pref_show_language_switch_key"
|
android:key="pref_show_language_switch_key"
|
||||||
android:title="@string/show_language_switch_key"
|
android:title="@string/show_language_switch_key"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue