the fitler key now has an icon for a more compact appearance
This commit is contained in:
parent
aa828070c6
commit
3eedd9043e
7 changed files with 43 additions and 37 deletions
|
|
@ -281,6 +281,8 @@ public class SoftKey extends com.google.android.material.button.MaterialButton i
|
||||||
private Drawable getIconCompat() {
|
private Drawable getIconCompat() {
|
||||||
if (icon == null && getCentralIcon() > 0) {
|
if (icon == null && getCentralIcon() > 0) {
|
||||||
icon = AppCompatResources.getDrawable(getContext(), getCentralIcon());
|
icon = AppCompatResources.getDrawable(getContext(), getCentralIcon());
|
||||||
|
} else if (getCentralIcon() <= 0) {
|
||||||
|
icon = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
|
|
@ -293,6 +295,8 @@ public class SoftKey extends com.google.android.material.button.MaterialButton i
|
||||||
private Drawable getHoldIconCompat() {
|
private Drawable getHoldIconCompat() {
|
||||||
if (holdIcon == null && getHoldIcon() > 0) {
|
if (holdIcon == null && getHoldIcon() > 0) {
|
||||||
holdIcon = AppCompatResources.getDrawable(getContext(), getHoldIcon());
|
holdIcon = AppCompatResources.getDrawable(getContext(), getHoldIcon());
|
||||||
|
} else if (getHoldIcon() <= 0) {
|
||||||
|
holdIcon = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return holdIcon;
|
return holdIcon;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package io.github.sspanak.tt9.ui.main.keys;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.Gravity;
|
|
||||||
|
|
||||||
|
import io.github.sspanak.tt9.R;
|
||||||
import io.github.sspanak.tt9.languages.LanguageKind;
|
import io.github.sspanak.tt9.languages.LanguageKind;
|
||||||
import io.github.sspanak.tt9.ui.Vibration;
|
import io.github.sspanak.tt9.ui.Vibration;
|
||||||
|
|
||||||
|
|
@ -12,16 +12,10 @@ public class SoftKeyFilter extends SoftKey {
|
||||||
public SoftKeyFilter(Context context, AttributeSet attrs) { super(context, attrs); }
|
public SoftKeyFilter(Context context, AttributeSet attrs) { super(context, attrs); }
|
||||||
public SoftKeyFilter(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
|
public SoftKeyFilter(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getTitleScale() {
|
|
||||||
return isKorean() ? 1.5f * getTT9Height() : Math.min(getTT9Width(), getTT9Height());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isKorean() {
|
private boolean isKorean() {
|
||||||
return tt9 != null && LanguageKind.isKorean(tt9.getLanguage());
|
return tt9 != null && LanguageKind.isKorean(tt9.getLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleHold() {
|
protected void handleHold() {
|
||||||
if (isKorean()) {
|
if (isKorean()) {
|
||||||
|
|
@ -51,24 +45,14 @@ public class SoftKeyFilter extends SoftKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override protected String getTitle() { return isKorean() ? "␣" : ""; }
|
||||||
protected String getTitle() {
|
@Override protected int getCentralIcon() { return isKorean() ? 0 : R.drawable.ic_fn_filter; }
|
||||||
return isKorean() ? "␣" : "FLTR";
|
@Override protected int getHoldIcon() { return isKorean() ? 0 : R.drawable.ic_fn_filter_off; }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getHoldText() {
|
|
||||||
return isKorean() ? null : "CLR";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override protected float getTitleScale() { return isKorean() ? 1.5f * getTT9Height() : 1; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
setGravity(
|
|
||||||
isKorean() ? Gravity.TOP | Gravity.CENTER_HORIZONTAL: Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (tt9 != null) {
|
if (tt9 != null) {
|
||||||
setEnabled(
|
setEnabled(
|
||||||
!tt9.isInputModeNumeric()
|
!tt9.isInputModeNumeric()
|
||||||
|
|
|
||||||
3
app/src/main/res/drawable/ic_fn_filter.xml
Normal file
3
app/src/main/res/drawable/ic_fn_filter.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M7,6h10l-5.01,6.3L7,6zM4.25,5.61C6.27,8.2 10,13 10,13v6c0,0.55 0.45,1 1,1h2c0.55,0 1,-0.45 1,-1v-6c0,0 3.72,-4.8 5.74,-7.39C20.25,4.95 19.78,4 18.95,4H5.04C4.21,4 3.74,4.95 4.25,5.61z"/>
|
||||||
|
</vector>
|
||||||
4
app/src/main/res/drawable/ic_fn_filter_off.xml
Normal file
4
app/src/main/res/drawable/ic_fn_filter_off.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M16.95,6l-3.57,4.55l1.43,1.43c1.03,-1.31 4.98,-6.37 4.98,-6.37C20.3,4.95 19.83,4 19,4H6.83l2,2H16.95z"/>
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M2.81,2.81L1.39,4.22L10,13v6c0,0.55 0.45,1 1,1h2c0.55,0 1,-0.45 1,-1v-2.17l5.78,5.78l1.41,-1.41L2.81,2.81z"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -9,20 +9,16 @@
|
||||||
android:id="@+id/soft_key_numpad_backspace" />
|
android:id="@+id/soft_key_numpad_backspace" />
|
||||||
|
|
||||||
<RelativeLayout style="@style/TTheme.Numpad.Key.Overlay.Wrapper">
|
<RelativeLayout style="@style/TTheme.Numpad.Key.Overlay.Wrapper">
|
||||||
|
|
||||||
<io.github.sspanak.tt9.ui.main.keys.SoftKeyFilter
|
<io.github.sspanak.tt9.ui.main.keys.SoftKeyFilter
|
||||||
style="@style/TTheme.Numpad.Key"
|
style="@style/TTheme.Numpad.Key"
|
||||||
android:id="@+id/soft_key_filter" />
|
android:id="@+id/soft_key_filter" />
|
||||||
|
<include layout="@layout/key_overlay_icons" />
|
||||||
<include layout="@layout/key_overlay_hold_text" />
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout style="@style/TTheme.Numpad.Key.Overlay.Wrapper">
|
<RelativeLayout style="@style/TTheme.Numpad.Key.Overlay.Wrapper">
|
||||||
|
|
||||||
<io.github.sspanak.tt9.ui.main.keys.SoftKeyRF3
|
<io.github.sspanak.tt9.ui.main.keys.SoftKeyRF3
|
||||||
style="@style/TTheme.Numpad.Key"
|
style="@style/TTheme.Numpad.Key"
|
||||||
android:id="@+id/soft_key_rf3" />
|
android:id="@+id/soft_key_rf3" />
|
||||||
|
|
||||||
<include layout="@layout/key_overlay_icons" />
|
<include layout="@layout/key_overlay_icons" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,23 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="status_bar_height">26sp</dimen>
|
<!--
|
||||||
<dimen name="status_bar_font_size">16sp</dimen>
|
All keyboard element text sizes must be in "dp" instead of "sp"
|
||||||
<dimen name="main_small_suggestion_font_size">18sp</dimen> <!-- for some reason the RecyclerView displays the text smaller than the TextView, so we to make the suggestions slightly bigger than the regular Status Bar text. -->
|
to ignore the Android text size scale. We can't allow scaling because it breaks the layout.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- standard font size for suggestions and keys -->
|
||||||
|
<dimen name="main_text_size">18dp</dimen>
|
||||||
|
|
||||||
|
<!-- Status Bar -->
|
||||||
|
<dimen name="status_bar_height">26dp</dimen>
|
||||||
|
<dimen name="status_bar_text_size">16dp</dimen>
|
||||||
|
|
||||||
|
<!-- Main Small -->
|
||||||
<dimen name="main_small_suggestion_padding_horizontal">6sp</dimen>
|
<dimen name="main_small_suggestion_padding_horizontal">6sp</dimen>
|
||||||
|
|
||||||
<dimen name="main_small_key_icon_size">32sp</dimen>
|
<dimen name="main_small_key_icon_size">32sp</dimen>
|
||||||
<dimen name="main_small_key_wrapper_height">46dp</dimen> <!-- key height + margin -->
|
|
||||||
|
|
||||||
<dimen name="main_small_key_text_editing_height">65dp</dimen>
|
<dimen name="main_small_key_text_editing_height">65dp</dimen>
|
||||||
|
<dimen name="main_small_key_wrapper_height">46dp</dimen> <!-- key height + margin -->
|
||||||
|
|
||||||
<!-- Preferences, default font size -->
|
<!-- Preferences, default font size -->
|
||||||
<dimen name="preferences_text_min_height">48dp</dimen>
|
<dimen name="preferences_text_min_height">48dp</dimen>
|
||||||
|
|
@ -34,11 +43,11 @@
|
||||||
<dimen name="numpad_function_key_layout_weight">0.675</dimen>
|
<dimen name="numpad_function_key_layout_weight">0.675</dimen>
|
||||||
|
|
||||||
<dimen name="numpad_key_overlay_z">666dp</dimen>
|
<dimen name="numpad_key_overlay_z">666dp</dimen>
|
||||||
<dimen name="numpad_key_overlay_small_icon_size">13sp</dimen>
|
<dimen name="numpad_key_overlay_small_icon_size">13dp</dimen>
|
||||||
<dimen name="numpad_key_overlay_text_size">11sp</dimen>
|
<dimen name="numpad_key_overlay_text_size">11dp</dimen>
|
||||||
<dimen name="numpad_key_overlay_side_text_margin">2dp</dimen>
|
<dimen name="numpad_key_overlay_side_text_margin">2dp</dimen>
|
||||||
|
|
||||||
<dimen name="numpad_suggestion_font_size">17sp</dimen>
|
<dimen name="numpad_suggestion_font_size">17dp</dimen>
|
||||||
<dimen name="numpad_suggestion_height">40dp</dimen>
|
<dimen name="numpad_suggestion_height">40dp</dimen>
|
||||||
<dimen name="numpad_suggestion_min_width">36dp</dimen>
|
<dimen name="numpad_suggestion_min_width">36dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
<item name="android:layout_height">match_parent</item>
|
<item name="android:layout_height">match_parent</item>
|
||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
|
||||||
<item name="android:textSize">@dimen/status_bar_font_size</item>
|
<item name="android:textSize">@dimen/status_bar_text_size</item>
|
||||||
<item name="android:textStyle">italic</item>
|
<item name="android:textStyle">italic</item>
|
||||||
<item name="android:textColor">@color/keyboard_text_color</item>
|
<item name="android:textColor">@color/keyboard_text_color</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -64,7 +64,11 @@
|
||||||
<item name="android:paddingLeft">@dimen/main_small_suggestion_padding_horizontal</item>
|
<item name="android:paddingLeft">@dimen/main_small_suggestion_padding_horizontal</item>
|
||||||
<item name="android:paddingRight">@dimen/main_small_suggestion_padding_horizontal</item>
|
<item name="android:paddingRight">@dimen/main_small_suggestion_padding_horizontal</item>
|
||||||
|
|
||||||
<item name="android:textSize">@dimen/main_small_suggestion_font_size</item>
|
<!--
|
||||||
|
for some reason the RecyclerView displays the text smaller than the TextView,
|
||||||
|
so we to make the suggestions slightly bigger than the regular Status Bar text.
|
||||||
|
-->
|
||||||
|
<item name="android:textSize">@dimen/main_text_size</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -93,6 +97,7 @@
|
||||||
<item name="android:paddingTop">0dp</item>
|
<item name="android:paddingTop">0dp</item>
|
||||||
<item name="android:paddingBottom">0dp</item>
|
<item name="android:paddingBottom">0dp</item>
|
||||||
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Medium</item>
|
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Medium</item>
|
||||||
|
<item name="android:textSize">@dimen/main_text_size</item>
|
||||||
|
|
||||||
<item name="android:textColor">@color/key_num_color</item>
|
<item name="android:textColor">@color/key_num_color</item>
|
||||||
<item name="backgroundTint">@color/key_num_background</item>
|
<item name="backgroundTint">@color/key_num_background</item>
|
||||||
|
|
@ -123,7 +128,7 @@
|
||||||
<item name="android:paddingRight">0dp</item>
|
<item name="android:paddingRight">0dp</item>
|
||||||
|
|
||||||
<item name="android:textAppearance">@style/TextAppearance.AppCompat</item>
|
<item name="android:textAppearance">@style/TextAppearance.AppCompat</item>
|
||||||
<item name="android:textSize">@dimen/status_bar_font_size</item>
|
<item name="android:textSize">@dimen/status_bar_text_size</item>
|
||||||
|
|
||||||
<item name="android:textColor">@color/key_num_color</item>
|
<item name="android:textColor">@color/key_num_color</item>
|
||||||
<item name="drawableTint">@color/key_num_color</item>
|
<item name="drawableTint">@color/key_num_color</item>
|
||||||
|
|
@ -290,6 +295,7 @@
|
||||||
<item name="android:padding">0dp</item>
|
<item name="android:padding">0dp</item>
|
||||||
|
|
||||||
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Medium</item>
|
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Medium</item>
|
||||||
|
<item name="android:textSize">@dimen/main_text_size</item>
|
||||||
|
|
||||||
<item name="android:textColor">@color/keyboard_text_color</item>
|
<item name="android:textColor">@color/keyboard_text_color</item>
|
||||||
<item name="backgroundTint">@color/key_fn_background</item>
|
<item name="backgroundTint">@color/key_fn_background</item>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue