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