Skip to content

Commit

Permalink
Add caps lock indicator (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
codokie authored May 19, 2024
1 parent f81e24d commit bb3fe9d
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class KeyboardIconsSet {
const val NAME_UNDEFINED = "undefined"
const val NAME_SHIFT_KEY = "shift_key"
const val NAME_SHIFT_KEY_SHIFTED = "shift_key_shifted"
const val NAME_SHIFT_KEY_LOCKED = "shift_key_locked"
const val NAME_DELETE_KEY = "delete_key"
const val NAME_SETTINGS_KEY = "settings_key"
const val NAME_SPACE_KEY = "space_key"
Expand Down Expand Up @@ -78,6 +79,7 @@ class KeyboardIconsSet {
NAME_INCOGNITO_KEY to R.styleable.Keyboard_iconIncognitoKey,
NAME_SPACE_KEY_FOR_NUMBER_LAYOUT to R.styleable.Keyboard_iconSpaceKeyForNumberLayout,
NAME_SHIFT_KEY_SHIFTED to R.styleable.Keyboard_iconShiftKeyShifted,
NAME_SHIFT_KEY_LOCKED to R.styleable.Keyboard_iconShiftKeyLocked,
NAME_SHORTCUT_KEY_DISABLED to R.styleable.Keyboard_iconShortcutKeyDisabled,
NAME_LANGUAGE_SWITCH_KEY to R.styleable.Keyboard_iconLanguageSwitchKey,
NAME_ZWNJ_KEY to R.styleable.Keyboard_iconZwnjKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ sealed interface KeyData : AbstractKeyData {
private fun getShiftLabel(params: KeyboardParams) = when (params.mId.mElementId) {
KeyboardId.ELEMENT_SYMBOLS_SHIFTED -> params.mLocaleKeyboardInfos.labelSymbol
KeyboardId.ELEMENT_SYMBOLS -> params.mLocaleKeyboardInfos.getShiftSymbolLabel(Settings.getInstance().isTablet)
KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED, KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED,
KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED, KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED -> "!icon/${KeyboardIconsSet.NAME_SHIFT_KEY_SHIFTED}"
KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED, KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED -> "!icon/${KeyboardIconsSet.NAME_SHIFT_KEY_SHIFTED}"
KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED, KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED -> "!icon/${KeyboardIconsSet.NAME_SHIFT_KEY_LOCKED}"

else -> "!icon/${KeyboardIconsSet.NAME_SHIFT_KEY}"
}
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/res/drawable/sym_keyboard_shift_lock_holo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The Android Open Source Project
SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="28dp"
android:width="28dp"
android:viewportHeight="1350"
android:viewportWidth="1350">
<path
android:fillColor="#FFF"
android:pathData="m 601.3,272.3 c -38.6,38.6 -164.2,164.2 -279.2,279.1 -114.9,115 -208.8,209.3 -208.5,209.8 0.3,0.4 62.5,0.8 138.3,0.8 114.5,0 138,0.2 139,1.3 0.8,1 1.2,46.8 1.3,167.8 l 0.3,166.4 279.9,0.3 c 168.5,0.1 280.2,-0.2 280.5,-0.7 0.4,-0.5 0.8,-75.8 1,-167.3 0.2,-123.5 0.6,-166.5 1.5,-167 0.6,-0.4 63.1,-0.8 138.9,-0.8 121.7,0 137.8,-0.2 137.5,-1.5 -0.2,-0.8 -92.9,-94.1 -206,-207.2 -281.9,-282 -351.6,-351.3 -353,-351.2 -0.7,0 -32.9,31.6 -71.5,70.2 z"/>
<path
android:fillColor="#FFF"
android:pathData="m 394.46818,1196.519 c 185.97108,0 371.94217,0 557.91325,0 4.43537,5.1448 0.94283,14.6315 2.05503,21.5558 0,30.2653 0,60.5307 0,90.796 -5.14471,4.4353 -14.63146,0.9428 -21.55572,2.055 -179.47085,0 -358.94171,0 -538.41256,0 -4.43538,-5.1446 -0.94282,-14.6314 -2.05503,-21.5557 0,-30.2653 0,-60.5307 0,-90.796 l 0.60058,-1.4545 z"/>
</vector>
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/sym_keyboard_shift_lock_lxx.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: Material Design Authors / Google LLC
SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FFF"
android:pathData="M240,720v-80h480v80L240,720ZM480,224 L720,464 664,520 480,336 296,520 240,464 480,224Z"/>
</vector>
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/sym_keyboard_shift_lock_rounded.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: Material Design Authors / Google LLC
SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FFF"
android:pathData="M280,720Q263,720 251.5,708.5Q240,697 240,680Q240,663 251.5,651.5Q263,640 280,640L680,640Q697,640 708.5,651.5Q720,663 720,680Q720,697 708.5,708.5Q697,720 680,720L280,720ZM480,336L324,492Q313,503 296,503Q279,503 268,492Q257,481 257,464Q257,447 268,436L452,252Q464,240 480,240Q496,240 508,252L692,436Q703,447 703,464Q703,481 692,492Q681,503 664,503Q647,503 636,492L480,336Z"/>
</vector>
8 changes: 4 additions & 4 deletions app/src/main/res/drawable/sym_keyboard_shift_lxx.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!--
icon available in Android Studio
SPDX-FileCopyrightText: Material Design Authors / Google LLC
SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportHeight="24"
android:viewportWidth="24" >
android:viewportHeight="960"
android:viewportWidth="960" >
<path android:fillColor="#FFF"
android:pathData="M12,8.41L16.59,13 18,11.59l-6,-6 -6,6L7.41,13 12,8.41zM6,18h12v-2H6v2z"/>
android:pathData="m480,332 l240,240 -56,56 -184,-184 -184,184 -56,-56z"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/sym_keyboard_shift_rounded.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
android:viewportHeight="960">
<path
android:fillColor="#FFF"
android:pathData="M280,720Q263,720 251.5,708.5Q240,697 240,680Q240,663 251.5,651.5Q263,640 280,640L680,640Q697,640 708.5,651.5Q720,663 720,680Q720,697 708.5,708.5Q697,720 680,720L280,720ZM480,336L324,492Q313,503 296,503Q279,503 268,492Q257,481 257,464Q257,447 268,436L452,252Q464,240 480,240Q496,240 508,252L692,436Q703,447 703,464Q703,481 692,492Q681,503 664,503Q647,503 636,492L480,336Z"/>
android:pathData="m508.62,360.62 l182.77,182.77a40.47,40.47 90,0 1,0 57.23,39.61 39.61,1.26 0,1 -56,-1.23L480,444 324.62,599.38a40.47,40.47 0,0 1,-57.23 0,39.61 39.61,91.26 0,1 1.23,-56l182.77,-182.77a40.47,40.47 0,0 1,57.23 0z"/>
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
<attr name="iconIncognitoKey" format="reference" />
<attr name="iconSpaceKeyForNumberLayout" format="reference" />
<attr name="iconShiftKeyShifted" format="reference" />
<attr name="iconShiftKeyLocked" format="reference" />
<attr name="iconShortcutKeyDisabled" format="reference" />
<attr name="iconLanguageSwitchKey" format="reference" />
<attr name="iconAutoCorrect" format="reference" />
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/keyboard-icons-holo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo</item>
<item name="iconIncognitoKey">@drawable/sym_keyboard_incognito_holo</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_holo</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_locked_holo</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shifted_holo</item>
<item name="iconShiftKeyLocked">@drawable/sym_keyboard_shift_lock_holo</item>
<item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo</item>
<item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch</item>
<item name="iconAutoCorrect">@drawable/ic_autocorrect</item>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/keyboard-icons-lxx-light.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_lxx</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_lxx</item>
<item name="iconShiftKeyLocked">@drawable/sym_keyboard_shift_lock_lxx</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_lxx</item>
<item name="iconTabKey">@drawable/sym_keyboard_tab_lxx</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_lxx</item>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/keyboard-icons-rounded.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_rounded</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_rounded</item>
<item name="iconShiftKeyLocked">@drawable/sym_keyboard_shift_lock_rounded</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_rounded</item>
<item name="iconTabKey">@drawable/sym_keyboard_tab_rounded</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_rounded</item>
Expand Down

0 comments on commit bb3fe9d

Please sign in to comment.