am 75fb3ce1: More readable Key.toString() and MoreKeySpec.toString()
* commit '75fb3ce1be3c879bb614097a2534f791c833dd7c': More readable Key.toString() and MoreKeySpec.toString()main
commit
fb1fe2da9e
|
@ -414,8 +414,14 @@ public class Key {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s/%s %d,%d %dx%d %s/%s/%s",
|
final String label;
|
||||||
Keyboard.printableCode(mCode), mLabel, mX, mY, mWidth, mHeight, mHintLabel,
|
if (StringUtils.codePointCount(mLabel) == 1 && mLabel.codePointAt(0) == mCode) {
|
||||||
|
label = "";
|
||||||
|
} else {
|
||||||
|
label = "/" + mLabel;
|
||||||
|
}
|
||||||
|
return String.format("%s%s %d,%d %dx%d %s/%s/%s",
|
||||||
|
Keyboard.printableCode(mCode), label, mX, mY, mWidth, mHeight, mHintLabel,
|
||||||
KeyboardIconsSet.getIconName(mIconId), backgroundName(mBackgroundType));
|
KeyboardIconsSet.getIconName(mIconId), backgroundName(mBackgroundType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,12 @@ public class KeySpecParser {
|
||||||
final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel
|
final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel
|
||||||
: PREFIX_ICON + KeyboardIconsSet.getIconName(mIconId));
|
: PREFIX_ICON + KeyboardIconsSet.getIconName(mIconId));
|
||||||
final String output = (mCode == Keyboard.CODE_OUTPUT_TEXT ? mOutputText
|
final String output = (mCode == Keyboard.CODE_OUTPUT_TEXT ? mOutputText
|
||||||
: String.format("0x%04x", mCode));
|
: Keyboard.printableCode(mCode));
|
||||||
return label + "/" + output;
|
if (StringUtils.codePointCount(label) == 1 && label.codePointAt(0) == mCode) {
|
||||||
|
return output;
|
||||||
|
} else {
|
||||||
|
return label + "|" + output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue