Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated shift key icon #980

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions app/src/main/java/helium314/keyboard/keyboard/KeyboardView.java
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ else if (key.hasActionKeyBackground())
iconY = (keyHeight - iconHeight) / 2; // Align vertically center.
}
final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center.
setKeyIconColor(key, icon, keyboard);
setKeyIconColor(key, icon);
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
}

Expand Down Expand Up @@ -603,18 +603,9 @@ public void deallocateMemory() {
freeOffscreenBuffer();
}

private void setKeyIconColor(Key key, Drawable icon, Keyboard keyboard) {
private void setKeyIconColor(Key key, Drawable icon) {
if (key.isAccentColored()) {
mColors.setColor(icon, ColorType.ACTION_KEY_ICON);
} else if (key.isShift() && keyboard != null) {
if (keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED
)
mColors.setColor(icon, ColorType.SHIFT_KEY_ICON);
else
mColors.setColor(icon, ColorType.KEY_ICON); // normal key if not shifted
} else if (key.getBackgroundType() != Key.BACKGROUND_TYPE_NORMAL) {
mColors.setColor(icon, ColorType.KEY_ICON);
} else if (this instanceof PopupKeysKeyboardView) {
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/java/helium314/keyboard/latin/common/Colors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override
}

override fun get(color: ColorType): Int = when (color) {
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND, CLIPBOARD_PIN -> accent
AUTOFILL_BACKGROUND_CHIP, GESTURE_PREVIEW, POPUP_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground
TOOL_BAR_EXPAND_KEY_BACKGROUND -> if (!isNight) accent else doubleAdjustedBackground
GESTURE_TRAIL -> gesture
Expand Down Expand Up @@ -323,7 +322,7 @@ class DynamicColors(context: Context, override val themeStyle: String, override
}

private fun getColorFilter(color: ColorType): ColorFilter? = when (color) {
EMOJI_CATEGORY_SELECTED, CLIPBOARD_PIN, SHIFT_KEY_ICON -> accentColorFilter
EMOJI_CATEGORY_SELECTED, CLIPBOARD_PIN -> accentColorFilter
REMOVE_SUGGESTION_ICON, EMOJI_CATEGORY, KEY_TEXT,
KEY_ICON, ONE_HANDED_MODE_BUTTON, TOOL_BAR_KEY, TOOL_BAR_EXPAND_KEY -> keyTextFilter
KEY_PREVIEW -> adjustedBackgroundFilter
Expand Down Expand Up @@ -464,8 +463,7 @@ class DefaultColors (
}

override fun get(color: ColorType): Int = when (color) {
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND,
CLIPBOARD_PIN, SHIFT_KEY_ICON -> accent
TOOL_BAR_KEY_ENABLED_BACKGROUND, EMOJI_CATEGORY_SELECTED, ACTION_KEY_BACKGROUND, CLIPBOARD_PIN -> accent
AUTOFILL_BACKGROUND_CHIP -> if (themeStyle == STYLE_MATERIAL && !hasKeyBorders) background else adjustedBackground
GESTURE_PREVIEW, POPUP_KEYS_BACKGROUND, MORE_SUGGESTIONS_BACKGROUND, KEY_PREVIEW -> adjustedBackground
TOOL_BAR_EXPAND_KEY_BACKGROUND, CLIPBOARD_SUGGESTION_BACKGROUND -> doubleAdjustedBackground
Expand Down Expand Up @@ -539,7 +537,7 @@ class DefaultColors (
}

private fun getColorFilter(color: ColorType): ColorFilter? = when (color) {
EMOJI_CATEGORY_SELECTED, CLIPBOARD_PIN, SHIFT_KEY_ICON -> accentColorFilter
EMOJI_CATEGORY_SELECTED, CLIPBOARD_PIN -> accentColorFilter
KEY_TEXT, KEY_ICON -> keyTextFilter
REMOVE_SUGGESTION_ICON, EMOJI_CATEGORY, ONE_HANDED_MODE_BUTTON, TOOL_BAR_KEY, TOOL_BAR_EXPAND_KEY -> suggestionTextFilter
KEY_PREVIEW -> adjustedBackgroundFilter
Expand Down Expand Up @@ -653,7 +651,6 @@ enum class ColorType {
MORE_SUGGESTIONS_WORD_BACKGROUND,
POPUP_KEYS_BACKGROUND,
NAVIGATION_BAR,
SHIFT_KEY_ICON,
SPACE_BAR_BACKGROUND,
SPACE_BAR_TEXT,
ONE_HANDED_MODE_BUTTON,
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/res/drawable/sym_keyboard_shift_lock_lxx.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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"/>
<path android:fillColor="#FFF"
android:pathData="M320,720L320,520L120,520L480,80L840,520L640,520L640,720L320,720ZM160,880L160,800L800,800L800,880L160,880Z"/>
</vector>
5 changes: 2 additions & 3 deletions app/src/main/res/drawable/sym_keyboard_shift_lock_rounded.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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"/>
<path android:fillColor="#FFF"
android:pathData="M320,680L320,520L204,520Q178,520 167.5,497.5Q157,475 173,455L449,118Q461,103 480,103Q499,103 511,118L787,455Q803,475 792.5,497.5Q782,520 756,520L640,520L640,680Q640,697 628.5,708.5Q617,720 600,720L360,720Q343,720 331.5,708.5Q320,697 320,680ZM200,880Q183,880 171.5,868.5Q160,857 160,840Q160,823 171.5,811.5Q183,800 200,800L760,800Q777,800 788.5,811.5Q800,823 800,840Q800,857 788.5,868.5Q777,880 760,880L200,880Z"/>
</vector>
16 changes: 12 additions & 4 deletions app/src/main/res/drawable/sym_keyboard_shift_lxx.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:drawable="@drawable/ic_arrow_left">
</rotate>
<!--
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="M320,840L320,520L120,520L480,80L840,520L640,520L640,840L320,840ZM400,760L560,760L560,440L671,440L480,206L289,440L400,440L400,760ZM480,440L480,440L480,440L480,440L480,440L480,440L480,440Z"/>
</vector>
16 changes: 12 additions & 4 deletions app/src/main/res/drawable/sym_keyboard_shift_rounded.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:drawable="@drawable/ic_arrow_left_rounded">
</rotate>
<!--
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="M320,800L320,520L204,520Q178,520 167.5,497.5Q157,475 173,455L449,118Q461,103 480,103Q499,103 511,118L787,455Q803,475 792.5,497.5Q782,520 756,520L640,520L640,800Q640,817 628.5,828.5Q617,840 600,840L360,840Q343,840 331.5,828.5Q320,817 320,800ZM400,760L560,760L560,440L671,440L480,206L289,440L400,440L400,760ZM480,440L480,440L480,440L480,440L480,440L480,440L480,440Z"/>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/sym_keyboard_shifted_lxx.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?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="M320,840L320,520L120,520L480,80L840,520L640,520L640,840L320,840Z"/>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/sym_keyboard_shifted_rounded.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?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="M320,800L320,520L204,520Q178,520 167.5,497.5Q157,475 173,455L449,118Q461,103 480,103Q499,103 511,118L787,455Q803,475 792.5,497.5Q782,520 756,520L640,520L640,800Q640,817 628.5,828.5Q617,840 600,840L360,840Q343,840 331.5,828.5Q320,817 320,800Z"/>
</vector>
5 changes: 2 additions & 3 deletions app/src/main/res/values/keyboard-icons-holo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->

<resources>
<style name="KeyboardIcons.Holo">
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_holo</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shifted_holo</item>
<item name="iconShiftKeyLocked">@drawable/sym_keyboard_shift_lock_holo</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo</item>
<item name="iconSpaceKey">@null</item>
Expand All @@ -18,8 +19,6 @@
<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_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
3 changes: 1 addition & 2 deletions app/src/main/res/values/keyboard-icons-lxx-light.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->

<resources>
<style name="KeyboardIcons.LXX_Light">
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_lxx</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_lxx</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shifted_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>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/keyboard-icons-rounded.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<style name="KeyboardIcons.Rounded">
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_rounded</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_rounded</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shifted_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>
Expand Down