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

Commit 45eb5d92 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Allow an empty keySpec for Spacer

Bug: 12933248
Change-Id: I76432556caf319ce23c1fb7fa3d6b94118e64cf8
parent c44cbf6a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -316,8 +316,10 @@ public class Key implements Comparable<Key> {
        mActionFlags = actionFlags;

        final String keySpec = style.getString(keyAttr, R.styleable.Keyboard_Key_keySpec);
        if (TextUtils.isEmpty(keySpec)) {
            throw new RuntimeException("Empty keySpec");
        // Note: {@link Spacer} has an empty keySpec.
        // TODO: Create a Key constructor that parses only key geometries and share it with Spacer.
        if (TextUtils.isEmpty(keySpec) && !(this instanceof Spacer)) {
            throw new RuntimeException("Empty keySpec found in " + getClass().getName());
        }

        mIconId = KeySpecParser.getIconId(keySpec);