diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index ced18f0f3..15ec80b6e 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -31,7 +31,6 @@ import com.android.inputmethod.keyboard.internal.KeyboardBuilder.ParseException; import com.android.inputmethod.keyboard.internal.KeyboardIconsSet; import com.android.inputmethod.keyboard.internal.KeyboardParams; import com.android.inputmethod.keyboard.internal.MoreKeySpecParser; -import com.android.inputmethod.keyboard.internal.Row; import com.android.inputmethod.latin.R; import java.util.HashMap; @@ -248,8 +247,8 @@ public class Key { * @param parser the XML parser containing the attributes for this key * @param keyStyles active key styles set */ - public Key(Resources res, KeyboardParams params, Row row, XmlResourceParser parser, - KeyStyles keyStyles) { + public Key(Resources res, KeyboardParams params, KeyboardBuilder.Row row, + XmlResourceParser parser, KeyStyles keyStyles) { final TypedArray keyboardAttr = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard); diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java index 5336ea909..fb1c06175 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java @@ -135,6 +135,37 @@ public class KeyboardBuilder { private Key mRightEdgeKey = null; private final KeyStyles mKeyStyles = new KeyStyles(); + /** + * Container for keys in the keyboard. All keys in a row are at the same Y-coordinate. + * Some of the key size defaults can be overridden per row from what the {@link Keyboard} + * defines. + */ + public static class Row { + /** Default width of a key in this row. */ + public final float mDefaultKeyWidth; + /** Default height of a key in this row. */ + public final int mRowHeight; + + public final int mCurrentY; + // Will be updated by {@link Key}'s constructor. + public float mCurrentX; + + public Row(Resources res, KeyboardParams params, XmlResourceParser parser, int y) { + final int keyboardWidth = params.mWidth; + final int keyboardHeight = params.mHeight; + TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.Keyboard); + mDefaultKeyWidth = KeyboardBuilder.getDimensionOrFraction(a, + R.styleable.Keyboard_keyWidth, keyboardWidth, params.mDefaultKeyWidth); + mRowHeight = (int)KeyboardBuilder.getDimensionOrFraction(a, + R.styleable.Keyboard_rowHeight, keyboardHeight, params.mDefaultRowHeight); + a.recycle(); + + mCurrentY = y; + mCurrentX = 0.0f; + } + } + public KeyboardBuilder(Context context, KP params) { mContext = context; final Resources res = context.getResources(); diff --git a/java/src/com/android/inputmethod/keyboard/internal/Row.java b/java/src/com/android/inputmethod/keyboard/internal/Row.java deleted file mode 100644 index d81881d77..000000000 --- a/java/src/com/android/inputmethod/keyboard/internal/Row.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.android.inputmethod.keyboard.internal; - -import android.content.res.Resources; -import android.content.res.TypedArray; -import android.content.res.XmlResourceParser; -import android.util.Xml; - -import com.android.inputmethod.keyboard.Keyboard; -import com.android.inputmethod.latin.R; - -/** - * Container for keys in the keyboard. All keys in a row are at the same Y-coordinate. - * Some of the key size defaults can be overridden per row from what the {@link Keyboard} - * defines. - */ -public class Row { - /** Default width of a key in this row. */ - public final float mDefaultKeyWidth; - /** Default height of a key in this row. */ - public final int mRowHeight; - - public final int mCurrentY; - // Will be updated by {@link Key}'s constructor. - public float mCurrentX; - - public Row(Resources res, KeyboardParams params, XmlResourceParser parser, int y) { - final int keyboardWidth = params.mWidth; - final int keyboardHeight = params.mHeight; - TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), - R.styleable.Keyboard); - mDefaultKeyWidth = KeyboardBuilder.getDimensionOrFraction(a, - R.styleable.Keyboard_keyWidth, keyboardWidth, params.mDefaultKeyWidth); - mRowHeight = (int)KeyboardBuilder.getDimensionOrFraction(a, - R.styleable.Keyboard_rowHeight, keyboardHeight, params.mDefaultRowHeight); - a.recycle(); - - mCurrentY = y; - mCurrentX = 0.0f; - } -}