mirror of
https://github.com/yuliskov/LeanKeyboard.git
synced 2026-01-25 22:29:17 -05:00
fixes for previous commit
This commit is contained in:
@@ -124,25 +124,33 @@ public class LeanbackKeyboardView extends FrameLayout {
|
||||
}
|
||||
|
||||
private CharSequence getSpecialLowerCase(CharSequence label) {
|
||||
String realLabel = label.toString();
|
||||
if (realLabel.contains("|")) {
|
||||
String[] labels = realLabel.split("\\|");
|
||||
return labels[0];
|
||||
String[] labels = splitLabels(label);
|
||||
|
||||
if (labels != null) {
|
||||
return labels[0]; // lower case char
|
||||
}
|
||||
|
||||
return label.toString().toLowerCase();
|
||||
}
|
||||
|
||||
private CharSequence getSpecialUpperCase(CharSequence label) {
|
||||
String realLabel = label.toString();
|
||||
if (realLabel.contains("|")) {
|
||||
String[] labels = realLabel.split("\\|");
|
||||
return labels[1];
|
||||
String[] labels = splitLabels(label);
|
||||
|
||||
if (labels != null) {
|
||||
return labels[1]; // upper case char
|
||||
}
|
||||
|
||||
return label.toString().toUpperCase();
|
||||
}
|
||||
|
||||
private String[] splitLabels(CharSequence label) {
|
||||
String realLabel = label.toString();
|
||||
|
||||
String[] labels = realLabel.split("\\|");
|
||||
|
||||
return labels.length == 2 ? labels : null; // remember, we encoding two chars
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private ImageView createKeyImageView(final int keyIndex) {
|
||||
Rect padding = mPadding;
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
<Key android:codes="-5" android:keyEdgeFlags="right" android:keyLabel="@string/keyboardview_keycode_delete" android:keyIcon="@drawable/ic_ime_delete" />
|
||||
</Row>
|
||||
<Row>
|
||||
<Key android:popupKeyboard="@xml/accent_q_th" android:keyLabel="ฝ" android:keyEdgeFlags="left" />
|
||||
<!-- NOTE: example of adding different chars to uppercase/lowercase states -->
|
||||
<!-- format is: android:keyLabel="lower_char|upper_char" e.g. android:keyLabel="ฝ|๒" -->
|
||||
<Key android:popupKeyboard="@xml/accent_q_th" android:keyLabel="ฝ|๒" android:keyEdgeFlags="left" />
|
||||
<Key android:popupKeyboard="@xml/accent_w_th" android:keyLabel="๒" />
|
||||
<Key android:popupKeyboard="@xml/accent_e_th" android:keyLabel="๓" />
|
||||
<Key android:popupKeyboard="@xml/accent_r_th" android:keyLabel="ู" />
|
||||
|
||||
Reference in New Issue
Block a user