fixes for previous commit

This commit is contained in:
Yuriy Liskov
2018-04-23 00:04:11 +03:00
parent b3afc8e7f2
commit d05415fb65
2 changed files with 19 additions and 9 deletions

View File

@@ -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;