adjusted the size of the virtual function keys and removed some unnecessary size resources
This commit is contained in:
parent
7283b8ae0b
commit
ef2ca89605
8 changed files with 49 additions and 44 deletions
|
|
@ -263,32 +263,38 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
|||
|
||||
if (title == null) {
|
||||
return;
|
||||
} else if (subtitle == null) {
|
||||
setText(title);
|
||||
return;
|
||||
}
|
||||
|
||||
int titleLength = title.length();
|
||||
|
||||
SpannableStringBuilder sb = new SpannableStringBuilder(title);
|
||||
sb.append('\n');
|
||||
sb.append(subtitle);
|
||||
|
||||
float padding = SettingsStore.SOFT_KEY_COMPLEX_LABEL_TITLE_RELATIVE_SIZE;
|
||||
if (getTitleRelativeSize() == SettingsStore.SOFT_KEY_COMPLEX_LABEL_ARABIC_TITLE_RELATIVE_SIZE) {
|
||||
padding /= 10;
|
||||
if (subtitle != null) {
|
||||
sb.append('\n');
|
||||
sb.append(subtitle);
|
||||
}
|
||||
|
||||
// title styles
|
||||
sb.setSpan(new RelativeSizeSpan(getTitleRelativeSize()), 0, titleLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
if (!new Text(title).startsWithGraphic()) {
|
||||
int titleLength = title.length();
|
||||
float titleRelativeSize = subtitle == null ? getSubTitleRelativeSize() : getTitleRelativeSize();
|
||||
|
||||
sb.setSpan(new RelativeSizeSpan(titleRelativeSize), 0, titleLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
if (subtitle != null && !new Text(title).startsWithGraphic()) {
|
||||
sb.setSpan(new StyleSpan(Typeface.ITALIC), 0, titleLength, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
|
||||
}
|
||||
|
||||
if (isTitleDisabled) {
|
||||
sb.setSpan(new ForegroundColorSpan(0x44000000), 0, titleLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
}
|
||||
|
||||
if (subtitle == null) {
|
||||
setText(sb);
|
||||
return;
|
||||
}
|
||||
|
||||
// subtitle styles
|
||||
float padding = SettingsStore.SOFT_KEY_COMPLEX_LABEL_TITLE_RELATIVE_SIZE;
|
||||
if (titleRelativeSize == SettingsStore.SOFT_KEY_COMPLEX_LABEL_ARABIC_TITLE_RELATIVE_SIZE) {
|
||||
padding /= 10;
|
||||
}
|
||||
|
||||
sb.setSpan(new RelativeSizeSpan(padding), titleLength, titleLength + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
sb.setSpan(new RelativeSizeSpan(getSubTitleRelativeSize()), titleLength + 1, sb.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,21 +10,35 @@ public class SoftKeyRF3 extends SoftKey {
|
|||
public SoftKeyRF3(Context context, AttributeSet attrs) { super(context, attrs); }
|
||||
public SoftKeyRF3(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 isVoiceInputMissing() {
|
||||
return tt9 != null && tt9.isVoiceInputMissing();
|
||||
}
|
||||
|
||||
|
||||
private boolean isTextEditingMissing() {
|
||||
return tt9 != null && tt9.isInputLimited();
|
||||
}
|
||||
|
||||
|
||||
private boolean isTextEditingActive() {
|
||||
return tt9 != null && tt9.isTextEditingActive();
|
||||
}
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void handleHold() {
|
||||
preventRepeat();
|
||||
|
|
@ -36,6 +50,7 @@ public class SoftKeyRF3 extends SoftKey {
|
|||
tt9.toggleVoiceInput();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean handleRelease() {
|
||||
if (!validateTT9Handler() && isTextEditingMissing() && isVoiceInputMissing()) {
|
||||
|
|
@ -53,6 +68,7 @@ public class SoftKeyRF3 extends SoftKey {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
if (isTextEditingActive()) {
|
||||
|
|
@ -66,6 +82,7 @@ public class SoftKeyRF3 extends SoftKey {
|
|||
return getContext().getString(R.string.virtual_key_text_editing).toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getSubTitle() {
|
||||
if (isTextEditingActive() || isTextEditingMissing() || isVoiceInputMissing()) {
|
||||
|
|
@ -75,6 +92,7 @@ public class SoftKeyRF3 extends SoftKey {
|
|||
return getContext().getString(R.string.virtual_key_text_editing).toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
super.render();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class SoftKeyShift extends SoftKey {
|
|||
|
||||
@Override
|
||||
public void render() {
|
||||
setTextSize(30);
|
||||
setTextSize(36);
|
||||
setTypeface(Typeface.DEFAULT_BOLD);
|
||||
super.render();
|
||||
setEnabled(tt9 != null && !tt9.isVoiceInputActive() && !tt9.isInputModePhone() && !tt9.isNumericModeSigned());
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_dpad_left"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKeyFn
|
||||
|
|
@ -19,7 +18,6 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_select_none"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKeyFn
|
||||
|
|
@ -30,6 +28,5 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_dpad_right"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
</merge>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_word_back"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKeyFn
|
||||
|
|
@ -19,7 +18,6 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_select_all"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKeyFn
|
||||
|
|
@ -30,6 +28,5 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_word_forward"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
</merge>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_cut"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKeyFn
|
||||
|
|
@ -19,7 +18,6 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_copy"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
|
|
@ -31,6 +29,5 @@
|
|||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_paste"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size"
|
||||
android:visibility="gone" />
|
||||
</merge>
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_dpad_left"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_10_1"
|
||||
|
|
@ -28,8 +27,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_select_none"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_10_2"
|
||||
|
|
@ -42,8 +40,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_dpad_right"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_10_3"
|
||||
|
|
@ -56,8 +53,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_word_back"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_10_4"
|
||||
|
|
@ -70,8 +66,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_select_all"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_10_5"
|
||||
|
|
@ -84,8 +79,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_word_forward"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_10_6"
|
||||
|
|
@ -98,8 +92,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_cut"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_10_7"
|
||||
|
|
@ -112,8 +105,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_copy"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
<View
|
||||
android:id="@+id/separator_10_8"
|
||||
|
|
@ -126,7 +118,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawableBottom="@drawable/ic_txt_paste"
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding"
|
||||
android:textSize="@dimen/soft_key_drawable_title_size" />
|
||||
android:paddingBottom="@dimen/soft_key_drawable_bottom_padding" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
<dimen name="soft_key_height">44dp</dimen>
|
||||
<dimen name="soft_key_icon_size">24sp</dimen>
|
||||
<dimen name="soft_key_drawable_bottom_padding">6dp</dimen>
|
||||
<dimen name="soft_key_drawable_title_size">12sp</dimen>
|
||||
|
||||
<!-- Large font size -->
|
||||
<dimen name="pref_large_category_padding_top">30dp</dimen>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue