mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-19 00:10:20 +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.latin.R;
|
||||
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 java.util.HashSet;
|
||||
|
@ -115,6 +116,8 @@ public class KeyboardView extends View {
|
|||
private final Rect mClipRect = new Rect();
|
||||
/** The keyboard bitmap buffer for faster updates */
|
||||
private Bitmap mOffscreenBuffer;
|
||||
/** Flag for whether the key hints should be displayed */
|
||||
private boolean mShowsHints;
|
||||
/** The canvas for the above mutable keyboard bitmap */
|
||||
@Nonnull
|
||||
private final Canvas mOffscreenCanvas = new Canvas();
|
||||
|
@ -284,6 +287,7 @@ public class KeyboardView extends View {
|
|||
return;
|
||||
}
|
||||
|
||||
mShowsHints = Settings.getInstance().getCurrent().mShowsHints;
|
||||
final Paint paint = mPaint;
|
||||
final Drawable background = getBackground();
|
||||
// Calculate clip region and set.
|
||||
|
@ -438,7 +442,7 @@ public class KeyboardView extends View {
|
|||
|
||||
// Draw hint label.
|
||||
final String hintLabel = key.getHintLabel();
|
||||
if (hintLabel != null) {
|
||||
if (hintLabel != null && mShowsHints) {
|
||||
paint.setTextSize(key.selectHintTextSize(params));
|
||||
paint.setColor(key.selectHintTextColor(params));
|
||||
// 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 =
|
||||
"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 is being used only for the backward compatibility.
|
||||
private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY =
|
||||
|
|
|
@ -70,6 +70,7 @@ public class SettingsValues {
|
|||
public final boolean mShowsVoiceInputKey;
|
||||
public final boolean mIncludesOtherImesInLanguageSwitchList;
|
||||
public final boolean mShowsNumberRow;
|
||||
public final boolean mShowsHints;
|
||||
public final boolean mShowsLanguageSwitchKey;
|
||||
public final boolean mShowsEmojiKey;
|
||||
public final boolean mUsePersonalizedDicts;
|
||||
|
@ -145,6 +146,7 @@ public class SettingsValues {
|
|||
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 */;
|
||||
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);
|
||||
mShowsEmojiKey = prefs.getBoolean(Settings.PREF_SHOW_EMOJI_KEY, false);
|
||||
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue