Rename LatinKeyboardBaseView class to KeyboardBaseView

Change-Id: I496ecbfa7d398583d01f821398f49f75d17311d8
main
Tadashi Takaoka 2010-11-05 18:30:22 +09:00 committed by Tadashi G. Takaoka
parent 38976d5b96
commit 68864723cf
11 changed files with 54 additions and 54 deletions

View File

@ -25,9 +25,9 @@
android:orientation="horizontal" android:orientation="horizontal"
android:background="@drawable/keyboard_popup_panel_background" android:background="@drawable/keyboard_popup_panel_background"
> >
<com.android.inputmethod.latin.LatinKeyboardBaseView <com.android.inputmethod.latin.BaseKeyboardView
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:id="@+id/LatinKeyboardBaseView" android:id="@+id/BaseKeyboardView"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -26,9 +26,9 @@
android:paddingLeft="16dip" android:paddingLeft="16dip"
android:paddingRight="16dip" android:paddingRight="16dip"
> >
<com.android.inputmethod.latin.LatinKeyboardBaseView <com.android.inputmethod.latin.BaseKeyboardView
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:id="@+id/LatinKeyboardBaseView" android:id="@+id/BaseKeyboardView"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -16,7 +16,7 @@
<resources> <resources>
<declare-styleable name="LatinKeyboardBaseView"> <declare-styleable name="BaseKeyboardView">
<!-- Default KeyboardView style. --> <!-- Default KeyboardView style. -->
<attr name="keyboardViewStyle" format="reference" /> <attr name="keyboardViewStyle" format="reference" />

View File

@ -15,7 +15,7 @@
--> -->
<resources> <resources>
<style name="LatinKeyboardBaseView"> <style name="BaseKeyboardView">
<item name="android:background">@drawable/keyboard_background</item> <item name="android:background">@drawable/keyboard_background</item>
<item name="keyBackground">@drawable/btn_keyboard_key</item> <item name="keyBackground">@drawable/btn_keyboard_key</item>

View File

@ -59,17 +59,17 @@ import java.util.WeakHashMap;
* *
* TODO: References to LatinKeyboard in this class should be replaced with ones to its base class. * TODO: References to LatinKeyboard in this class should be replaced with ones to its base class.
* *
* @attr ref R.styleable#LatinKeyboardBaseView_keyBackground * @attr ref R.styleable#BaseKeyboardView_keyBackground
* @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewLayout * @attr ref R.styleable#BaseKeyboardView_keyPreviewLayout
* @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewOffset * @attr ref R.styleable#BaseKeyboardView_keyPreviewOffset
* @attr ref R.styleable#LatinKeyboardBaseView_labelTextSize * @attr ref R.styleable#BaseKeyboardView_labelTextSize
* @attr ref R.styleable#LatinKeyboardBaseView_keyTextSize * @attr ref R.styleable#BaseKeyboardView_keyTextSize
* @attr ref R.styleable#LatinKeyboardBaseView_keyTextColor * @attr ref R.styleable#BaseKeyboardView_keyTextColor
* @attr ref R.styleable#LatinKeyboardBaseView_verticalCorrection * @attr ref R.styleable#BaseKeyboardView_verticalCorrection
* @attr ref R.styleable#LatinKeyboardBaseView_popupLayout * @attr ref R.styleable#BaseKeyboardView_popupLayout
*/ */
public class LatinKeyboardBaseView extends View implements PointerTracker.UIProxy { public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
private static final String TAG = "LatinKeyboardBaseView"; private static final String TAG = "BaseKeyboardView";
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
public static final int NOT_A_TOUCH_COORDINATE = -1; public static final int NOT_A_TOUCH_COORDINATE = -1;
@ -204,7 +204,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
// Popup mini keyboard // Popup mini keyboard
private PopupWindow mMiniKeyboardPopup; private PopupWindow mMiniKeyboardPopup;
private LatinKeyboardBaseView mMiniKeyboard; private BaseKeyboardView mMiniKeyboard;
private View mMiniKeyboardParent; private View mMiniKeyboardParent;
private final WeakHashMap<Key, View> mMiniKeyboardCache = new WeakHashMap<Key, View>(); private final WeakHashMap<Key, View> mMiniKeyboardCache = new WeakHashMap<Key, View>();
private int mMiniKeyboardOriginX; private int mMiniKeyboardOriginX;
@ -412,15 +412,15 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
} }
} }
public LatinKeyboardBaseView(Context context, AttributeSet attrs) { public BaseKeyboardView(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.keyboardViewStyle); this(context, attrs, R.attr.keyboardViewStyle);
} }
public LatinKeyboardBaseView(Context context, AttributeSet attrs, int defStyle) { public BaseKeyboardView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes( TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.LatinKeyboardBaseView, defStyle, R.style.LatinKeyboardBaseView); attrs, R.styleable.BaseKeyboardView, defStyle, R.style.BaseKeyboardView);
LayoutInflater inflate = LayoutInflater inflate =
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
int previewLayout = 0; int previewLayout = 0;
@ -432,48 +432,48 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
int attr = a.getIndex(i); int attr = a.getIndex(i);
switch (attr) { switch (attr) {
case R.styleable.LatinKeyboardBaseView_keyBackground: case R.styleable.BaseKeyboardView_keyBackground:
mKeyBackground = a.getDrawable(attr); mKeyBackground = a.getDrawable(attr);
break; break;
case R.styleable.LatinKeyboardBaseView_keyHysteresisDistance: case R.styleable.BaseKeyboardView_keyHysteresisDistance:
mKeyHysteresisDistance = a.getDimensionPixelOffset(attr, 0); mKeyHysteresisDistance = a.getDimensionPixelOffset(attr, 0);
break; break;
case R.styleable.LatinKeyboardBaseView_verticalCorrection: case R.styleable.BaseKeyboardView_verticalCorrection:
mVerticalCorrection = a.getDimensionPixelOffset(attr, 0); mVerticalCorrection = a.getDimensionPixelOffset(attr, 0);
break; break;
case R.styleable.LatinKeyboardBaseView_keyPreviewLayout: case R.styleable.BaseKeyboardView_keyPreviewLayout:
previewLayout = a.getResourceId(attr, 0); previewLayout = a.getResourceId(attr, 0);
break; break;
case R.styleable.LatinKeyboardBaseView_keyPreviewOffset: case R.styleable.BaseKeyboardView_keyPreviewOffset:
mPreviewOffset = a.getDimensionPixelOffset(attr, 0); mPreviewOffset = a.getDimensionPixelOffset(attr, 0);
break; break;
case R.styleable.LatinKeyboardBaseView_keyPreviewHeight: case R.styleable.BaseKeyboardView_keyPreviewHeight:
mPreviewHeight = a.getDimensionPixelSize(attr, 80); mPreviewHeight = a.getDimensionPixelSize(attr, 80);
break; break;
case R.styleable.LatinKeyboardBaseView_keyTextSize: case R.styleable.BaseKeyboardView_keyTextSize:
mKeyTextSize = a.getDimensionPixelSize(attr, 18); mKeyTextSize = a.getDimensionPixelSize(attr, 18);
break; break;
case R.styleable.LatinKeyboardBaseView_keyTextColor: case R.styleable.BaseKeyboardView_keyTextColor:
mKeyTextColor = a.getColor(attr, 0xFF000000); mKeyTextColor = a.getColor(attr, 0xFF000000);
break; break;
case R.styleable.LatinKeyboardBaseView_labelTextSize: case R.styleable.BaseKeyboardView_labelTextSize:
mLabelTextSize = a.getDimensionPixelSize(attr, 14); mLabelTextSize = a.getDimensionPixelSize(attr, 14);
break; break;
case R.styleable.LatinKeyboardBaseView_popupLayout: case R.styleable.BaseKeyboardView_popupLayout:
mPopupLayout = a.getResourceId(attr, 0); mPopupLayout = a.getResourceId(attr, 0);
break; break;
case R.styleable.LatinKeyboardBaseView_shadowColor: case R.styleable.BaseKeyboardView_shadowColor:
mShadowColor = a.getColor(attr, 0); mShadowColor = a.getColor(attr, 0);
break; break;
case R.styleable.LatinKeyboardBaseView_shadowRadius: case R.styleable.BaseKeyboardView_shadowRadius:
mShadowRadius = a.getFloat(attr, 0f); mShadowRadius = a.getFloat(attr, 0f);
break; break;
// TODO: Use Theme (android.R.styleable.Theme_backgroundDimAmount) // TODO: Use Theme (android.R.styleable.Theme_backgroundDimAmount)
case R.styleable.LatinKeyboardBaseView_backgroundDimAmount: case R.styleable.BaseKeyboardView_backgroundDimAmount:
mBackgroundDimAmount = a.getFloat(attr, 0.5f); mBackgroundDimAmount = a.getFloat(attr, 0.5f);
break; break;
//case android.R.styleable. //case android.R.styleable.
case R.styleable.LatinKeyboardBaseView_keyTextStyle: case R.styleable.BaseKeyboardView_keyTextStyle:
int textStyle = a.getInt(attr, 0); int textStyle = a.getInt(attr, 0);
switch (textStyle) { switch (textStyle) {
case 0: case 0:
@ -487,7 +487,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
break; break;
} }
break; break;
case R.styleable.LatinKeyboardBaseView_symbolColorScheme: case R.styleable.BaseKeyboardView_symbolColorScheme:
mSymbolColorScheme = a.getInt(attr, 0); mSymbolColorScheme = a.getInt(attr, 0);
break; break;
} }
@ -1089,8 +1089,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
if (container == null) if (container == null)
throw new NullPointerException(); throw new NullPointerException();
LatinKeyboardBaseView miniKeyboard = BaseKeyboardView miniKeyboard =
(LatinKeyboardBaseView)container.findViewById(R.id.LatinKeyboardBaseView); (BaseKeyboardView)container.findViewById(R.id.BaseKeyboardView);
miniKeyboard.setOnKeyboardActionListener(new OnKeyboardActionListener() { miniKeyboard.setOnKeyboardActionListener(new OnKeyboardActionListener() {
public void onKey(int primaryCode, int[] keyCodes, int x, int y) { public void onKey(int primaryCode, int[] keyCodes, int x, int y) {
mKeyboardActionListener.onKey(primaryCode, keyCodes, x, y); mKeyboardActionListener.onKey(primaryCode, keyCodes, x, y);
@ -1174,7 +1174,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
container = inflateMiniKeyboardContainer(popupKey); container = inflateMiniKeyboardContainer(popupKey);
mMiniKeyboardCache.put(popupKey, container); mMiniKeyboardCache.put(popupKey, container);
} }
mMiniKeyboard = (LatinKeyboardBaseView)container.findViewById(R.id.LatinKeyboardBaseView); mMiniKeyboard = (BaseKeyboardView)container.findViewById(R.id.BaseKeyboardView);
if (mWindowOffset == null) { if (mWindowOffset == null) {
mWindowOffset = new int[2]; mWindowOffset = new int[2];
getLocationInWindow(mWindowOffset); getLocationInWindow(mWindowOffset);

View File

@ -84,7 +84,7 @@ abstract class KeyDetector {
*/ */
public int[] newCodeArray() { public int[] newCodeArray() {
int[] codes = new int[getMaxNearbyKeys()]; int[] codes = new int[getMaxNearbyKeys()];
Arrays.fill(codes, LatinKeyboardBaseView.NOT_A_KEY); Arrays.fill(codes, BaseKeyboardView.NOT_A_KEY);
return codes; return codes;
} }

View File

@ -79,7 +79,7 @@ import java.util.Map;
* Input method implementation for Qwerty'ish keyboard. * Input method implementation for Qwerty'ish keyboard.
*/ */
public class LatinIME extends InputMethodService public class LatinIME extends InputMethodService
implements LatinKeyboardBaseView.OnKeyboardActionListener, implements BaseKeyboardView.OnKeyboardActionListener,
VoiceInput.UiListener, VoiceInput.UiListener,
SharedPreferences.OnSharedPreferenceChangeListener { SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = "LatinIME"; private static final String TAG = "LatinIME";
@ -741,7 +741,7 @@ public class LatinIME extends InputMethodService
@Override @Override
public void onFinishInputView(boolean finishingInput) { public void onFinishInputView(boolean finishingInput) {
super.onFinishInputView(finishingInput); super.onFinishInputView(finishingInput);
LatinKeyboardBaseView inputView = mKeyboardSwitcher.getInputView(); BaseKeyboardView inputView = mKeyboardSwitcher.getInputView();
if (inputView != null) if (inputView != null)
inputView.setForeground(false); inputView.setForeground(false);
// Remove penging messages related to update suggestions // Remove penging messages related to update suggestions
@ -1954,8 +1954,8 @@ public class LatinIME extends InputMethodService
LatinImeLogger.logOnManualSuggestion( LatinImeLogger.logOnManualSuggestion(
"", suggestion.toString(), index, suggestions); "", suggestion.toString(), index, suggestions);
final char primaryCode = suggestion.charAt(0); final char primaryCode = suggestion.charAt(0);
onKey(primaryCode, new int[]{primaryCode}, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, onKey(primaryCode, new int[]{primaryCode}, BaseKeyboardView.NOT_A_TOUCH_COORDINATE,
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); BaseKeyboardView.NOT_A_TOUCH_COORDINATE);
if (ic != null) { if (ic != null) {
ic.endBatchEdit(); ic.endBatchEdit();
} }

View File

@ -30,7 +30,7 @@ import android.view.MotionEvent;
import java.util.List; import java.util.List;
public class LatinKeyboardView extends LatinKeyboardBaseView { public class LatinKeyboardView extends BaseKeyboardView {
public static final int KEYCODE_OPTIONS = -100; public static final int KEYCODE_OPTIONS = -100;
public static final int KEYCODE_OPTIONS_LONGPRESS = -101; public static final int KEYCODE_OPTIONS_LONGPRESS = -101;
@ -110,8 +110,8 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
private boolean invokeOnKey(int primaryCode) { private boolean invokeOnKey(int primaryCode) {
getOnKeyboardActionListener().onKey(primaryCode, null, getOnKeyboardActionListener().onKey(primaryCode, null,
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, BaseKeyboardView.NOT_A_TOUCH_COORDINATE,
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); BaseKeyboardView.NOT_A_TOUCH_COORDINATE);
return true; return true;
} }

View File

@ -41,7 +41,7 @@ class MiniKeyboardKeyDetector extends KeyDetector {
final Key[] keys = getKeys(); final Key[] keys = getKeys();
final int touchX = getTouchX(x); final int touchX = getTouchX(x);
final int touchY = getTouchY(y); final int touchY = getTouchY(y);
int closestKeyIndex = LatinKeyboardBaseView.NOT_A_KEY; int closestKeyIndex = BaseKeyboardView.NOT_A_KEY;
int closestKeyDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare; int closestKeyDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare;
final int keyCount = keys.length; final int keyCount = keys.length;
for (int i = 0; i < keyCount; i++) { for (int i = 0; i < keyCount; i++) {
@ -52,7 +52,7 @@ class MiniKeyboardKeyDetector extends KeyDetector {
closestKeyDist = dist; closestKeyDist = dist;
} }
} }
if (allKeys != null && closestKeyIndex != LatinKeyboardBaseView.NOT_A_KEY) if (allKeys != null && closestKeyIndex != BaseKeyboardView.NOT_A_KEY)
allKeys[0] = keys[closestKeyIndex].codes[0]; allKeys[0] = keys[closestKeyIndex].codes[0];
return closestKeyIndex; return closestKeyIndex;
} }

View File

@ -17,8 +17,8 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.latin.BaseKeyboard.Key; import com.android.inputmethod.latin.BaseKeyboard.Key;
import com.android.inputmethod.latin.LatinKeyboardBaseView.OnKeyboardActionListener; import com.android.inputmethod.latin.BaseKeyboardView.OnKeyboardActionListener;
import com.android.inputmethod.latin.LatinKeyboardBaseView.UIHandler; import com.android.inputmethod.latin.BaseKeyboardView.UIHandler;
import android.content.res.Resources; import android.content.res.Resources;
import android.util.Log; import android.util.Log;
@ -44,7 +44,7 @@ public class PointerTracker {
private final int mMultiTapKeyTimeout; private final int mMultiTapKeyTimeout;
// Miscellaneous constants // Miscellaneous constants
private static final int NOT_A_KEY = LatinKeyboardBaseView.NOT_A_KEY; private static final int NOT_A_KEY = BaseKeyboardView.NOT_A_KEY;
private static final int[] KEY_DELETE = { BaseKeyboard.KEYCODE_DELETE }; private static final int[] KEY_DELETE = { BaseKeyboard.KEYCODE_DELETE };
private final UIProxy mProxy; private final UIProxy mProxy;

View File

@ -36,8 +36,8 @@ class ProximityKeyDetector extends KeyDetector {
final Key[] keys = getKeys(); final Key[] keys = getKeys();
final int touchX = getTouchX(x); final int touchX = getTouchX(x);
final int touchY = getTouchY(y); final int touchY = getTouchY(y);
int primaryIndex = LatinKeyboardBaseView.NOT_A_KEY; int primaryIndex = BaseKeyboardView.NOT_A_KEY;
int closestKey = LatinKeyboardBaseView.NOT_A_KEY; int closestKey = BaseKeyboardView.NOT_A_KEY;
int closestKeyDist = mProximityThresholdSquare + 1; int closestKeyDist = mProximityThresholdSquare + 1;
int[] distances = mDistances; int[] distances = mDistances;
Arrays.fill(distances, Integer.MAX_VALUE); Arrays.fill(distances, Integer.MAX_VALUE);
@ -78,7 +78,7 @@ class ProximityKeyDetector extends KeyDetector {
} }
} }
} }
if (primaryIndex == LatinKeyboardBaseView.NOT_A_KEY) { if (primaryIndex == BaseKeyboardView.NOT_A_KEY) {
primaryIndex = closestKey; primaryIndex = closestKey;
} }
return primaryIndex; return primaryIndex;