diff --git a/app/src/main/java/io/github/sspanak/tt9/ime/UiHandler.java b/app/src/main/java/io/github/sspanak/tt9/ime/UiHandler.java index c94278d4..fd37faff 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ime/UiHandler.java +++ b/app/src/main/java/io/github/sspanak/tt9/ime/UiHandler.java @@ -53,7 +53,7 @@ abstract class UiHandler extends AbstractHandler { protected void setStatusIcon(InputMode mode) { if (!InputModeKind.isPassthrough(mode) && settings.isStatusIconEnabled()) { - showStatusIcon(R.drawable.ic_status); + showStatusIcon(R.drawable.ic_keyboard); } else { hideStatusIcon(); } diff --git a/app/src/main/java/io/github/sspanak/tt9/preferences/screens/appearance/ItemNumpadWidth.java b/app/src/main/java/io/github/sspanak/tt9/preferences/screens/appearance/ItemNumpadWidth.java index a648498e..0b9b70c6 100644 --- a/app/src/main/java/io/github/sspanak/tt9/preferences/screens/appearance/ItemNumpadWidth.java +++ b/app/src/main/java/io/github/sspanak/tt9/preferences/screens/appearance/ItemNumpadWidth.java @@ -29,7 +29,7 @@ public class ItemNumpadWidth extends ItemDropDown { options.put(100, "100 %"); super.populateIntegers(options); - float currentValue = 100f * settings.getNumpadWidth() / settings.getNumpadMaxWidth(); + float currentValue = settings.getNumpadWidthPercent(); currentValue = Math.round(currentValue / 5f) * 5f; currentValue = Math.max(Math.min(currentValue, 100f), 50f); diff --git a/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsStore.java b/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsStore.java index 77178189..4b8f823f 100644 --- a/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsStore.java +++ b/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsStore.java @@ -24,14 +24,11 @@ public class SettingsStore extends SettingsUI { public final static byte SLOW_QUERY_TIME = 50; // ms public final static int SLOW_QUERY_TIMEOUT = 3000; // ms public final static float SOFT_KEY_AMOUNT_OF_KEY_SIZE_FOR_SWIPE = 0.5f; // 1 = full key size + public final static float SOFT_KEY_CONTENT_DEFAULT_SCALE = 1.15f; // % / 100 public final static int SOFT_KEY_DOUBLE_CLICK_DELAY = 500; // ms public final static int SOFT_KEY_REPEAT_DELAY = 40; // ms public final static int SOFT_KEY_TITLE_MAX_CHARS = 5; public final static int SOFT_KEY_TITLE_MAX_CHARS_INDIC = 3; - public final static int SOFT_KEY_TITLE_SIZE = 18; // sp - public final static float SOFT_KEY_COMPLEX_LABEL_TITLE_RELATIVE_SIZE = 0.55f; - public final static float SOFT_KEY_COMPLEX_LABEL_ARABIC_TITLE_RELATIVE_SIZE = 0.72f; - public final static float SOFT_KEY_COMPLEX_LABEL_SUB_TITLE_RELATIVE_SIZE = 0.8f; public final static int SUGGESTIONS_MAX = 20; public final static int SUGGESTIONS_MIN = 8; public final static int SUGGESTIONS_POSITIONS_LIMIT = 100; diff --git a/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsUI.java b/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsUI.java index e5f512c7..3fc8187d 100644 --- a/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsUI.java +++ b/app/src/main/java/io/github/sspanak/tt9/preferences/settings/SettingsUI.java @@ -84,7 +84,11 @@ public class SettingsUI extends SettingsTyping { } public int getNumpadWidth() { - return getStringifiedInt("pref_numpad_width", 100) * getNumpadMaxWidth() / 100; + return getNumpadWidthPercent() * getNumpadMaxWidth() / 100; + } + + public int getNumpadWidthPercent() { + return getStringifiedInt("pref_numpad_width", 100); } public int getSettingsFontSize() { diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/MainLayoutNumpad.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/MainLayoutNumpad.java index c2d7cd43..2cc6cb66 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/MainLayoutNumpad.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/MainLayoutNumpad.java @@ -4,24 +4,19 @@ import android.content.res.Resources; import android.os.Build; import android.view.View; import android.view.ViewGroup; +import android.view.ViewParent; import android.widget.LinearLayout; +import android.widget.RelativeLayout; import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; import java.util.ArrayList; -import java.util.Arrays; import io.github.sspanak.tt9.R; import io.github.sspanak.tt9.hacks.DeviceInfo; import io.github.sspanak.tt9.ime.TraditionalT9; -import io.github.sspanak.tt9.languages.LanguageKind; import io.github.sspanak.tt9.ui.main.keys.SoftKey; -import io.github.sspanak.tt9.ui.main.keys.SoftKeyFn; -import io.github.sspanak.tt9.ui.main.keys.SoftKeyNumber; -import io.github.sspanak.tt9.ui.main.keys.SoftKeyNumber0; -import io.github.sspanak.tt9.ui.main.keys.SoftKeyNumber1; -import io.github.sspanak.tt9.ui.main.keys.SoftKeyPunctuation; +import io.github.sspanak.tt9.ui.main.keys.SoftKeyArrow; import io.github.sspanak.tt9.ui.main.keys.SoftKeySettings; class MainLayoutNumpad extends BaseMainLayout { @@ -44,45 +39,6 @@ class MainLayoutNumpad extends BaseMainLayout { } } - private int getBackgroundColor(@NonNull View contextView, boolean dark) { - return ContextCompat.getColor( - contextView.getContext(), - dark ? R.color.dark_numpad_background : R.color.numpad_background - ); - } - - - private int getSeparatorColor(@NonNull View contextView, boolean dark) { - return ContextCompat.getColor( - contextView.getContext(), - dark ? R.color.dark_numpad_separator : R.color.numpad_separator - ); - } - - - @Override - void setDarkTheme(boolean dark) { - if (view == null) { - return; - } - - // background - view.setBackgroundColor(getBackgroundColor(view, dark)); - - // text - for (SoftKey key : getKeys()) { - key.setDarkTheme(dark); - } - - // separators - int separatorColor = getSeparatorColor(view, dark); - for (View separator : getSeparators()) { - if (separator != null) { - separator.setBackgroundColor(separatorColor); - } - } - } - @Override void showCommandPalette() {} @Override void hideCommandPalette() {} @@ -92,36 +48,28 @@ class MainLayoutNumpad extends BaseMainLayout { @Override void showTextEditingPalette() { isTextEditingShown = true; - boolean notKorean = tt9 != null && !LanguageKind.isKorean(tt9.getLanguage()); + + view.findViewById(R.id.numpad_column_1).setVisibility(LinearLayout.GONE); + view.findViewById(R.id.numpad_column_2).setVisibility(LinearLayout.GONE); + view.findViewById(R.id.numpad_column_3).setVisibility(LinearLayout.GONE); + + view.findViewById(R.id.numpad_column_101).setVisibility(LinearLayout.VISIBLE); + view.findViewById(R.id.numpad_column_102).setVisibility(LinearLayout.VISIBLE); + view.findViewById(R.id.numpad_column_103).setVisibility(LinearLayout.VISIBLE); for (SoftKey key : getKeys()) { int keyId = key.getId(); - if (keyId == R.id.soft_key_0) { - key.setEnabled(tt9 != null && !tt9.isInputModeNumeric() && notKorean); - } else if (key.getClass().equals(SoftKeyNumber.class) || key instanceof SoftKeyNumber0 || key instanceof SoftKeyNumber1) { - key.setVisibility(View.GONE); - } - - if (key.getClass().equals(SoftKeyPunctuation.class)) { - key.setVisibility(View.INVISIBLE); - } - - if (key.getClass().equals(SoftKeyFn.class)) { - key.setVisibility(View.VISIBLE); - } - - if (keyId == R.id.soft_key_rf3) { - key.render(); - } - if ( keyId == R.id.soft_key_add_word - || keyId == R.id.soft_key_lf3 + || keyId == R.id.soft_key_filter + || keyId == R.id.soft_key_shift + || keyId == R.id.soft_key_rf3 || keyId == R.id.soft_key_lf4 - || (keyId == R.id.soft_key_filter_suggestions && notKorean) + || keyId == R.id.soft_key_0 + || keyId == R.id.soft_key_100 ) { - key.setEnabled(false); + key.render(); } } } @@ -130,30 +78,27 @@ class MainLayoutNumpad extends BaseMainLayout { void hideTextEditingPalette() { isTextEditingShown = false; + view.findViewById(R.id.numpad_column_1).setVisibility(LinearLayout.VISIBLE); + view.findViewById(R.id.numpad_column_2).setVisibility(LinearLayout.VISIBLE); + view.findViewById(R.id.numpad_column_3).setVisibility(LinearLayout.VISIBLE); + + view.findViewById(R.id.numpad_column_101).setVisibility(LinearLayout.GONE); + view.findViewById(R.id.numpad_column_102).setVisibility(LinearLayout.GONE); + view.findViewById(R.id.numpad_column_103).setVisibility(LinearLayout.GONE); + for (SoftKey key : getKeys()) { - if (key.getClass().equals(SoftKeyNumber.class) || key.getClass().equals(SoftKeyPunctuation.class) || key instanceof SoftKeyNumber0 || key instanceof SoftKeyNumber1) { - key.setVisibility(View.VISIBLE); - key.setEnabled(true); - } - - if (key.getClass().equals(SoftKeyFn.class)) { - key.setVisibility(View.GONE); - } - - int keyId = key.getId(); - if (keyId == R.id.soft_key_rf3) { - key.render(); - } - if ( keyId == R.id.soft_key_add_word - || keyId == R.id.soft_key_lf3 + || keyId == R.id.soft_key_filter + || keyId == R.id.soft_key_shift + || keyId == R.id.soft_key_rf3 || keyId == R.id.soft_key_lf4 - || keyId == R.id.soft_key_filter_suggestions + || keyId == R.id.soft_key_0 + || keyId == R.id.soft_key_100 ) { - key.setEnabled(true); + key.render(); } } } @@ -188,15 +133,28 @@ class MainLayoutNumpad extends BaseMainLayout { return; } - ViewGroup table = view.findViewById(R.id.main_soft_keys); - int tableRowsCount = table.getChildCount(); + for (SoftKey key : getKeys()) { + if ((key instanceof SoftKeyArrow)) { + continue; + } - for (int rowId = 0; rowId < tableRowsCount; rowId++) { - View row = table.getChildAt(rowId); - ViewGroup.LayoutParams layout = row.getLayoutParams(); + // adjust the key height + ViewGroup.LayoutParams layout = key.getLayoutParams(); if (layout != null) { layout.height = height; - row.setLayoutParams(layout); + key.setLayoutParams(layout); + } + + // adjust the overlay height (if it exists) + ViewParent parent = key.getParent(); + if (!(parent instanceof RelativeLayout)) { + continue; + } + + layout = ((RelativeLayout) parent).getLayoutParams(); + if (layout != null) { + layout.height = height; + ((RelativeLayout) parent).setLayoutParams(layout); } } } @@ -206,7 +164,7 @@ class MainLayoutNumpad extends BaseMainLayout { if (height <= 0 || forceRecalculate) { Resources resources = tt9.getResources(); height = getKeyHeightCompat() * 4 - + resources.getDimensionPixelSize(R.dimen.numpad_candidate_height) + + resources.getDimensionPixelSize(R.dimen.numpad_suggestion_height) + Math.round(resources.getDimension(R.dimen.numpad_padding_bottom)) + getBottomInsetSize(); } @@ -265,37 +223,47 @@ class MainLayoutNumpad extends BaseMainLayout { return keys; } - ViewGroup table = view.findViewById(R.id.main_soft_keys); - int tableRowsCount = table.getChildCount(); + ViewGroup statusBar = view.findViewById(R.id.status_bar_container); + keys.add(statusBar.findViewById(R.id.soft_key_left_arrow)); + keys.add(statusBar.findViewById(R.id.soft_key_right_arrow)); - for (int rowId = 0; rowId < tableRowsCount; rowId++) { - View row = table.getChildAt(rowId); - if (row instanceof ViewGroup) { - keys.addAll(getKeysFromContainer((ViewGroup) row)); - } - } + ViewGroup table = view.findViewById(R.id.main_soft_keys); + keys.add(table.findViewById(R.id.soft_key_settings)); + keys.add(table.findViewById(R.id.soft_key_add_word)); + keys.add(table.findViewById(R.id.soft_key_shift)); + keys.add(table.findViewById(R.id.soft_key_lf4)); + + keys.add(table.findViewById(R.id.soft_key_numpad_backspace)); + keys.add(table.findViewById(R.id.soft_key_filter)); + keys.add(table.findViewById(R.id.soft_key_rf3)); + keys.add(table.findViewById(R.id.soft_key_numpad_ok)); + + keys.add(table.findViewById(R.id.soft_key_0)); + keys.add(table.findViewById(R.id.soft_key_1)); + keys.add(table.findViewById(R.id.soft_key_2)); + keys.add(table.findViewById(R.id.soft_key_3)); + keys.add(table.findViewById(R.id.soft_key_4)); + keys.add(table.findViewById(R.id.soft_key_5)); + keys.add(table.findViewById(R.id.soft_key_6)); + keys.add(table.findViewById(R.id.soft_key_7)); + keys.add(table.findViewById(R.id.soft_key_8)); + keys.add(table.findViewById(R.id.soft_key_9)); + keys.add(table.findViewById(R.id.soft_key_punctuation_1)); + keys.add(table.findViewById(R.id.soft_key_punctuation_2)); + + keys.add(table.findViewById(R.id.soft_key_100)); + keys.add(table.findViewById(R.id.soft_key_101)); + keys.add(table.findViewById(R.id.soft_key_102)); + keys.add(table.findViewById(R.id.soft_key_103)); + keys.add(table.findViewById(R.id.soft_key_104)); + keys.add(table.findViewById(R.id.soft_key_105)); + keys.add(table.findViewById(R.id.soft_key_106)); + keys.add(table.findViewById(R.id.soft_key_107)); + keys.add(table.findViewById(R.id.soft_key_108)); + keys.add(table.findViewById(R.id.soft_key_109)); keys.addAll(getKeysFromContainer(view.findViewById(R.id.status_bar_container))); return keys; } - - - protected ArrayList getSeparators() { - // it's fine... it's shorter, faster and easier to read than searching with 3 nested loops - return new ArrayList<>(Arrays.asList( - view.findViewById(R.id.separator_top), - view.findViewById(R.id.separator_candidates_1), - view.findViewById(R.id.separator_candidates_2), - view.findViewById(R.id.separator_candidates_bottom), - view.findViewById(R.id.separator_1_1), - view.findViewById(R.id.separator_1_2), - view.findViewById(R.id.separator_2_1), - view.findViewById(R.id.separator_2_2), - view.findViewById(R.id.separator_3_1), - view.findViewById(R.id.separator_3_2), - view.findViewById(R.id.separator_4_1), - view.findViewById(R.id.separator_4_2) - )); - } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKey.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKey.java index 3f903abf..8d96c7e4 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKey.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKey.java @@ -1,13 +1,23 @@ package io.github.sspanak.tt9.ui.main.keys; import android.content.Context; +import android.graphics.Color; import android.graphics.Paint; +import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Looper; -import android.text.SpannableStringBuilder; +import android.text.SpannableString; +import android.text.style.RelativeSizeSpan; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; +import android.view.ViewParent; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.appcompat.content.res.AppCompatResources; import io.github.sspanak.tt9.ime.TraditionalT9; import io.github.sspanak.tt9.preferences.settings.SettingsStore; @@ -30,7 +40,9 @@ public class SoftKey extends com.google.android.material.button.MaterialButton i private static int lastPressedKey = -1; private boolean ignoreLastPressedKey = false; - private boolean isTitleDisabled = false; + private Drawable icon = null; + private Drawable holdIcon = null; + private RelativeLayout overlay = null; public SoftKey(Context context) { @@ -70,6 +82,16 @@ public class SoftKey extends com.google.android.material.button.MaterialButton i } + protected float getTT9Width() { + return tt9 != null ? tt9.getSettings().getNumpadWidthPercent() / 100f : 1; + } + + + protected float getTT9Height() { + return tt9 != null ? (float) tt9.getSettings().getNumpadKeyHeight() / (float) tt9.getSettings().getNumpadKeyDefaultHeight() : 1; + } + + @Override public boolean onTouch(View view, MotionEvent event) { super.onTouchEvent(event); @@ -159,14 +181,8 @@ public class SoftKey extends com.google.android.material.button.MaterialButton i } - public void setDarkTheme(boolean darkEnabled) { - } - - - @Override - public void setEnabled(boolean enabled) { - super.setEnabled(enabled); - setTextColor(getTextColors().withAlpha(enabled ? 255 : 80)); + public boolean isHoldEnabled() { + return true; } @@ -187,14 +203,56 @@ public class SoftKey extends com.google.android.material.button.MaterialButton i protected int getNoEmojiTitle() { return 0; } + protected int getCentralIcon() { + return -1; + } + + + protected int getHoldIcon() { + return -1; + } + + + protected void resetIconCache() { + icon = null; + holdIcon = null; + } + + /** - * getSubTitle - * Generates a String describing what the key does. - * For example: "ABC" for 2-key; "⌫" for Backspace key, "⚙" for Settings key, and so on. - * - * The sub title label is optional. + * Generates a String describing the "hold" function of the key. The String will be displayed + * in the upper right corner. */ - protected String getSubTitle() { + protected String getHoldText() { + return null; + } + + + /** + * Generates a String describing for the swipe up function of the key + */ + protected String getTopText() { + return null; + } + + /** + * Generates a String describing for the swipe right function of the key + */ + protected String getRightText() { + return null; + } + + /** + * Generates a String describing for the swipe down function of the key + */ + protected String getBottomText() { + return null; + } + + /** + * Generates a String describing for the swipe left function of the key + */ + protected String getLeftText() { return null; } @@ -218,59 +276,166 @@ public class SoftKey extends com.google.android.material.button.MaterialButton i /** - * Multiplier for the font size when there is only one label. + * A fail-safe method to get the central icon drawable. */ - protected float getSingleLabelRelativeSize() { - return 1; + private Drawable getIconCompat() { + if (icon == null && getCentralIcon() > 0) { + icon = AppCompatResources.getDrawable(getContext(), getCentralIcon()); + } + + return icon; } /** - * Multiplier for the title font size when there are two labels. + * A fail-safe method to get the hold icon drawable. */ - protected float getTitleRelativeSize() { - return SettingsStore.SOFT_KEY_COMPLEX_LABEL_TITLE_RELATIVE_SIZE; + private Drawable getHoldIconCompat() { + if (holdIcon == null && getHoldIcon() > 0) { + holdIcon = AppCompatResources.getDrawable(getContext(), getHoldIcon()); + } + + return holdIcon; } /** - * Multiplier for the subtitle font size when there are two labels. + * Multiplier for the main text font size. Used for automatically adjusting the font size to fit + * the key when changing the keyboard dimensions. */ - protected float getSubTitleRelativeSize() { - return SettingsStore.SOFT_KEY_COMPLEX_LABEL_SUB_TITLE_RELATIVE_SIZE; + protected float getTitleScale() { + return SettingsStore.SOFT_KEY_CONTENT_DEFAULT_SCALE * Math.min(getTT9Width(), getTT9Height()); } + /** + * Same as getTitleScale(), but for keys that have icons instead of text. + */ + protected float getCentralIconScale() { + float width = getTT9Width(); + return width > 0.95f ? Math.min(1.15f, getTT9Height()) : Math.min(width, getTT9Height()); + } + + + /** + * Similar to getTitleScale(), adjusts the font size of the hold text or icon + */ + protected float getHoldElementScale() { + return SettingsStore.SOFT_KEY_CONTENT_DEFAULT_SCALE * Math.min(1, getTT9Height()); + } + + + private void getOverlayWrapper() { + if (overlay == null) { + ViewParent parent = getParent(); + if (parent instanceof RelativeLayout) { + overlay = (RelativeLayout) parent; + } + } + } + /** * render - * Sets the key label using "getTitle()" and "getSubtitle()" or if they both - * return NULL, the XML "text" attribute will be preserved. - * - * If there is only name label, it will be centered and at normal font size. - * If there is also a function label, it will be displayed below the name label and both will - * have their font size adjusted to fit inside the key. + * Sets the key labels and icons using "getTitle()", "getCenterIcon()", "getHoldText()", + * "getTopText()", "getRightText()", "getHoldIcon()", etc. Also takes care of styling the labels + * depending on "isEnabled()" and "isHoldEnabled()". */ public void render() { - String title = getTitleCompat(); - String subtitle = getSubTitle(); + boolean isKeyEnabled = isEnabled(); + boolean isHoldEnabled = isHoldEnabled(); + renderTitle(isKeyEnabled); + + getOverlayWrapper(); + + renderOverlayDrawable("overlay_icon", getIconCompat(), getCentralIconScale(), isKeyEnabled); + + renderOverlayText("overlay_hold_text", getHoldText(), getHoldElementScale(), isKeyEnabled && isHoldEnabled); + renderOverlayDrawable("overlay_hold_icon", getHoldIconCompat(), getHoldElementScale(), isKeyEnabled && isHoldEnabled); + + renderOverlayText("overlay_top_text", getTopText(), getHoldElementScale(), isKeyEnabled); + renderOverlayText("overlay_right_text", getRightText(), getHoldElementScale(), isKeyEnabled); + renderOverlayText("overlay_bottom_text", getBottomText(), getHoldElementScale(), isKeyEnabled); + renderOverlayText("overlay_left_text", getLeftText(), getHoldElementScale(), isKeyEnabled); + } + + + /** + * Renders the central text of the key and styles it based on "isEnabled". + */ + private void renderTitle(boolean isEnabled) { + String title = getTitleCompat(); if (title == null) { return; } - SpannableStringBuilder sb = new SpannableStringBuilder(title); - if (subtitle != null) { - sb.append(" "); - sb.append(subtitle); + setTextColor(getTextColors().withAlpha(isEnabled ? 255 : 110)); + + float scale = getTitleScale(); + if (scale == 1) { + setText(title); + return; } - setText(sb); + SpannableString text = new SpannableString(title); + text.setSpan(new RelativeSizeSpan(scale), 0, title.length(), 0); + setText(text); } - protected void setTitleDisabled(boolean yes) { - isTitleDisabled = yes; + /** + * Renders text in the given overlay element, with optional scaling and alpha. The overlay + * text elements are either the "hold" text or the "swipe" text. + */ + private void renderOverlayText(String elementTag, @Nullable String text, float scale, boolean isEnabled) { + if (overlay == null) { + return; + } + + View element = ((RelativeLayout) getParent()).findViewWithTag(elementTag); + if (!(element instanceof TextView el)) { + return; + } + + el.setTextColor(el.getTextColors().withAlpha(isEnabled ? 255 : 110)); + + if (text == null || scale == 1) { + el.setText(text); + return; + } + + SpannableString scaledText = new SpannableString(text); + scaledText.setSpan(new RelativeSizeSpan(scale), 0, scaledText.length(), 0); + el.setText(scaledText); + } + + + /** + * Renders one of the key icons. It could be either the central icon, in the place of the main title, + * or a hold icon, displayed in the upper right corner. + */ + private void renderOverlayDrawable(String elementTag, @Nullable Drawable drawable, float scale, boolean isEnabled) { + if (overlay == null) { + return; + } + + View element = ((RelativeLayout) getParent()).findViewWithTag(elementTag); + if (!(element instanceof ImageView el)) { + return; + } + + el.setImageDrawable(drawable); + if (!isEnabled) { + el.setColorFilter(Color.GRAY); + } else { + el.clearColorFilter(); + } + + if (drawable != null) { + el.setScaleX(scale); + el.setScaleY(scale); + } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyAddWord.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyAddWord.java index d21f83af..3f5ad616 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyAddWord.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyAddWord.java @@ -3,12 +3,17 @@ package io.github.sspanak.tt9.ui.main.keys; import android.content.Context; import android.util.AttributeSet; +import io.github.sspanak.tt9.R; + public class SoftKeyAddWord extends SoftKey { public SoftKeyAddWord(Context context) { super(context); } public SoftKeyAddWord(Context context, AttributeSet attrs) { super(context, attrs); } public SoftKeyAddWord(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } - @Override protected String getTitle() { return "+"; } + @Override + protected int getCentralIcon() { + return R.drawable.ic_fn_add_word; + } @Override protected boolean handleRelease() { @@ -22,9 +27,9 @@ public class SoftKeyAddWord extends SoftKey { @Override public void render() { - super.render(); if (tt9 != null) { - setEnabled(!tt9.isVoiceInputActive() && tt9.notLanguageSyllabary()); + setEnabled(!tt9.isVoiceInputActive() && tt9.notLanguageSyllabary() && !tt9.isTextEditingActive()); } + super.render(); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyBackspace.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyBackspace.java index 1b6f9556..50c59d89 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyBackspace.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyBackspace.java @@ -141,6 +141,12 @@ public class SoftKeyBackspace extends SwipeableKey { } + @Override + protected float getTitleScale() { + return tt9 != null && tt9.getSettings().isMainLayoutNumpad() ? super.getTitleScale() : SettingsStore.SOFT_KEY_CONTENT_DEFAULT_SCALE; + } + + @Override protected int getNoEmojiTitle() { return R.string.virtual_key_del; diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFText.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFText.java new file mode 100644 index 00000000..cf61e87c --- /dev/null +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFText.java @@ -0,0 +1,42 @@ +package io.github.sspanak.tt9.ui.main.keys; + +import android.content.Context; +import android.util.AttributeSet; + +import io.github.sspanak.tt9.R; + +public class SoftKeyFText extends SoftKeyFn { + public SoftKeyFText(Context context) { + super(context); + } + + public SoftKeyFText(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public SoftKeyFText(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + protected String getTitle() { + return ""; + } + + @Override + protected int getCentralIcon() { + int keyId = getId(); + + if (keyId == R.id.soft_key_101) return R.drawable.ic_dpad_left; + if (keyId == R.id.soft_key_102) return R.drawable.ic_txt_select_none; + if (keyId == R.id.soft_key_103) return R.drawable.ic_dpad_right; + if (keyId == R.id.soft_key_104) return R.drawable.ic_txt_word_back; + if (keyId == R.id.soft_key_105) return R.drawable.ic_txt_select_all; + if (keyId == R.id.soft_key_106) return R.drawable.ic_txt_word_forward; + if (keyId == R.id.soft_key_107) return R.drawable.ic_txt_cut; + if (keyId == R.id.soft_key_108) return R.drawable.ic_txt_copy; + if (keyId == R.id.soft_key_109) return R.drawable.ic_txt_paste; + + return -1; + } +} diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFilter.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFilter.java index 59ed942d..0a874a37 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFilter.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFilter.java @@ -2,6 +2,7 @@ package io.github.sspanak.tt9.ui.main.keys; import android.content.Context; import android.util.AttributeSet; +import android.view.Gravity; import io.github.sspanak.tt9.languages.LanguageKind; import io.github.sspanak.tt9.ui.Vibration; @@ -12,17 +13,10 @@ public class SoftKeyFilter extends SoftKey { public SoftKeyFilter(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override - protected float getTitleRelativeSize() { - return isKorean() ? 1.1f : super.getTitleRelativeSize() / 0.85f; + protected float getTitleScale() { + return isKorean() ? 1.5f * getTT9Height() : Math.min(getTT9Width(), getTT9Height()); } - - @Override - protected float getSubTitleRelativeSize() { - return super.getSubTitleRelativeSize() / 0.85f; - } - - private boolean isKorean() { return tt9 != null && LanguageKind.isKorean(tt9.getLanguage()); } @@ -59,26 +53,34 @@ public class SoftKeyFilter extends SoftKey { @Override protected String getTitle() { - return isKorean() ? "␣" : "CLR"; + return isKorean() ? "␣" : "FLTR"; } @Override - protected String getSubTitle() { - return isKorean() ? null : "FLTR"; + protected String getHoldText() { + return isKorean() ? null : "CLR"; } @Override public void render() { - super.render(); + setGravity( + isKorean() ? Gravity.TOP | Gravity.CENTER_HORIZONTAL: Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL + ); + if (tt9 != null) { setEnabled( !tt9.isInputModeNumeric() && !tt9.isInputModeABC() && !tt9.isVoiceInputActive() - && (LanguageKind.isKorean(tt9.getLanguage()) || tt9.notLanguageSyllabary()) + && ( + LanguageKind.isKorean(tt9.getLanguage()) + || (tt9.notLanguageSyllabary() && !tt9.isTextEditingActive()) + ) ); } + + super.render(); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFn.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFn.java index 48be1b47..1ecf0186 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFn.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyFn.java @@ -12,7 +12,11 @@ public class SoftKeyFn extends SoftKeyNumber { @Override protected void handleHold() { preventRepeat(); } @Override protected String getTitle() { return getNumber(getId()) + ""; } - @Override protected String getSubTitle() { return null; } + + @Override + protected float getTitleScale() { + return 1; + } @Override protected int getNumber(int keyId) { diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyLF4.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyLF4.java index 93004ed9..8a180a36 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyLF4.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyLF4.java @@ -2,6 +2,7 @@ package io.github.sspanak.tt9.ui.main.keys; import android.content.Context; import android.util.AttributeSet; +import android.view.Gravity; import io.github.sspanak.tt9.R; import io.github.sspanak.tt9.ui.Vibration; @@ -11,14 +12,10 @@ public class SoftKeyLF4 extends SwipeableKey { public SoftKeyLF4(Context context, AttributeSet attrs) { super(context, attrs); } public SoftKeyLF4(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } - @Override protected float getTitleRelativeSize() { return super.getTitleRelativeSize() / 0.85f; } - @Override protected float getSubTitleRelativeSize() { return super.getSubTitleRelativeSize() / 0.85f; } - private boolean areThereManyLanguages() { return tt9 != null && tt9.getSettings().getEnabledLanguageIds().size() > 1; } - @Override protected void handleHold() { preventRepeat(); @@ -46,34 +43,42 @@ public class SoftKeyLF4 extends SwipeableKey { } } - protected String getHoldIcon() { - return "🌐"; - } - - protected String getPressIcon() { + @Override + protected String getTitle() { return tt9 != null ? tt9.getInputModeName() : getContext().getString(R.string.virtual_key_input_mode); } @Override - protected String getTitle() { - return areThereManyLanguages() ? getHoldIcon() : getPressIcon(); + protected int getHoldIcon() { + return areThereManyLanguages() ? R.drawable.ic_fn_next_language : -1; } @Override - protected String getSubTitle() { - return areThereManyLanguages() ? getPressIcon() : null; + protected float getHoldElementScale() { + return super.getHoldElementScale() * 0.8f; + } + + @Override + public boolean isHoldEnabled() { + return tt9 != null && !tt9.isInputModeNumeric(); } @Override public void render() { - setTitleDisabled(tt9 != null && tt9.isInputModeNumeric() && areThereManyLanguages()); - super.render(); + if (tt9 != null && tt9.isInputModeNumeric()) { + resetIconCache(); + } + + setGravity(areThereManyLanguages() ? Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM : Gravity.CENTER); setEnabled( tt9 != null && !tt9.isVoiceInputActive() && !tt9.isNumericModeStrict() && !tt9.isInputModePhone() + && !tt9.isTextEditingActive() ); + + super.render(); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber.java index fb7792c0..e76e2010 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber.java @@ -5,21 +5,10 @@ import android.util.AttributeSet; import android.util.SparseArray; import android.view.KeyEvent; -import androidx.annotation.NonNull; - -import java.util.ArrayList; -import java.util.Locale; - import io.github.sspanak.tt9.R; -import io.github.sspanak.tt9.ime.TraditionalT9; import io.github.sspanak.tt9.ime.helpers.Key; -import io.github.sspanak.tt9.ime.modes.InputMode; -import io.github.sspanak.tt9.languages.Language; import io.github.sspanak.tt9.languages.LanguageKind; -import io.github.sspanak.tt9.preferences.settings.SettingsStore; import io.github.sspanak.tt9.ui.Vibration; -import io.github.sspanak.tt9.util.Logger; -import io.github.sspanak.tt9.util.TextTools; public class SoftKeyNumber extends SoftKey { private final static SparseArray NUMBERS = new SparseArray<>() {{ @@ -45,28 +34,9 @@ public class SoftKeyNumber extends SoftKey { }}; - public SoftKeyNumber(Context context) { - super(context); - } - - public SoftKeyNumber(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public SoftKeyNumber(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - - private boolean isArabicNumber() { - return tt9 != null && !tt9.isInputModeNumeric() && LanguageKind.isArabic(tt9.getLanguage()); - } - - - @Override - protected float getTitleRelativeSize() { - return isArabicNumber() ? SettingsStore.SOFT_KEY_COMPLEX_LABEL_ARABIC_TITLE_RELATIVE_SIZE : SettingsStore.SOFT_KEY_COMPLEX_LABEL_TITLE_RELATIVE_SIZE; - } + public SoftKeyNumber(Context context) { super(context); } + public SoftKeyNumber(Context context, AttributeSet attrs) { super(context, attrs); } + public SoftKeyNumber(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override @@ -114,11 +84,8 @@ public class SoftKeyNumber extends SoftKey { } - @Override - protected String getTitle() { - int number = getNumber(getId()); - - if (isArabicNumber() && tt9.getLanguage() != null) { + protected String getLocalizedNumber(int number) { + if (isArabicNumber() && tt9 != null && tt9.getLanguage() != null) { return tt9.getLanguage().getKeyNumber(number); } else { return String.valueOf(number); @@ -127,96 +94,13 @@ public class SoftKeyNumber extends SoftKey { @Override - protected String getSubTitle() { - return tt9 == null ? null : getKeyCharList(tt9, getNumber(getId())); + protected float getHoldElementScale() { + float defaultScale = super.getHoldElementScale(); + return tt9 != null && LanguageKind.isArabic(tt9.getLanguage()) ? defaultScale * 1.25f : defaultScale; } - private String getKeyCharList(@NonNull TraditionalT9 tt9, int number) { - if (tt9.isInputModeNumeric()) { - return null; // no special labels in 123 mode - } - - Language language = tt9.getLanguage(); - if (language == null) { - Logger.d("SoftKeyNumber.getLabel", "Cannot generate a label when the language is NULL."); - return null; - } - - ArrayList chars = language.getKeyCharacters(number); - boolean isGreek = LanguageKind.isGreek(language); - boolean isLatinBased = LanguageKind.isLatinBased(language); - boolean isUppercase = tt9.getTextCase() == InputMode.CASE_UPPER; - final int maxChars = LanguageKind.isIndic(language) ? SettingsStore.SOFT_KEY_TITLE_MAX_CHARS_INDIC : SettingsStore.SOFT_KEY_TITLE_MAX_CHARS; - - String displayChars = getDefaultCharList(chars, language.getLocale(), isGreek, isLatinBased, isUppercase); - if (displayChars.length() > maxChars) { - displayChars = abbreviateCharList(displayChars, language.getLocale(), isUppercase); - } - - return displayChars; - } - - - /** - * Joins the key characters into a single string, skipping accented characters - * when neccessary - */ - private String getDefaultCharList(ArrayList chars, Locale locale, boolean isGreek, boolean isLatinBased, boolean isUppercase) { - StringBuilder sb = new StringBuilder(); - for (String currentLetter : chars) { - if (shouldSkipAccents(currentLetter.charAt(0), isGreek, isLatinBased)) { - continue; - } - - sb.append( - isUppercase ? currentLetter.toUpperCase(locale) : currentLetter - ); - } - - return sb.toString(); - } - - - /** - * In some languages there are many characters for a single key. Naturally, they can not all fit - * on one key. As suggested by the community, we could display them as "A-Z". - * @see Issue #628 - */ - private String abbreviateCharList(String chars, Locale locale, boolean isUppercase) { - String firstLetter = chars.substring(0, 1); - String lastLetter = chars.substring(chars.length() - 1); - boolean containsCombiningChars = TextTools.isCombining(firstLetter) || TextTools.isCombining(lastLetter); - - return - (isUppercase ? firstLetter.toUpperCase(locale) : firstLetter) - + (containsCombiningChars ? "– " : "–") - + (isUppercase ? lastLetter.toUpperCase(locale) : lastLetter); - } - - - /** - * Reduces the number of displayed characters by leaving the most descriptive ones. This prevents - * the visual clutter on the keys. - */ - private boolean shouldSkipAccents(char currentLetter, boolean isGreek, boolean isLatinBased) { - return - // Latin. As suggested by the community, there is no need to display the accented letters. People are - // used to seeing just "ABC", "DEF", etc. - (isLatinBased && currentLetter > 'z') - // Cyrillic. Same as above. - || currentLetter == 'ѝ' || currentLetter == 'ґ' - // Korean double consonants - || (currentLetter == 'ㄲ' || currentLetter == 'ㄸ' || currentLetter == 'ㅃ' || currentLetter == 'ㅆ' || currentLetter == 'ㅉ') - // Greek diacritics and ending sigma - || currentLetter == 'ς' - || (isGreek && (currentLetter < 'α' || currentLetter > 'ω')) - // Hindi combining - || (currentLetter >= 0x0900 && currentLetter <= 0x0903) || (currentLetter >= 0x093A && currentLetter <= 0x094F) - || (currentLetter >= 0x0951 && currentLetter <= 0x0957) || currentLetter == 0x0962 || currentLetter == 0x0963 - // Gujarati combining - || (currentLetter >= 0x0A81 && currentLetter <= 0x0A83) || (currentLetter >= 0xABC && currentLetter <= 0x0ACD) - || currentLetter == 0x0AE2 || currentLetter == 0x0AE3 - ; + private boolean isArabicNumber() { + return tt9 != null && !tt9.isInputModeNumeric() && LanguageKind.isArabic(tt9.getLanguage()); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber0.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber0.java index a4eee7a0..7d834d1f 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber0.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber0.java @@ -13,13 +13,18 @@ public class SoftKeyNumber0 extends SoftKeyNumber { public SoftKeyNumber0(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override - protected String getTitle() { + protected int getNumber(int keyId) { + return 0; + } + + @Override + protected String getHoldText() { if (tt9 == null) { - return super.getTitle(); + return null; } - if (tt9.isNumericModeStrict()) { - return "0"; + if (tt9.isTextEditingActive() || tt9.isNumericModeStrict()) { + return ""; } if (tt9.isNumericModeSigned()) { return "+/-"; } else if (tt9.isInputModePhone()) { @@ -28,24 +33,16 @@ public class SoftKeyNumber0 extends SoftKeyNumber { return CHARS_NUMERIC_MODE; } - return super.getTitle(); + return super.getLocalizedNumber(getNumber(getId())); } @Override - protected String getSubTitle() { - if (tt9 == null) { - return null; + protected String getTitle() { + if (tt9 == null || tt9.isInputModeNumeric()) { + return "0"; } - if (tt9.isNumericModeStrict()) { - return null; - } else if (tt9.isInputModeNumeric()) { - return "0"; - } else if (LanguageKind.isKorean(tt9.getLanguage())) { - return getKoreanCharList(); - } else { - return "␣"; - } + return (LanguageKind.isKorean(tt9.getLanguage())) ? getKoreanCharList() : "␣"; } private String getKoreanCharList() { @@ -64,11 +61,31 @@ public class SoftKeyNumber0 extends SoftKeyNumber { } @Override - protected float getSubTitleRelativeSize() { + protected float getTitleScale() { if (tt9 != null && !tt9.isInputModeNumeric() && !LanguageKind.isKorean(tt9.getLanguage())) { - return 1.1f; + return 1.5f * getTT9Height(); } - return super.getSubTitleRelativeSize(); + return super.getTitleScale(); + } + + + @Override + public void render() { + if (tt9 != null && LanguageKind.isKorean(tt9.getLanguage()) && tt9.isTextEditingActive()) { + setVisibility(GONE); + } else { + setVisibility(VISIBLE); + } + + setEnabled( + tt9 != null + && ( + !tt9.isTextEditingActive() + || (!LanguageKind.isKorean(tt9.getLanguage()) && !tt9.isInputModeNumeric()) + ) + ); + + super.render(); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber1.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber1.java index 00a52e7a..b757c650 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber1.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber1.java @@ -16,33 +16,27 @@ public class SoftKeyNumber1 extends SoftKeyNumber { @Override protected String getTitle() { - if (tt9 == null) { - return super.getTitle(); - } - - if (tt9.isInputModeNumeric() && !tt9.isNumericModeStrict()) { - return DEFAULT_LARGE_LABEL; - } else if (LanguageKind.isKorean(tt9.getLanguage())) { - return KOREAN_SMALL_LABEL; - } else { + if (tt9 == null || tt9.isInputModeNumeric()) { return "1"; } + + return LanguageKind.isKorean(tt9.getLanguage()) ? KOREAN_LARGE_LABEL : DEFAULT_LARGE_LABEL; } @Override - protected String getSubTitle() { + protected String getHoldText() { if (tt9 == null || tt9.isNumericModeStrict()) { return null; } - if (tt9.isNumericModeStrict()) { - return null; - } else if (tt9.isInputModeNumeric()) { - return "1"; - } else if (LanguageKind.isKorean(tt9.getLanguage())) { - return KOREAN_LARGE_LABEL; - } else { + if (tt9.isInputModeNumeric()) { return DEFAULT_LARGE_LABEL; } + + if (LanguageKind.isKorean(tt9.getLanguage())) { + return KOREAN_SMALL_LABEL; + } + + return super.getLocalizedNumber(getNumber(getId())); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber2to9.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber2to9.java new file mode 100644 index 00000000..61d8af03 --- /dev/null +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyNumber2to9.java @@ -0,0 +1,128 @@ +package io.github.sspanak.tt9.ui.main.keys; + +import android.content.Context; +import android.util.AttributeSet; + +import androidx.annotation.NonNull; + +import java.util.ArrayList; +import java.util.Locale; + +import io.github.sspanak.tt9.ime.TraditionalT9; +import io.github.sspanak.tt9.ime.modes.InputMode; +import io.github.sspanak.tt9.languages.Language; +import io.github.sspanak.tt9.languages.LanguageKind; +import io.github.sspanak.tt9.preferences.settings.SettingsStore; +import io.github.sspanak.tt9.util.Logger; +import io.github.sspanak.tt9.util.TextTools; + +public class SoftKeyNumber2to9 extends SoftKeyNumber { + public SoftKeyNumber2to9(Context context) { super(context); } + public SoftKeyNumber2to9(Context context, AttributeSet attrs) { super(context, attrs); } + public SoftKeyNumber2to9(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } + + + @Override + protected String getHoldText() { + if (tt9 == null || tt9.isInputModeNumeric()) { + return null; + } + + return getLocalizedNumber(getNumber(getId())); + } + + + @Override + protected String getTitle() { + if (tt9 != null && !tt9.isInputModeNumeric()) { + return getKeyChars(tt9, getNumber(getId())); + } else { + return getLocalizedNumber(getNumber(getId())); + } + } + + + private String getKeyChars(@NonNull TraditionalT9 tt9, int number) { + Language language = tt9.getLanguage(); + if (language == null) { + Logger.d("SoftKeyNumber.getLabel", "Cannot generate a label when the language is NULL."); + return null; + } + + ArrayList chars = language.getKeyCharacters(number); + boolean isGreek = LanguageKind.isGreek(language); + boolean isLatinBased = LanguageKind.isLatinBased(language); + boolean isUppercase = tt9.getTextCase() == InputMode.CASE_UPPER; + final int maxChars = LanguageKind.isIndic(language) ? SettingsStore.SOFT_KEY_TITLE_MAX_CHARS_INDIC : SettingsStore.SOFT_KEY_TITLE_MAX_CHARS; + + String displayChars = getDefaultCharList(chars, language.getLocale(), isGreek, isLatinBased, isUppercase); + if (displayChars.length() > maxChars) { + displayChars = abbreviateCharList(displayChars, language.getLocale(), isUppercase); + } + + return displayChars; + } + + + /** + * Joins the key characters into a single string, skipping accented characters + * when neccessary + */ + private String getDefaultCharList(ArrayList chars, Locale locale, boolean isGreek, boolean isLatinBased, boolean isUppercase) { + StringBuilder sb = new StringBuilder(); + for (String currentLetter : chars) { + if (shouldSkipAccents(currentLetter.charAt(0), isGreek, isLatinBased)) { + continue; + } + + sb.append( + isUppercase ? currentLetter.toUpperCase(locale) : currentLetter + ); + } + + return sb.toString(); + } + + + /** + * In some languages there are many characters for a single key. Naturally, they can not all fit + * on one key. As suggested by the community, we could display them as "A-Z". + * @see Issue #628 + */ + private String abbreviateCharList(String chars, Locale locale, boolean isUppercase) { + String firstLetter = chars.substring(0, 1); + String lastLetter = chars.substring(chars.length() - 1); + boolean containsCombiningChars = TextTools.isCombining(firstLetter) || TextTools.isCombining(lastLetter); + + return + (isUppercase ? firstLetter.toUpperCase(locale) : firstLetter) + + (containsCombiningChars ? "– " : "–") + + (isUppercase ? lastLetter.toUpperCase(locale) : lastLetter); + } + + + /** + * Reduces the number of displayed characters by leaving the most descriptive ones. This prevents + * the visual clutter on the keys. + */ + private boolean shouldSkipAccents(char currentLetter, boolean isGreek, boolean isLatinBased) { + return + // Latin. As suggested by the community, there is no need to display the accented letters. People are + // used to seeing just "ABC", "DEF", etc. + (isLatinBased && currentLetter > 'z') + // Cyrillic. Same as above. + || currentLetter == 'ѝ' || currentLetter == 'ґ' + // Korean double consonants + || (currentLetter == 'ㄲ' || currentLetter == 'ㄸ' || currentLetter == 'ㅃ' || currentLetter == 'ㅆ' || currentLetter == 'ㅉ') + // Greek diacritics and ending sigma + || currentLetter == 'ς' + || (isGreek && (currentLetter < 'α' || currentLetter > 'ω')) + // Hindi combining + || (currentLetter >= 0x0900 && currentLetter <= 0x0903) || (currentLetter >= 0x093A && currentLetter <= 0x094F) + || (currentLetter >= 0x0951 && currentLetter <= 0x0957) || currentLetter == 0x0962 || currentLetter == 0x0963 + // Gujarati combining + || (currentLetter >= 0x0A81 && currentLetter <= 0x0A83) || (currentLetter >= 0xABC && currentLetter <= 0x0ACD) + || currentLetter == 0x0AE2 || currentLetter == 0x0AE3 + ; + } +} diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyOk.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyOk.java index 5513ab67..58f6f69c 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyOk.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyOk.java @@ -33,9 +33,9 @@ public class SoftKeyOk extends SoftKey { @Override public void render() { - super.render(); if (tt9 != null) { setEnabled(!tt9.isVoiceInputActive()); } + super.render(); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyRF3.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyRF3.java index 6c0e3ad5..ab9ff2f8 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyRF3.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyRF3.java @@ -27,15 +27,8 @@ public class SoftKeyRF3 extends SoftKey { @Override - protected float getTitleRelativeSize() { - return super.getTitleRelativeSize() / 0.85f; - } - - - @Override - protected float getSubTitleRelativeSize() { - float scale = (isTextEditingMissing() && !isVoiceInputMissing()) || isTextEditingActive() ? 0.85f : 0.96f; - return super.getSubTitleRelativeSize() / scale; + protected float getTitleScale() { + return super.getTitleScale() / 0.85f; } @@ -72,30 +65,44 @@ public class SoftKeyRF3 extends SoftKey { @Override protected String getTitle() { if (isTextEditingActive()) { - return tt9 == null ? "ABC" : tt9.getABCString(); + return ""; } - if (!isVoiceInputMissing()) { - return "🎤"; + if (isTextEditingMissing() && !isVoiceInputMissing()) { + return ""; } - return getContext().getString(R.string.virtual_key_text_editing).toUpperCase(); + return "✂"; } @Override - protected String getSubTitle() { - if (isTextEditingActive() || isTextEditingMissing() || isVoiceInputMissing()) { - return null; + protected int getCentralIcon() { + if (isTextEditingActive()) { + return R.drawable.ic_keyboard; } - return getContext().getString(R.string.virtual_key_text_editing).toUpperCase(); + if (isTextEditingMissing() && !isVoiceInputMissing()) { + return R.drawable.ic_fn_voice; + } + + return -1; } + @Override + protected int getHoldIcon() { + if (isTextEditingActive() || isTextEditingMissing() || isVoiceInputMissing()) { + return -1; + } + + return R.drawable.ic_fn_voice; + } + @Override public void render() { - super.render(); + resetIconCache(); setEnabled(!(isVoiceInputMissing() && isTextEditingMissing())); + super.render(); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeySettings.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeySettings.java index 1803d5f4..19448e7d 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeySettings.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeySettings.java @@ -56,8 +56,34 @@ public class SoftKeySettings extends SwipeableKey { if (mainView != null) mainView.onResize(position); } + @Override - protected int getNoEmojiTitle() { - return R.string.virtual_key_settings; + protected int getCentralIcon() { + return R.drawable.ic_fn_settings; + } + + @Override + protected String getTopText() { + return getContext().getString(R.string.key_dpad_up); + } + + @Override + protected String getRightText() { + return getContext().getString(R.string.key_dpad_right); + } + + @Override + protected String getBottomText() { + return getContext().getString(R.string.key_dpad_down); + } + + @Override + protected String getLeftText() { + return getContext().getString(R.string.key_dpad_left); + } + + @Override + protected float getCentralIconScale() { + return super.getCentralIconScale() * 0.9f; } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyShift.java b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyShift.java index d8252fc2..b4c62776 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyShift.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/main/keys/SoftKeyShift.java @@ -1,9 +1,10 @@ package io.github.sspanak.tt9.ui.main.keys; import android.content.Context; -import android.graphics.Typeface; import android.util.AttributeSet; +import io.github.sspanak.tt9.R; + public class SoftKeyShift extends SoftKey { public SoftKeyShift(Context context) { super(context); @@ -17,8 +18,9 @@ public class SoftKeyShift extends SoftKey { super(context, attrs, defStyleAttr); } - @Override protected float getSingleLabelRelativeSize() { return 1.7f; } - @Override protected String getTitle() { return "⇧"; } + @Override protected int getCentralIcon() { + return R.drawable.ic_fn_shift; + } @Override protected boolean handleRelease() { @@ -27,8 +29,13 @@ public class SoftKeyShift extends SoftKey { @Override public void render() { - setTypeface(Typeface.DEFAULT_BOLD); + setEnabled( + tt9 != null + && !tt9.isVoiceInputActive() + && !tt9.isInputModePhone() + && !tt9.isNumericModeSigned() + && !tt9.isTextEditingActive() + ); super.render(); - setEnabled(tt9 != null && !tt9.isVoiceInputActive() && !tt9.isInputModePhone() && !tt9.isNumericModeSigned()); } } diff --git a/app/src/main/java/io/github/sspanak/tt9/ui/tray/StatusBar.java b/app/src/main/java/io/github/sspanak/tt9/ui/tray/StatusBar.java index e3d4e7e4..53219398 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ui/tray/StatusBar.java +++ b/app/src/main/java/io/github/sspanak/tt9/ui/tray/StatusBar.java @@ -1,11 +1,8 @@ package io.github.sspanak.tt9.ui.tray; -import android.content.Context; import android.view.View; import android.widget.TextView; -import androidx.core.content.ContextCompat; - import io.github.sspanak.tt9.R; import io.github.sspanak.tt9.ime.modes.InputMode; import io.github.sspanak.tt9.ime.voice.VoiceInputOps; diff --git a/app/src/main/res/drawable-hdpi/ic_dpad_left.png b/app/src/main/res/drawable-hdpi/ic_dpad_left.png deleted file mode 100644 index 18fb2162..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_dpad_left.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_dpad_right.png b/app/src/main/res/drawable-hdpi/ic_dpad_right.png deleted file mode 100644 index 102347ef..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_dpad_right.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_status.png b/app/src/main/res/drawable-hdpi/ic_status.png deleted file mode 100644 index e273b682..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_status.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_dpad_left.png b/app/src/main/res/drawable-mdpi/ic_dpad_left.png deleted file mode 100644 index 357f6a90..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_dpad_left.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_dpad_right.png b/app/src/main/res/drawable-mdpi/ic_dpad_right.png deleted file mode 100644 index ad9c54e8..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_dpad_right.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_status.png b/app/src/main/res/drawable-mdpi/ic_status.png deleted file mode 100644 index 14bb408c..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_status.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_dpad_left.png b/app/src/main/res/drawable-xhdpi/ic_dpad_left.png deleted file mode 100644 index b225ac15..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_dpad_left.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_dpad_right.png b/app/src/main/res/drawable-xhdpi/ic_dpad_right.png deleted file mode 100644 index a3ba833e..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_dpad_right.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_status.png b/app/src/main/res/drawable-xhdpi/ic_status.png deleted file mode 100644 index ad05b5b1..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_status.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_dpad_left.png b/app/src/main/res/drawable-xxhdpi/ic_dpad_left.png deleted file mode 100644 index e72d0fd7..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_dpad_left.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_dpad_right.png b/app/src/main/res/drawable-xxhdpi/ic_dpad_right.png deleted file mode 100644 index 9dc94d44..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_dpad_right.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_status.png b/app/src/main/res/drawable-xxhdpi/ic_status.png deleted file mode 100644 index af2db27d..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_status.png and /dev/null differ diff --git a/app/src/main/res/drawable-anydpi-v24/ic_dpad_left.xml b/app/src/main/res/drawable/ic_dpad_left.xml similarity index 100% rename from app/src/main/res/drawable-anydpi-v24/ic_dpad_left.xml rename to app/src/main/res/drawable/ic_dpad_left.xml diff --git a/app/src/main/res/drawable-anydpi-v24/ic_dpad_right.xml b/app/src/main/res/drawable/ic_dpad_right.xml similarity index 100% rename from app/src/main/res/drawable-anydpi-v24/ic_dpad_right.xml rename to app/src/main/res/drawable/ic_dpad_right.xml diff --git a/app/src/main/res/drawable/ic_fn_next_keyboard.xml b/app/src/main/res/drawable/ic_fn_next_keyboard.xml index f9fbb576..90a1c3de 100644 --- a/app/src/main/res/drawable/ic_fn_next_keyboard.xml +++ b/app/src/main/res/drawable/ic_fn_next_keyboard.xml @@ -1,3 +1,3 @@ - + diff --git a/app/src/main/res/drawable/ic_fn_next_language.xml b/app/src/main/res/drawable/ic_fn_next_language.xml new file mode 100644 index 00000000..bd0d1a95 --- /dev/null +++ b/app/src/main/res/drawable/ic_fn_next_language.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/drawable/ic_fn_settings.xml b/app/src/main/res/drawable/ic_fn_settings.xml index 64c56656..f71208e8 100644 --- a/app/src/main/res/drawable/ic_fn_settings.xml +++ b/app/src/main/res/drawable/ic_fn_settings.xml @@ -1,3 +1,3 @@ - + diff --git a/app/src/main/res/drawable/ic_fn_shift.xml b/app/src/main/res/drawable/ic_fn_shift.xml new file mode 100644 index 00000000..61c9f018 --- /dev/null +++ b/app/src/main/res/drawable/ic_fn_shift.xml @@ -0,0 +1,3 @@ + + + diff --git a/app/src/main/res/drawable-anydpi-v24/ic_status.xml b/app/src/main/res/drawable/ic_keyboard.xml similarity index 100% rename from app/src/main/res/drawable-anydpi-v24/ic_status.xml rename to app/src/main/res/drawable/ic_keyboard.xml diff --git a/app/src/main/res/layout/key_overlay_hold_text.xml b/app/src/main/res/layout/key_overlay_hold_text.xml new file mode 100644 index 00000000..972f8e80 --- /dev/null +++ b/app/src/main/res/layout/key_overlay_hold_text.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/res/layout/key_overlay_icons.xml b/app/src/main/res/layout/key_overlay_icons.xml new file mode 100644 index 00000000..9df23d65 --- /dev/null +++ b/app/src/main/res/layout/key_overlay_icons.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/app/src/main/res/layout/key_overlay_number_hold_text.xml b/app/src/main/res/layout/key_overlay_number_hold_text.xml new file mode 100644 index 00000000..ad939b77 --- /dev/null +++ b/app/src/main/res/layout/key_overlay_number_hold_text.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/res/layout/key_overlay_settings.xml b/app/src/main/res/layout/key_overlay_settings.xml new file mode 100644 index 00000000..c1817b29 --- /dev/null +++ b/app/src/main/res/layout/key_overlay_settings.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/main_numpad.xml b/app/src/main/res/layout/main_numpad.xml index 831f23bd..e23d7b0a 100644 --- a/app/src/main/res/layout/main_numpad.xml +++ b/app/src/main/res/layout/main_numpad.xml @@ -1,96 +1,33 @@ - + style="@style/TTheme.Numpad.FullScreenAlignmentContainer" + android:id="@+id/numpad_container"> + style="@style/TTheme.Numpad.FullScreenContainer" + android:id="@+id/numpad_width_constraint_wrapper"> + tools:ignore="MissingConstraints"> - + + - - - - - - - - - - - - - - - - - - - - - + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + + + + + diff --git a/app/src/main/res/layout/main_small.xml b/app/src/main/res/layout/main_small.xml index 8b3b93b3..5e1a004d 100644 --- a/app/src/main/res/layout/main_small.xml +++ b/app/src/main/res/layout/main_small.xml @@ -2,14 +2,9 @@ + style="@style/TTheme.MainSmall"> - + diff --git a/app/src/main/res/layout/panel_numpad.xml b/app/src/main/res/layout/panel_numpad.xml deleted file mode 100644 index 70148ee2..00000000 --- a/app/src/main/res/layout/panel_numpad.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/panel_numpad_digits.xml b/app/src/main/res/layout/panel_numpad_digits.xml new file mode 100644 index 00000000..7f8ee083 --- /dev/null +++ b/app/src/main/res/layout/panel_numpad_digits.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/panel_numpad_left.xml b/app/src/main/res/layout/panel_numpad_left.xml new file mode 100644 index 00000000..e1a2d48f --- /dev/null +++ b/app/src/main/res/layout/panel_numpad_left.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/panel_numpad_right.xml b/app/src/main/res/layout/panel_numpad_right.xml new file mode 100644 index 00000000..f049d320 --- /dev/null +++ b/app/src/main/res/layout/panel_numpad_right.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/panel_numpad_row_1.xml b/app/src/main/res/layout/panel_numpad_row_1.xml deleted file mode 100644 index 7d22abcd..00000000 --- a/app/src/main/res/layout/panel_numpad_row_1.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/panel_numpad_row_2.xml b/app/src/main/res/layout/panel_numpad_row_2.xml deleted file mode 100644 index 4f8aaeed..00000000 --- a/app/src/main/res/layout/panel_numpad_row_2.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/panel_numpad_row_3.xml b/app/src/main/res/layout/panel_numpad_row_3.xml deleted file mode 100644 index be6bfaa6..00000000 --- a/app/src/main/res/layout/panel_numpad_row_3.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/panel_numpad_row_4.xml b/app/src/main/res/layout/panel_numpad_row_4.xml deleted file mode 100644 index 9818200e..00000000 --- a/app/src/main/res/layout/panel_numpad_row_4.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/panel_numpad_status_bar.xml b/app/src/main/res/layout/panel_numpad_status_bar.xml new file mode 100644 index 00000000..75efdf29 --- /dev/null +++ b/app/src/main/res/layout/panel_numpad_status_bar.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/panel_numpad_text_editing.xml b/app/src/main/res/layout/panel_numpad_text_editing.xml new file mode 100644 index 00000000..48ec7434 --- /dev/null +++ b/app/src/main/res/layout/panel_numpad_text_editing.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/panel_numpad_text_editing_row_1.xml b/app/src/main/res/layout/panel_numpad_text_editing_row_1.xml deleted file mode 100644 index 8736e871..00000000 --- a/app/src/main/res/layout/panel_numpad_text_editing_row_1.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/panel_numpad_text_editing_row_2.xml b/app/src/main/res/layout/panel_numpad_text_editing_row_2.xml deleted file mode 100644 index f4935ab5..00000000 --- a/app/src/main/res/layout/panel_numpad_text_editing_row_2.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/panel_numpad_text_editing_row_3.xml b/app/src/main/res/layout/panel_numpad_text_editing_row_3.xml deleted file mode 100644 index 9796c1c4..00000000 --- a/app/src/main/res/layout/panel_numpad_text_editing_row_3.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - diff --git a/app/src/main/res/layout/panel_small_function_keys.xml b/app/src/main/res/layout/panel_small_function_keys.xml index 7bd6780f..5e4d6369 100644 --- a/app/src/main/res/layout/panel_small_function_keys.xml +++ b/app/src/main/res/layout/panel_small_function_keys.xml @@ -24,6 +24,5 @@ android:id="@+id/soft_key_backspace" style="@style/TTheme.MainSmall.Key" android:layout_weight="3" - android:focusable="false" - android:text="⌫" /> + android:focusable="false" /> diff --git a/app/src/main/res/layout/panel_small_text_editing.xml b/app/src/main/res/layout/panel_small_text_editing.xml index 3a12eb8e..ad6bab31 100644 --- a/app/src/main/res/layout/panel_small_text_editing.xml +++ b/app/src/main/res/layout/panel_small_text_editing.xml @@ -7,48 +7,48 @@ tools:showIn="@layout/main_small"> diff --git a/app/src/main/res/layout/suggestion_list_numpad.xml b/app/src/main/res/layout/suggestion_list_numpad.xml index 67a4c689..a35cc380 100644 --- a/app/src/main/res/layout/suggestion_list_numpad.xml +++ b/app/src/main/res/layout/suggestion_list_numpad.xml @@ -5,11 +5,6 @@ android:orientation="horizontal"> + style="@style/TTheme.Numpad.StatusBar.SuggestionList.Item" + android:id="@+id/suggestion_list_item" /> diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index a355276c..b6109a6a 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -5,10 +5,10 @@ #484c4f #fff - #b6b7b9 + #c3c5c6 #373c41 - #898c8f + #c2c3c4 #5e97f6 #fff diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 0a7c72f8..eb242abc 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -8,34 +8,15 @@ #fff #333 - #666 + #4d4d4f #ccced5 - #888 + #4e4e50 #1a73e8 #fff - #8ab5f6 + #8cb7f9 #000 #888888 - - - - - #D3D3D3 - #202020 - #B8B8B8 - #888888 - - #E7E7E7 - #CCC - - - #2C2C2C - #CCCCCC - #555555 - - #353835 - #555 diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 7166cafd..d9a863b2 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -2,12 +2,11 @@ 26sp 16sp - 18sp - 6sp + 18sp + 6sp 32sp - 44dp - 46dp + 46dp 65dp @@ -27,18 +26,19 @@ - 10000dp + 9999dp 6dp - 0dp 56dp 38dp 0.675 - 17sp - 40dp - 36dp + 666dp + 13sp + 11sp + 2dp - 17sp - 6dp + 17sp + 40dp + 36dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6ef14769..d7b775a1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -219,14 +219,11 @@ Left Right - Kbd Cmd Del Mode - Cfg Shift Space (Korean) - Copy Speak Turning off the microphone… diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 5b0e621c..bd74ae75 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -13,6 +13,25 @@ @color/keyboard_background + + + + + + + - - - + - @@ -107,31 +124,179 @@ @style/TextAppearance.AppCompat @dimen/status_bar_font_size - @color/keyboard_text_color + + @color/key_num_color + @color/key_num_color + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +