Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75fb3ce1 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

More readable Key.toString() and MoreKeySpec.toString()

Change-Id: Iee3c33dedd0c00ba259aa55e8b0c1c57b84eccdd
parent efd8b838
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -414,8 +414,14 @@ public class Key {

    @Override
    public String toString() {
        return String.format("%s/%s %d,%d %dx%d %s/%s/%s",
                Keyboard.printableCode(mCode), mLabel, mX, mY, mWidth, mHeight, mHintLabel,
        final String label;
        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));
    }

+6 −2
Original line number Diff line number Diff line
@@ -90,8 +90,12 @@ public class KeySpecParser {
            final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel
                    : PREFIX_ICON + KeyboardIconsSet.getIconName(mIconId));
            final String output = (mCode == Keyboard.CODE_OUTPUT_TEXT ? mOutputText
                    : String.format("0x%04x", mCode));
            return label + "/" + output;
                    : Keyboard.printableCode(mCode));
            if (StringUtils.codePointCount(label) == 1 && label.codePointAt(0) == mCode) {
                return output;
            } else {
                return label + "|" + output;
            }
        }
    }