mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-28 02:29:09 +00:00
add separate number row
This code is adapted from Indic Keyboard, and doesn't resize the buttons when switching from/to symbols; instead, an additional row is always shown. Fixes #21.
This commit is contained in:
parent
98b9a8fdf1
commit
3377df1e9d
14 changed files with 100 additions and 1 deletions
|
@ -78,6 +78,7 @@ public final class KeyboardId {
|
||||||
public final int mElementId;
|
public final int mElementId;
|
||||||
public final EditorInfo mEditorInfo;
|
public final EditorInfo mEditorInfo;
|
||||||
public final boolean mClobberSettingsKey;
|
public final boolean mClobberSettingsKey;
|
||||||
|
public final boolean mNumberRowEnabled;
|
||||||
public final boolean mLanguageSwitchKeyEnabled;
|
public final boolean mLanguageSwitchKeyEnabled;
|
||||||
public final String mCustomActionLabel;
|
public final String mCustomActionLabel;
|
||||||
public final boolean mHasShortcutKey;
|
public final boolean mHasShortcutKey;
|
||||||
|
@ -93,6 +94,7 @@ public final class KeyboardId {
|
||||||
mElementId = elementId;
|
mElementId = elementId;
|
||||||
mEditorInfo = params.mEditorInfo;
|
mEditorInfo = params.mEditorInfo;
|
||||||
mClobberSettingsKey = params.mNoSettingsKey;
|
mClobberSettingsKey = params.mNoSettingsKey;
|
||||||
|
mNumberRowEnabled = params.mNumberRowEnabled;
|
||||||
mLanguageSwitchKeyEnabled = params.mLanguageSwitchKeyEnabled;
|
mLanguageSwitchKeyEnabled = params.mLanguageSwitchKeyEnabled;
|
||||||
mCustomActionLabel = (mEditorInfo.actionLabel != null)
|
mCustomActionLabel = (mEditorInfo.actionLabel != null)
|
||||||
? mEditorInfo.actionLabel.toString() : null;
|
? mEditorInfo.actionLabel.toString() : null;
|
||||||
|
@ -111,6 +113,7 @@ public final class KeyboardId {
|
||||||
id.passwordInput(),
|
id.passwordInput(),
|
||||||
id.mClobberSettingsKey,
|
id.mClobberSettingsKey,
|
||||||
id.mHasShortcutKey,
|
id.mHasShortcutKey,
|
||||||
|
id.mNumberRowEnabled,
|
||||||
id.mLanguageSwitchKeyEnabled,
|
id.mLanguageSwitchKeyEnabled,
|
||||||
id.isMultiLine(),
|
id.isMultiLine(),
|
||||||
id.imeAction(),
|
id.imeAction(),
|
||||||
|
@ -132,6 +135,7 @@ public final class KeyboardId {
|
||||||
&& other.passwordInput() == passwordInput()
|
&& other.passwordInput() == passwordInput()
|
||||||
&& other.mClobberSettingsKey == mClobberSettingsKey
|
&& other.mClobberSettingsKey == mClobberSettingsKey
|
||||||
&& other.mHasShortcutKey == mHasShortcutKey
|
&& other.mHasShortcutKey == mHasShortcutKey
|
||||||
|
&& other.mNumberRowEnabled == mNumberRowEnabled
|
||||||
&& other.mLanguageSwitchKeyEnabled == mLanguageSwitchKeyEnabled
|
&& other.mLanguageSwitchKeyEnabled == mLanguageSwitchKeyEnabled
|
||||||
&& other.isMultiLine() == isMultiLine()
|
&& other.isMultiLine() == isMultiLine()
|
||||||
&& other.imeAction() == imeAction()
|
&& other.imeAction() == imeAction()
|
||||||
|
@ -202,6 +206,7 @@ public final class KeyboardId {
|
||||||
(mClobberSettingsKey ? " clobberSettingsKey" : ""),
|
(mClobberSettingsKey ? " clobberSettingsKey" : ""),
|
||||||
(passwordInput() ? " passwordInput" : ""),
|
(passwordInput() ? " passwordInput" : ""),
|
||||||
(mHasShortcutKey ? " hasShortcutKey" : ""),
|
(mHasShortcutKey ? " hasShortcutKey" : ""),
|
||||||
|
(mNumberRowEnabled ? " numberRowEnabled" : ""),
|
||||||
(mLanguageSwitchKeyEnabled ? " languageSwitchKeyEnabled" : ""),
|
(mLanguageSwitchKeyEnabled ? " languageSwitchKeyEnabled" : ""),
|
||||||
(isMultiLine() ? " isMultiLine" : ""),
|
(isMultiLine() ? " isMultiLine" : ""),
|
||||||
(mIsSplitLayout ? " isSplitLayout" : "")
|
(mIsSplitLayout ? " isSplitLayout" : "")
|
||||||
|
|
|
@ -119,6 +119,7 @@ public final class KeyboardLayoutSet {
|
||||||
boolean mIsPasswordField;
|
boolean mIsPasswordField;
|
||||||
boolean mVoiceInputKeyEnabled;
|
boolean mVoiceInputKeyEnabled;
|
||||||
boolean mNoSettingsKey;
|
boolean mNoSettingsKey;
|
||||||
|
boolean mNumberRowEnabled;
|
||||||
boolean mLanguageSwitchKeyEnabled;
|
boolean mLanguageSwitchKeyEnabled;
|
||||||
RichInputMethodSubtype mSubtype;
|
RichInputMethodSubtype mSubtype;
|
||||||
boolean mIsSpellChecker;
|
boolean mIsSpellChecker;
|
||||||
|
@ -323,6 +324,11 @@ public final class KeyboardLayoutSet {
|
||||||
mParams.mVoiceInputKeyEnabled = enabled;
|
mParams.mVoiceInputKeyEnabled = enabled;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setNumberRowEnabled(final boolean enabled) {
|
||||||
|
mParams.mNumberRowEnabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setLanguageSwitchKeyEnabled(final boolean enabled) {
|
public Builder setLanguageSwitchKeyEnabled(final boolean enabled) {
|
||||||
mParams.mLanguageSwitchKeyEnabled = enabled;
|
mParams.mLanguageSwitchKeyEnabled = enabled;
|
||||||
|
|
|
@ -115,6 +115,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
builder.setKeyboardGeometry(keyboardWidth, keyboardHeight);
|
builder.setKeyboardGeometry(keyboardWidth, keyboardHeight);
|
||||||
builder.setSubtype(mRichImm.getCurrentSubtype());
|
builder.setSubtype(mRichImm.getCurrentSubtype());
|
||||||
builder.setVoiceInputKeyEnabled(settingsValues.mShowsVoiceInputKey);
|
builder.setVoiceInputKeyEnabled(settingsValues.mShowsVoiceInputKey);
|
||||||
|
builder.setNumberRowEnabled(settingsValues.mShowsNumberRow);
|
||||||
builder.setLanguageSwitchKeyEnabled(mLatinIME.shouldShowLanguageSwitchKey());
|
builder.setLanguageSwitchKeyEnabled(mLatinIME.shouldShowLanguageSwitchKey());
|
||||||
builder.setSplitLayoutEnabledByUser(ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED
|
builder.setSplitLayoutEnabledByUser(ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED
|
||||||
&& settingsValues.mIsSplitKeyboardEnabled);
|
&& settingsValues.mIsSplitKeyboardEnabled);
|
||||||
|
|
|
@ -662,6 +662,9 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
R.styleable.Keyboard_Case_clobberSettingsKey, id.mClobberSettingsKey);
|
R.styleable.Keyboard_Case_clobberSettingsKey, id.mClobberSettingsKey);
|
||||||
final boolean hasShortcutKeyMatched = matchBoolean(caseAttr,
|
final boolean hasShortcutKeyMatched = matchBoolean(caseAttr,
|
||||||
R.styleable.Keyboard_Case_hasShortcutKey, id.mHasShortcutKey);
|
R.styleable.Keyboard_Case_hasShortcutKey, id.mHasShortcutKey);
|
||||||
|
final boolean numberRowEnabledMatched = matchBoolean(caseAttr,
|
||||||
|
R.styleable.Keyboard_Case_numberRowEnabled,
|
||||||
|
id.mNumberRowEnabled);
|
||||||
final boolean languageSwitchKeyEnabledMatched = matchBoolean(caseAttr,
|
final boolean languageSwitchKeyEnabledMatched = matchBoolean(caseAttr,
|
||||||
R.styleable.Keyboard_Case_languageSwitchKeyEnabled,
|
R.styleable.Keyboard_Case_languageSwitchKeyEnabled,
|
||||||
id.mLanguageSwitchKeyEnabled);
|
id.mLanguageSwitchKeyEnabled);
|
||||||
|
@ -680,7 +683,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
final boolean selected = keyboardLayoutSetMatched && keyboardLayoutSetElementMatched
|
final boolean selected = keyboardLayoutSetMatched && keyboardLayoutSetElementMatched
|
||||||
&& keyboardThemeMacthed && modeMatched && navigateNextMatched
|
&& keyboardThemeMacthed && modeMatched && navigateNextMatched
|
||||||
&& navigatePreviousMatched && passwordInputMatched && clobberSettingsKeyMatched
|
&& navigatePreviousMatched && passwordInputMatched && clobberSettingsKeyMatched
|
||||||
&& hasShortcutKeyMatched && languageSwitchKeyEnabledMatched
|
&& hasShortcutKeyMatched && languageSwitchKeyEnabledMatched && numberRowEnabledMatched
|
||||||
&& isMultiLineMatched && imeActionMatched && isIconDefinedMatched
|
&& isMultiLineMatched && imeActionMatched && isIconDefinedMatched
|
||||||
&& localeCodeMatched && languageCodeMatched && countryCodeMatched
|
&& localeCodeMatched && languageCodeMatched && countryCodeMatched
|
||||||
&& splitLayoutMatched;
|
&& splitLayoutMatched;
|
||||||
|
@ -707,6 +710,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
"passwordInput"),
|
"passwordInput"),
|
||||||
booleanAttr(caseAttr, R.styleable.Keyboard_Case_hasShortcutKey,
|
booleanAttr(caseAttr, R.styleable.Keyboard_Case_hasShortcutKey,
|
||||||
"hasShortcutKey"),
|
"hasShortcutKey"),
|
||||||
|
booleanAttr(caseAttr, R.styleable.Keyboard_Case_numberRowEnabled,
|
||||||
|
"numberRowEnabled"),
|
||||||
booleanAttr(caseAttr, R.styleable.Keyboard_Case_languageSwitchKeyEnabled,
|
booleanAttr(caseAttr, R.styleable.Keyboard_Case_languageSwitchKeyEnabled,
|
||||||
"languageSwitchKeyEnabled"),
|
"languageSwitchKeyEnabled"),
|
||||||
booleanAttr(caseAttr, R.styleable.Keyboard_Case_isMultiLine,
|
booleanAttr(caseAttr, R.styleable.Keyboard_Case_isMultiLine,
|
||||||
|
|
|
@ -102,6 +102,10 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static final String PREF_KEY_IS_INTERNAL = "pref_key_is_internal";
|
public static final String PREF_KEY_IS_INTERNAL = "pref_key_is_internal";
|
||||||
|
|
||||||
public static final String PREF_ENABLE_METRICS_LOGGING = "pref_enable_metrics_logging";
|
public static final String PREF_ENABLE_METRICS_LOGGING = "pref_enable_metrics_logging";
|
||||||
|
|
||||||
|
public static final String PREF_SHOW_NUMBER_ROW =
|
||||||
|
"pref_show_number_row";
|
||||||
|
|
||||||
// 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 =
|
||||||
|
@ -334,6 +338,10 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
final int milliseconds = prefs.getInt(prefKey, UNDEFINED_PREFERENCE_VALUE_INT);
|
final int milliseconds = prefs.getInt(prefKey, UNDEFINED_PREFERENCE_VALUE_INT);
|
||||||
return (milliseconds != UNDEFINED_PREFERENCE_VALUE_INT) ? milliseconds : defaultValue;
|
return (milliseconds != UNDEFINED_PREFERENCE_VALUE_INT) ? milliseconds : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean readShowsNumberRow(final SharedPreferences prefs) {
|
||||||
|
return prefs.getBoolean(PREF_SHOW_NUMBER_ROW, false);
|
||||||
|
}
|
||||||
|
|
||||||
public static float readKeyboardHeight(final SharedPreferences prefs,
|
public static float readKeyboardHeight(final SharedPreferences prefs,
|
||||||
final float defaultValue) {
|
final float defaultValue) {
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class SettingsValues {
|
||||||
public final boolean mKeyPreviewPopupOn;
|
public final boolean mKeyPreviewPopupOn;
|
||||||
public final boolean mShowsVoiceInputKey;
|
public final boolean mShowsVoiceInputKey;
|
||||||
public final boolean mIncludesOtherImesInLanguageSwitchList;
|
public final boolean mIncludesOtherImesInLanguageSwitchList;
|
||||||
|
public final boolean mShowsNumberRow;
|
||||||
public final boolean mShowsLanguageSwitchKey;
|
public final boolean mShowsLanguageSwitchKey;
|
||||||
public final boolean mUseContactsDict;
|
public final boolean mUseContactsDict;
|
||||||
public final boolean mUsePersonalizedDicts;
|
public final boolean mUsePersonalizedDicts;
|
||||||
|
@ -144,6 +145,7 @@ public class SettingsValues {
|
||||||
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
||||||
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);
|
||||||
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
|
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
|
||||||
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
||||||
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
|
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
|
||||||
|
|
|
@ -501,6 +501,7 @@
|
||||||
<attr name="clobberSettingsKey" format="boolean" />
|
<attr name="clobberSettingsKey" format="boolean" />
|
||||||
<attr name="hasShortcutKey" format="boolean" />
|
<attr name="hasShortcutKey" format="boolean" />
|
||||||
<attr name="languageSwitchKeyEnabled" format="boolean" />
|
<attr name="languageSwitchKeyEnabled" format="boolean" />
|
||||||
|
<attr name="numberRowEnabled" format="boolean" />
|
||||||
<attr name="isMultiLine" format="boolean" />
|
<attr name="isMultiLine" format="boolean" />
|
||||||
<attr name="imeAction" format="enum">
|
<attr name="imeAction" format="enum">
|
||||||
<!-- This should be aligned with
|
<!-- This should be aligned with
|
||||||
|
|
|
@ -222,6 +222,11 @@
|
||||||
|
|
||||||
<!-- Title of the item to change the keyboard theme [CHAR LIMIT=20]-->
|
<!-- Title of the item to change the keyboard theme [CHAR LIMIT=20]-->
|
||||||
<string name="keyboard_layout">Keyboard theme</string>
|
<string name="keyboard_layout">Keyboard theme</string>
|
||||||
|
|
||||||
|
<!-- Title of the settings to enable number row -->
|
||||||
|
<string name="number_row">Number row</string>
|
||||||
|
<!-- Description of the settings to enable number row -->
|
||||||
|
<string name="number_row_summary">Always show number row</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>
|
||||||
|
|
|
@ -22,6 +22,12 @@
|
||||||
android:summary="@string/auto_cap_summary"
|
android:summary="@string/auto_cap_summary"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:persistent="true" />
|
android:persistent="true" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_show_number_row"
|
||||||
|
android:title="@string/number_row"
|
||||||
|
android:summary="@string/number_row_summary"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:persistent="true" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="pref_key_use_double_space_period"
|
android:key="pref_key_use_double_space_period"
|
||||||
android:title="@string/use_double_space_period"
|
android:title="@string/use_double_space_period"
|
||||||
|
|
|
@ -23,6 +23,18 @@
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_common" />
|
latin:keyboardLayout="@xml/key_styles_common" />
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:numberRowEnabled="true"
|
||||||
|
>
|
||||||
|
<Row
|
||||||
|
latin:keyWidth="10%p"
|
||||||
|
>
|
||||||
|
<include
|
||||||
|
latin:keyboardLayout="@xml/rowkeys_symbols1" />
|
||||||
|
</Row>
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
<Row
|
<Row
|
||||||
latin:keyWidth="10%p"
|
latin:keyWidth="10%p"
|
||||||
>
|
>
|
||||||
|
|
|
@ -23,6 +23,18 @@
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_common" />
|
latin:keyboardLayout="@xml/key_styles_common" />
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:numberRowEnabled="true"
|
||||||
|
>
|
||||||
|
<Row
|
||||||
|
latin:keyWidth="10%p"
|
||||||
|
>
|
||||||
|
<include
|
||||||
|
latin:keyboardLayout="@xml/rowkeys_symbols1" />
|
||||||
|
</Row>
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
<Row
|
<Row
|
||||||
latin:keyWidth="10%p"
|
latin:keyWidth="10%p"
|
||||||
>
|
>
|
||||||
|
|
|
@ -23,6 +23,18 @@
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_common" />
|
latin:keyboardLayout="@xml/key_styles_common" />
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:numberRowEnabled="true"
|
||||||
|
>
|
||||||
|
<Row
|
||||||
|
latin:keyWidth="10%p"
|
||||||
|
>
|
||||||
|
<include
|
||||||
|
latin:keyboardLayout="@xml/rowkeys_symbols1" />
|
||||||
|
</Row>
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
<Row
|
<Row
|
||||||
latin:keyWidth="10%p"
|
latin:keyWidth="10%p"
|
||||||
>
|
>
|
||||||
|
|
|
@ -31,6 +31,18 @@
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/rowkeys_symbols1" />
|
latin:keyboardLayout="@xml/rowkeys_symbols1" />
|
||||||
</Row>
|
</Row>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:numberRowEnabled="true"
|
||||||
|
>
|
||||||
|
<Row
|
||||||
|
latin:keyWidth="10%p"
|
||||||
|
>
|
||||||
|
<include
|
||||||
|
latin:keyboardLayout="@xml/rowkeys_symbols_shift1" />
|
||||||
|
</Row>
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
<Row
|
<Row
|
||||||
latin:keyWidth="10%p"
|
latin:keyWidth="10%p"
|
||||||
>
|
>
|
||||||
|
|
|
@ -25,6 +25,18 @@
|
||||||
latin:keyboardLayout="@xml/key_styles_common" />
|
latin:keyboardLayout="@xml/key_styles_common" />
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_currency" />
|
latin:keyboardLayout="@xml/key_styles_currency" />
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:numberRowEnabled="true"
|
||||||
|
>
|
||||||
|
<Row
|
||||||
|
latin:keyWidth="10%p"
|
||||||
|
>
|
||||||
|
<include
|
||||||
|
latin:keyboardLayout="@xml/rowkeys_symbols1" />
|
||||||
|
</Row>
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
<Row
|
<Row
|
||||||
latin:keyWidth="10%p"
|
latin:keyWidth="10%p"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Add table
Reference in a new issue