mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Add toggle for number row
This commit is contained in:
parent
bed5f68b11
commit
918f0dbd2d
@ -522,6 +522,7 @@
|
|||||||
<attr name="countryCode" format="string" />
|
<attr name="countryCode" format="string" />
|
||||||
<!-- Enable split keyboard layout. Disabled by default. -->
|
<!-- Enable split keyboard layout. Disabled by default. -->
|
||||||
<attr name="isSplitLayout" format="boolean" />
|
<attr name="isSplitLayout" format="boolean" />
|
||||||
|
<attr name="numberRow" format="boolean" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="Keyboard_KeyStyle">
|
<declare-styleable name="Keyboard_KeyStyle">
|
||||||
|
@ -23,6 +23,19 @@
|
|||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_common" />
|
latin:keyboardLayout="@xml/key_styles_common" />
|
||||||
|
<switch>
|
||||||
|
<case latin:numberRow="true">
|
||||||
|
<Row
|
||||||
|
latin:keyWidth="10%p"
|
||||||
|
>
|
||||||
|
<include
|
||||||
|
latin:keyboardLayout="@xml/rowkeys_numbers" />
|
||||||
|
</Row>
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
<!-- First row -->
|
<!-- First row -->
|
||||||
<Row>
|
<Row>
|
||||||
<switch>
|
<switch>
|
||||||
|
@ -23,6 +23,19 @@
|
|||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_common" />
|
latin:keyboardLayout="@xml/key_styles_common" />
|
||||||
|
<switch>
|
||||||
|
<case latin:numberRow="true">
|
||||||
|
<Row
|
||||||
|
latin:keyWidth="10%p"
|
||||||
|
>
|
||||||
|
<include
|
||||||
|
latin:keyboardLayout="@xml/rowkeys_numbers" />
|
||||||
|
</Row>
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
<!-- TODO: Consolidate the layout specification between protrait and landscape.
|
<!-- TODO: Consolidate the layout specification between protrait and landscape.
|
||||||
Ideally just the keyWidth should be different and the spacer should adjust to fill
|
Ideally just the keyWidth should be different and the spacer should adjust to fill
|
||||||
the available space. -->
|
the available space. -->
|
||||||
|
97
java/res/xml/rowkeys_numbers.xml
Normal file
97
java/res/xml/rowkeys_numbers.xml
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2012, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<merge
|
||||||
|
xmlns:latin="http://schemas.android.com/apk/res-auto"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:keyboardLayoutSetElement="alphabet|alphabetAutomaticShifted|alphabetShiftLocked"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keySpec="1"
|
||||||
|
latin:additionalMoreKeys="!,!text/morekeys_exclamation"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_1" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="2"
|
||||||
|
latin:additionalMoreKeys="\@"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_2" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="3"
|
||||||
|
latin:additionalMoreKeys="\#"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_3" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="4"
|
||||||
|
latin:additionalMoreKeys="$"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_4" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="5"
|
||||||
|
latin:additionalMoreKeys="\\%"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_5" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="6"
|
||||||
|
latin:additionalMoreKeys="^"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_6" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="7"
|
||||||
|
latin:additionalMoreKeys="&"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_7" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="8"
|
||||||
|
latin:additionalMoreKeys="*"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_8" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="9"
|
||||||
|
latin:additionalMoreKeys="("
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_9" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="0"
|
||||||
|
latin:additionalMoreKeys=")"
|
||||||
|
latin:moreKeys="!text/morekeys_symbols_0" />
|
||||||
|
</case>
|
||||||
|
<!-- keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLockShifted" -->
|
||||||
|
<default>
|
||||||
|
<Key
|
||||||
|
latin:keySpec="!"
|
||||||
|
latin:additionalMoreKeys="!text/morekeys_exclamation" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="\@" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="\#" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="$"
|
||||||
|
latin:additionalMoreKeys="!text/morekeys_currency_dollar" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="%"
|
||||||
|
latin:additionalMoreKeys="!text/morekeys_symbols_percent" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="^" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="&" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="*"
|
||||||
|
latin:additionalMoreKeys="!text/morekeys_star" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec="(" />
|
||||||
|
<Key
|
||||||
|
latin:keySpec=")" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</merge>
|
@ -23,6 +23,19 @@
|
|||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_common" />
|
latin:keyboardLayout="@xml/key_styles_common" />
|
||||||
|
<switch>
|
||||||
|
<case latin:numberRow="true">
|
||||||
|
<Row
|
||||||
|
latin:keyWidth="10%p"
|
||||||
|
>
|
||||||
|
<include
|
||||||
|
latin:keyboardLayout="@xml/rowkeys_numbers" />
|
||||||
|
</Row>
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
<Row
|
<Row
|
||||||
latin:keyWidth="10%p"
|
latin:keyWidth="10%p"
|
||||||
>
|
>
|
||||||
|
@ -82,6 +82,7 @@ public final class KeyboardId {
|
|||||||
public final String mCustomActionLabel;
|
public final String mCustomActionLabel;
|
||||||
public final boolean mHasShortcutKey;
|
public final boolean mHasShortcutKey;
|
||||||
public final boolean mIsSplitLayout;
|
public final boolean mIsSplitLayout;
|
||||||
|
public final boolean mNumberRow;
|
||||||
|
|
||||||
private final int mHashCode;
|
private final int mHashCode;
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ public final class KeyboardId {
|
|||||||
? mEditorInfo.actionLabel.toString() : null;
|
? mEditorInfo.actionLabel.toString() : null;
|
||||||
mHasShortcutKey = params.mVoiceInputKeyEnabled;
|
mHasShortcutKey = params.mVoiceInputKeyEnabled;
|
||||||
mIsSplitLayout = params.mIsSplitLayoutEnabled;
|
mIsSplitLayout = params.mIsSplitLayoutEnabled;
|
||||||
|
mNumberRow = params.mNumberRow;
|
||||||
|
|
||||||
mHashCode = computeHashCode(this);
|
mHashCode = computeHashCode(this);
|
||||||
}
|
}
|
||||||
@ -118,7 +120,8 @@ public final class KeyboardId {
|
|||||||
id.navigateNext(),
|
id.navigateNext(),
|
||||||
id.navigatePrevious(),
|
id.navigatePrevious(),
|
||||||
id.mSubtype,
|
id.mSubtype,
|
||||||
id.mIsSplitLayout
|
id.mIsSplitLayout,
|
||||||
|
id.mNumberRow
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +142,8 @@ public final class KeyboardId {
|
|||||||
&& other.navigateNext() == navigateNext()
|
&& other.navigateNext() == navigateNext()
|
||||||
&& other.navigatePrevious() == navigatePrevious()
|
&& other.navigatePrevious() == navigatePrevious()
|
||||||
&& other.mSubtype.equals(mSubtype)
|
&& other.mSubtype.equals(mSubtype)
|
||||||
&& other.mIsSplitLayout == mIsSplitLayout;
|
&& other.mIsSplitLayout == mIsSplitLayout
|
||||||
|
&& other.mNumberRow == mNumberRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isAlphabetKeyboard(final int elementId) {
|
private static boolean isAlphabetKeyboard(final int elementId) {
|
||||||
|
@ -133,6 +133,8 @@ public final class KeyboardLayoutSet {
|
|||||||
// Sparse array of KeyboardLayoutSet element parameters indexed by element's id.
|
// Sparse array of KeyboardLayoutSet element parameters indexed by element's id.
|
||||||
final SparseArray<ElementParams> mKeyboardLayoutSetElementIdToParamsMap =
|
final SparseArray<ElementParams> mKeyboardLayoutSetElementIdToParamsMap =
|
||||||
new SparseArray<>();
|
new SparseArray<>();
|
||||||
|
|
||||||
|
boolean mNumberRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onSystemLocaleChanged() {
|
public static void onSystemLocaleChanged() {
|
||||||
@ -337,6 +339,11 @@ public final class KeyboardLayoutSet {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setNumberRow(final boolean enabled) {
|
||||||
|
mParams.mNumberRow = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// Super redux version of reading the script ID for some subtype from Xml.
|
// Super redux version of reading the script ID for some subtype from Xml.
|
||||||
static int readScriptId(final Resources resources, final InputMethodSubtype subtype) {
|
static int readScriptId(final Resources resources, final InputMethodSubtype subtype) {
|
||||||
final String layoutSetName = KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX
|
final String layoutSetName = KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX
|
||||||
|
@ -130,6 +130,8 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
|||||||
builder.setBottomEmojiKeyEnabled(mLatinIMELegacy.shouldShowEmojiKey());
|
builder.setBottomEmojiKeyEnabled(mLatinIMELegacy.shouldShowEmojiKey());
|
||||||
builder.setSplitLayoutEnabledByUser(ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED
|
builder.setSplitLayoutEnabledByUser(ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED
|
||||||
&& settingsValues.mIsSplitKeyboardEnabled);
|
&& settingsValues.mIsSplitKeyboardEnabled);
|
||||||
|
builder.setNumberRow(settingsValues.mIsNumberRowEnabled);
|
||||||
|
|
||||||
mKeyboardLayoutSet = builder.build();
|
mKeyboardLayoutSet = builder.build();
|
||||||
try {
|
try {
|
||||||
mState.onLoadKeyboard(currentAutoCapsState, currentRecapitalizeState);
|
mState.onLoadKeyboard(currentAutoCapsState, currentRecapitalizeState);
|
||||||
|
@ -696,13 +696,15 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||||||
final boolean countryCodeMatched = matchCountryCodes(caseAttr, locale);
|
final boolean countryCodeMatched = matchCountryCodes(caseAttr, locale);
|
||||||
final boolean splitLayoutMatched = matchBoolean(caseAttr,
|
final boolean splitLayoutMatched = matchBoolean(caseAttr,
|
||||||
R.styleable.Keyboard_Case_isSplitLayout, id.mIsSplitLayout);
|
R.styleable.Keyboard_Case_isSplitLayout, id.mIsSplitLayout);
|
||||||
|
final boolean numberRowMatched = matchBoolean(caseAttr,
|
||||||
|
R.styleable.Keyboard_Case_numberRow, id.mNumberRow);
|
||||||
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
|
||||||
&& isMultiLineMatched && imeActionMatched && isIconDefinedMatched
|
&& isMultiLineMatched && imeActionMatched && isIconDefinedMatched
|
||||||
&& localeCodeMatched && languageCodeMatched && countryCodeMatched
|
&& localeCodeMatched && languageCodeMatched && countryCodeMatched
|
||||||
&& splitLayoutMatched;
|
&& splitLayoutMatched && numberRowMatched;
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE,
|
startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE,
|
||||||
|
@ -103,6 +103,9 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||||||
|
|
||||||
public static final String PREF_SHOW_EMOJI_KEY =
|
public static final String PREF_SHOW_EMOJI_KEY =
|
||||||
"pref_show_emoji_key";
|
"pref_show_emoji_key";
|
||||||
|
|
||||||
|
public static final String PREF_ENABLE_NUMBER_ROW = "pref_enable_number_row";
|
||||||
|
|
||||||
private static final String PREF_LAST_USED_PERSONALIZATION_TOKEN =
|
private static final String PREF_LAST_USED_PERSONALIZATION_TOKEN =
|
||||||
"pref_last_used_personalization_token";
|
"pref_last_used_personalization_token";
|
||||||
private static final String PREF_LAST_PERSONALIZATION_DICT_WIPED_TIME =
|
private static final String PREF_LAST_PERSONALIZATION_DICT_WIPED_TIME =
|
||||||
|
@ -88,6 +88,7 @@ public class SettingsValues {
|
|||||||
public final boolean mShouldShowLxxSuggestionUi;
|
public final boolean mShouldShowLxxSuggestionUi;
|
||||||
// Use split layout for keyboard.
|
// Use split layout for keyboard.
|
||||||
public final boolean mIsSplitKeyboardEnabled;
|
public final boolean mIsSplitKeyboardEnabled;
|
||||||
|
public final boolean mIsNumberRowEnabled;
|
||||||
public final int mScreenMetrics;
|
public final int mScreenMetrics;
|
||||||
|
|
||||||
// From the input box
|
// From the input box
|
||||||
@ -142,6 +143,7 @@ public class SettingsValues {
|
|||||||
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
|
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
|
||||||
: true /* forcibly */;
|
: true /* forcibly */;
|
||||||
mShowsEmojiKey = Settings.readShowsEmojiKey(prefs);
|
mShowsEmojiKey = Settings.readShowsEmojiKey(prefs);
|
||||||
|
mIsNumberRowEnabled = prefs.getBoolean(Settings.PREF_ENABLE_NUMBER_ROW, 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);
|
||||||
mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true)
|
mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true)
|
||||||
|
@ -54,6 +54,11 @@ fun TypingScreen(navController: NavHostController = rememberNavController()) {
|
|||||||
subtitle = "Suggest emojis while you're typing",
|
subtitle = "Suggest emojis while you're typing",
|
||||||
setting = SHOW_EMOJI_SUGGESTIONS
|
setting = SHOW_EMOJI_SUGGESTIONS
|
||||||
)
|
)
|
||||||
|
SettingToggleSharedPrefs(
|
||||||
|
title = "Number row",
|
||||||
|
key = Settings.PREF_ENABLE_NUMBER_ROW,
|
||||||
|
default = false
|
||||||
|
)
|
||||||
SettingToggleSharedPrefs(
|
SettingToggleSharedPrefs(
|
||||||
title = "Emoji key",
|
title = "Emoji key",
|
||||||
subtitle = "Show the emoji key on the bottom row",
|
subtitle = "Show the emoji key on the bottom row",
|
||||||
|
Loading…
Reference in New Issue
Block a user