135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka/*
235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka * Copyright (C) 2012 The Android Open Source Project
335ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka *
48aa9963a895f9dd5bb1bc92ab2e4f461e058f87aTadashi G. Takaoka * Licensed under the Apache License, Version 2.0 (the "License");
58aa9963a895f9dd5bb1bc92ab2e4f461e058f87aTadashi G. Takaoka * you may not use this file except in compliance with the License.
68aa9963a895f9dd5bb1bc92ab2e4f461e058f87aTadashi G. Takaoka * You may obtain a copy of the License at
735ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka *
88aa9963a895f9dd5bb1bc92ab2e4f461e058f87aTadashi G. Takaoka *      http://www.apache.org/licenses/LICENSE-2.0
935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka *
1035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka * Unless required by applicable law or agreed to in writing, software
118aa9963a895f9dd5bb1bc92ab2e4f461e058f87aTadashi G. Takaoka * distributed under the License is distributed on an "AS IS" BASIS,
128aa9963a895f9dd5bb1bc92ab2e4f461e058f87aTadashi G. Takaoka * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138aa9963a895f9dd5bb1bc92ab2e4f461e058f87aTadashi G. Takaoka * See the License for the specific language governing permissions and
148aa9963a895f9dd5bb1bc92ab2e4f461e058f87aTadashi G. Takaoka * limitations under the License.
1535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka */
1635ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
1735ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaokapackage com.android.inputmethod.keyboard.internal;
1835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
1935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaokaimport android.content.res.Resources;
2035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaokaimport android.content.res.TypedArray;
2135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaokaimport android.util.Xml;
2235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
2335ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaokaimport com.android.inputmethod.keyboard.Key;
2435ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaokaimport com.android.inputmethod.keyboard.Keyboard;
2535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaokaimport com.android.inputmethod.latin.R;
26e28eba5074664d5716b8e58b8d0a235746b261ebKen Wakasaimport com.android.inputmethod.latin.utils.ResourceUtils;
2735ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
2835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaokaimport org.xmlpull.v1.XmlPullParser;
2935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
30bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaokaimport java.util.ArrayDeque;
31bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka
3235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka/**
3335ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka * Container for keys in the keyboard. All keys in a row are at the same Y-coordinate.
3435ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka * Some of the key size defaults can be overridden per row from what the {@link Keyboard}
3535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka * defines.
3635ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka */
37a28a05e971cc242b338331a3b78276fa95188d19Tadashi G. Takaokapublic final class KeyboardRow {
3835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    // keyWidth enum constants
3935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    private static final int KEYWIDTH_NOT_ENUM = 0;
4035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    private static final int KEYWIDTH_FILL_RIGHT = -1;
4135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
4235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    private final KeyboardParams mParams;
43784416f73bc5053114ceb8274dba4bdabbbda700Tadashi G. Takaoka    /** The height of this row. */
44784416f73bc5053114ceb8274dba4bdabbbda700Tadashi G. Takaoka    private final int mRowHeight;
45bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka
46a91561aa58db1c43092c1caecc051a11fa5391c7Tadashi G. Takaoka    private final ArrayDeque<RowAttributes> mRowAttributesStack = new ArrayDeque<>();
47bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka
48a68e0dd437daa1387edc65082f96a00ca258a7b0Tadashi G. Takaoka    // TODO: Add keyActionFlags.
49bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka    private static class RowAttributes {
50bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        /** Default width of a key in this row. */
51bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        public final float mDefaultKeyWidth;
52bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        /** Default keyLabelFlags in this row. */
53bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        public final int mDefaultKeyLabelFlags;
54bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        /** Default backgroundType for this row */
55bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        public final int mDefaultBackgroundType;
56bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka
57bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        /**
58bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * Parse and create key attributes. This constructor is used to parse Row tag.
59bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         *
60bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * @param keyAttr an attributes array of Row tag.
61bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * @param defaultKeyWidth a default key width.
62bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * @param keyboardWidth the keyboard width that is required to calculate keyWidth attribute.
63bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         */
64bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        public RowAttributes(final TypedArray keyAttr, final float defaultKeyWidth,
65bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                final int keyboardWidth) {
66bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka            mDefaultKeyWidth = keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
67bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                    keyboardWidth, keyboardWidth, defaultKeyWidth);
68bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka            mDefaultKeyLabelFlags = keyAttr.getInt(R.styleable.Keyboard_Key_keyLabelFlags, 0);
69bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka            mDefaultBackgroundType = keyAttr.getInt(R.styleable.Keyboard_Key_backgroundType,
70bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                    Key.BACKGROUND_TYPE_NORMAL);
71bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        }
72bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka
73bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        /**
74bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * Parse and update key attributes using default attributes. This constructor is used
75bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * to parse include tag.
76bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         *
77bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * @param keyAttr an attributes array of include tag.
78bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * @param defaultRowAttr default Row attributes.
79bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         * @param keyboardWidth the keyboard width that is required to calculate keyWidth attribute.
80bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka         */
81bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        public RowAttributes(final TypedArray keyAttr, final RowAttributes defaultRowAttr,
82bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                final int keyboardWidth) {
83bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka            mDefaultKeyWidth = keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
84bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                    keyboardWidth, keyboardWidth, defaultRowAttr.mDefaultKeyWidth);
85bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka            mDefaultKeyLabelFlags = keyAttr.getInt(R.styleable.Keyboard_Key_keyLabelFlags, 0)
86bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                    | defaultRowAttr.mDefaultKeyLabelFlags;
87bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka            mDefaultBackgroundType = keyAttr.getInt(R.styleable.Keyboard_Key_backgroundType,
88bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                    defaultRowAttr.mDefaultBackgroundType);
89bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        }
90bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka    }
9135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
9235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    private final int mCurrentY;
9335ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    // Will be updated by {@link Key}'s constructor.
9435ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    private float mCurrentX;
9535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
96bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka    public KeyboardRow(final Resources res, final KeyboardParams params,
97bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka            final XmlPullParser parser, final int y) {
9835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        mParams = params;
995ee2d79e41872610946b5a5c1caf14f3e5696c26Tadashi G. Takaoka        final TypedArray keyboardAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
10035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka                R.styleable.Keyboard);
10135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        mRowHeight = (int)ResourceUtils.getDimensionOrFraction(keyboardAttr,
102bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                R.styleable.Keyboard_rowHeight, params.mBaseHeight, params.mDefaultRowHeight);
10335ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        keyboardAttr.recycle();
1045ee2d79e41872610946b5a5c1caf14f3e5696c26Tadashi G. Takaoka        final TypedArray keyAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
10535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka                R.styleable.Keyboard_Key);
106bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        mRowAttributesStack.push(new RowAttributes(
107bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                keyAttr, params.mDefaultKeyWidth, params.mBaseWidth));
10835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        keyAttr.recycle();
10935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
11035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        mCurrentY = y;
11135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        mCurrentX = 0.0f;
11235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
11335ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
114784416f73bc5053114ceb8274dba4bdabbbda700Tadashi G. Takaoka    public int getRowHeight() {
115784416f73bc5053114ceb8274dba4bdabbbda700Tadashi G. Takaoka        return mRowHeight;
116784416f73bc5053114ceb8274dba4bdabbbda700Tadashi G. Takaoka    }
117784416f73bc5053114ceb8274dba4bdabbbda700Tadashi G. Takaoka
118bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka    public void pushRowAttributes(final TypedArray keyAttr) {
119bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        final RowAttributes newAttributes = new RowAttributes(
120bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                keyAttr, mRowAttributesStack.peek(), mParams.mBaseWidth);
121bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        mRowAttributesStack.push(newAttributes);
12235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
12335ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
124bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka    public void popRowAttributes() {
125bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        mRowAttributesStack.pop();
12635ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
12735ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
128bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka    public float getDefaultKeyWidth() {
129bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        return mRowAttributesStack.peek().mDefaultKeyWidth;
13035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
13135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
132bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka    public int getDefaultKeyLabelFlags() {
133bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        return mRowAttributesStack.peek().mDefaultKeyLabelFlags;
13435ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
13535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
13635ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    public int getDefaultBackgroundType() {
137bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka        return mRowAttributesStack.peek().mDefaultBackgroundType;
13835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
13935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
14035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    public void setXPos(final float keyXPos) {
14135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        mCurrentX = keyXPos;
14235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
14335ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
14435ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    public void advanceXPos(final float width) {
14535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        mCurrentX += width;
14635ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
14735ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
14835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    public int getKeyY() {
14935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        return mCurrentY;
15035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
15135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
15235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    public float getKeyX(final TypedArray keyAttr) {
15325f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        if (keyAttr == null || !keyAttr.hasValue(R.styleable.Keyboard_Key_keyXPos)) {
15425f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka            return mCurrentX;
15535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        }
15625f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        final float keyXPos = keyAttr.getFraction(R.styleable.Keyboard_Key_keyXPos,
15725f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka                mParams.mBaseWidth, mParams.mBaseWidth, 0);
15825f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        if (keyXPos >= 0) {
15925f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka            return keyXPos + mParams.mLeftPadding;
16025f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        }
16125f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        // If keyXPos is negative, the actual x-coordinate will be
16225f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        // keyboardWidth + keyXPos.
16325f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        // keyXPos shouldn't be less than mCurrentX because drawable area for this
16425f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        // key starts at mCurrentX. Or, this key will overlaps the adjacent key on
16525f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        // its left hand side.
16625f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        final int keyboardRightEdge = mParams.mOccupiedWidth - mParams.mRightPadding;
16725f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        return Math.max(keyXPos + keyboardRightEdge, mCurrentX);
16835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
16935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka
17035ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    public float getKeyWidth(final TypedArray keyAttr, final float keyXPos) {
17125f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        if (keyAttr == null) {
172bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka            return getDefaultKeyWidth();
17325f0d73fa4e26e521ecab70f5e6efc6bbe7acc1dTadashi G. Takaoka        }
17435ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        final int widthType = ResourceUtils.getEnumValue(keyAttr,
17535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka                R.styleable.Keyboard_Key_keyWidth, KEYWIDTH_NOT_ENUM);
17635ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        switch (widthType) {
17735ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        case KEYWIDTH_FILL_RIGHT:
17835ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka            // If keyWidth is fillRight, the actual key width will be determined to fill
17935ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka            // out the area up to the right edge of the keyboard.
180e1f091c5d44981ec81c12b674aefa37fec2af5cbTadashi G. Takaoka            final int keyboardRightEdge = mParams.mOccupiedWidth - mParams.mRightPadding;
18135ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka            return keyboardRightEdge - keyXPos;
18235ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        default: // KEYWIDTH_NOT_ENUM
1835ee2d79e41872610946b5a5c1caf14f3e5696c26Tadashi G. Takaoka            return keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth,
184bcd173dfa12ce3e47c047a7d8567a30d214c0449Tadashi G. Takaoka                    mParams.mBaseWidth, mParams.mBaseWidth, getDefaultKeyWidth());
18535ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka        }
18635ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka    }
18735ff94547c16c84c5b6fafdae0b4a683be782b97Tadashi G. Takaoka}
188