Rename LatinKeyboardBaseView class to KeyboardBaseView
Change-Id: I496ecbfa7d398583d01f821398f49f75d17311d8main
parent
38976d5b96
commit
68864723cf
|
@ -25,9 +25,9 @@
|
|||
android:orientation="horizontal"
|
||||
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"
|
||||
android:id="@+id/LatinKeyboardBaseView"
|
||||
android:id="@+id/BaseKeyboardView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
android:paddingLeft="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"
|
||||
android:id="@+id/LatinKeyboardBaseView"
|
||||
android:id="@+id/BaseKeyboardView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<resources>
|
||||
|
||||
<declare-styleable name="LatinKeyboardBaseView">
|
||||
<declare-styleable name="BaseKeyboardView">
|
||||
<!-- Default KeyboardView style. -->
|
||||
<attr name="keyboardViewStyle" format="reference" />
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<style name="LatinKeyboardBaseView">
|
||||
<style name="BaseKeyboardView">
|
||||
<item name="android:background">@drawable/keyboard_background</item>
|
||||
|
||||
<item name="keyBackground">@drawable/btn_keyboard_key</item>
|
||||
|
|
|
@ -59,17 +59,17 @@ import java.util.WeakHashMap;
|
|||
*
|
||||
* 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#LatinKeyboardBaseView_keyPreviewLayout
|
||||
* @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewOffset
|
||||
* @attr ref R.styleable#LatinKeyboardBaseView_labelTextSize
|
||||
* @attr ref R.styleable#LatinKeyboardBaseView_keyTextSize
|
||||
* @attr ref R.styleable#LatinKeyboardBaseView_keyTextColor
|
||||
* @attr ref R.styleable#LatinKeyboardBaseView_verticalCorrection
|
||||
* @attr ref R.styleable#LatinKeyboardBaseView_popupLayout
|
||||
* @attr ref R.styleable#BaseKeyboardView_keyBackground
|
||||
* @attr ref R.styleable#BaseKeyboardView_keyPreviewLayout
|
||||
* @attr ref R.styleable#BaseKeyboardView_keyPreviewOffset
|
||||
* @attr ref R.styleable#BaseKeyboardView_labelTextSize
|
||||
* @attr ref R.styleable#BaseKeyboardView_keyTextSize
|
||||
* @attr ref R.styleable#BaseKeyboardView_keyTextColor
|
||||
* @attr ref R.styleable#BaseKeyboardView_verticalCorrection
|
||||
* @attr ref R.styleable#BaseKeyboardView_popupLayout
|
||||
*/
|
||||
public class LatinKeyboardBaseView extends View implements PointerTracker.UIProxy {
|
||||
private static final String TAG = "LatinKeyboardBaseView";
|
||||
public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||
private static final String TAG = "BaseKeyboardView";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
public static final int NOT_A_TOUCH_COORDINATE = -1;
|
||||
|
@ -204,7 +204,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
|||
|
||||
// Popup mini keyboard
|
||||
private PopupWindow mMiniKeyboardPopup;
|
||||
private LatinKeyboardBaseView mMiniKeyboard;
|
||||
private BaseKeyboardView mMiniKeyboard;
|
||||
private View mMiniKeyboardParent;
|
||||
private final WeakHashMap<Key, View> mMiniKeyboardCache = new WeakHashMap<Key, View>();
|
||||
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);
|
||||
}
|
||||
|
||||
public LatinKeyboardBaseView(Context context, AttributeSet attrs, int defStyle) {
|
||||
public BaseKeyboardView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(
|
||||
attrs, R.styleable.LatinKeyboardBaseView, defStyle, R.style.LatinKeyboardBaseView);
|
||||
attrs, R.styleable.BaseKeyboardView, defStyle, R.style.BaseKeyboardView);
|
||||
LayoutInflater inflate =
|
||||
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
int previewLayout = 0;
|
||||
|
@ -432,48 +432,48 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
|||
int attr = a.getIndex(i);
|
||||
|
||||
switch (attr) {
|
||||
case R.styleable.LatinKeyboardBaseView_keyBackground:
|
||||
case R.styleable.BaseKeyboardView_keyBackground:
|
||||
mKeyBackground = a.getDrawable(attr);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_keyHysteresisDistance:
|
||||
case R.styleable.BaseKeyboardView_keyHysteresisDistance:
|
||||
mKeyHysteresisDistance = a.getDimensionPixelOffset(attr, 0);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_verticalCorrection:
|
||||
case R.styleable.BaseKeyboardView_verticalCorrection:
|
||||
mVerticalCorrection = a.getDimensionPixelOffset(attr, 0);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_keyPreviewLayout:
|
||||
case R.styleable.BaseKeyboardView_keyPreviewLayout:
|
||||
previewLayout = a.getResourceId(attr, 0);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_keyPreviewOffset:
|
||||
case R.styleable.BaseKeyboardView_keyPreviewOffset:
|
||||
mPreviewOffset = a.getDimensionPixelOffset(attr, 0);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_keyPreviewHeight:
|
||||
case R.styleable.BaseKeyboardView_keyPreviewHeight:
|
||||
mPreviewHeight = a.getDimensionPixelSize(attr, 80);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_keyTextSize:
|
||||
case R.styleable.BaseKeyboardView_keyTextSize:
|
||||
mKeyTextSize = a.getDimensionPixelSize(attr, 18);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_keyTextColor:
|
||||
case R.styleable.BaseKeyboardView_keyTextColor:
|
||||
mKeyTextColor = a.getColor(attr, 0xFF000000);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_labelTextSize:
|
||||
case R.styleable.BaseKeyboardView_labelTextSize:
|
||||
mLabelTextSize = a.getDimensionPixelSize(attr, 14);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_popupLayout:
|
||||
case R.styleable.BaseKeyboardView_popupLayout:
|
||||
mPopupLayout = a.getResourceId(attr, 0);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_shadowColor:
|
||||
case R.styleable.BaseKeyboardView_shadowColor:
|
||||
mShadowColor = a.getColor(attr, 0);
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_shadowRadius:
|
||||
case R.styleable.BaseKeyboardView_shadowRadius:
|
||||
mShadowRadius = a.getFloat(attr, 0f);
|
||||
break;
|
||||
// TODO: Use Theme (android.R.styleable.Theme_backgroundDimAmount)
|
||||
case R.styleable.LatinKeyboardBaseView_backgroundDimAmount:
|
||||
case R.styleable.BaseKeyboardView_backgroundDimAmount:
|
||||
mBackgroundDimAmount = a.getFloat(attr, 0.5f);
|
||||
break;
|
||||
//case android.R.styleable.
|
||||
case R.styleable.LatinKeyboardBaseView_keyTextStyle:
|
||||
case R.styleable.BaseKeyboardView_keyTextStyle:
|
||||
int textStyle = a.getInt(attr, 0);
|
||||
switch (textStyle) {
|
||||
case 0:
|
||||
|
@ -487,7 +487,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_symbolColorScheme:
|
||||
case R.styleable.BaseKeyboardView_symbolColorScheme:
|
||||
mSymbolColorScheme = a.getInt(attr, 0);
|
||||
break;
|
||||
}
|
||||
|
@ -1089,8 +1089,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
|||
if (container == null)
|
||||
throw new NullPointerException();
|
||||
|
||||
LatinKeyboardBaseView miniKeyboard =
|
||||
(LatinKeyboardBaseView)container.findViewById(R.id.LatinKeyboardBaseView);
|
||||
BaseKeyboardView miniKeyboard =
|
||||
(BaseKeyboardView)container.findViewById(R.id.BaseKeyboardView);
|
||||
miniKeyboard.setOnKeyboardActionListener(new OnKeyboardActionListener() {
|
||||
public void onKey(int primaryCode, int[] keyCodes, int x, int y) {
|
||||
mKeyboardActionListener.onKey(primaryCode, keyCodes, x, y);
|
||||
|
@ -1174,7 +1174,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
|||
container = inflateMiniKeyboardContainer(popupKey);
|
||||
mMiniKeyboardCache.put(popupKey, container);
|
||||
}
|
||||
mMiniKeyboard = (LatinKeyboardBaseView)container.findViewById(R.id.LatinKeyboardBaseView);
|
||||
mMiniKeyboard = (BaseKeyboardView)container.findViewById(R.id.BaseKeyboardView);
|
||||
if (mWindowOffset == null) {
|
||||
mWindowOffset = new int[2];
|
||||
getLocationInWindow(mWindowOffset);
|
|
@ -84,7 +84,7 @@ abstract class KeyDetector {
|
|||
*/
|
||||
public int[] newCodeArray() {
|
||||
int[] codes = new int[getMaxNearbyKeys()];
|
||||
Arrays.fill(codes, LatinKeyboardBaseView.NOT_A_KEY);
|
||||
Arrays.fill(codes, BaseKeyboardView.NOT_A_KEY);
|
||||
return codes;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ import java.util.Map;
|
|||
* Input method implementation for Qwerty'ish keyboard.
|
||||
*/
|
||||
public class LatinIME extends InputMethodService
|
||||
implements LatinKeyboardBaseView.OnKeyboardActionListener,
|
||||
implements BaseKeyboardView.OnKeyboardActionListener,
|
||||
VoiceInput.UiListener,
|
||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private static final String TAG = "LatinIME";
|
||||
|
@ -741,7 +741,7 @@ public class LatinIME extends InputMethodService
|
|||
@Override
|
||||
public void onFinishInputView(boolean finishingInput) {
|
||||
super.onFinishInputView(finishingInput);
|
||||
LatinKeyboardBaseView inputView = mKeyboardSwitcher.getInputView();
|
||||
BaseKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
||||
if (inputView != null)
|
||||
inputView.setForeground(false);
|
||||
// Remove penging messages related to update suggestions
|
||||
|
@ -1954,8 +1954,8 @@ public class LatinIME extends InputMethodService
|
|||
LatinImeLogger.logOnManualSuggestion(
|
||||
"", suggestion.toString(), index, suggestions);
|
||||
final char primaryCode = suggestion.charAt(0);
|
||||
onKey(primaryCode, new int[]{primaryCode}, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
|
||||
onKey(primaryCode, new int[]{primaryCode}, BaseKeyboardView.NOT_A_TOUCH_COORDINATE,
|
||||
BaseKeyboardView.NOT_A_TOUCH_COORDINATE);
|
||||
if (ic != null) {
|
||||
ic.endBatchEdit();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import android.view.MotionEvent;
|
|||
|
||||
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_LONGPRESS = -101;
|
||||
|
@ -110,8 +110,8 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
|
||||
private boolean invokeOnKey(int primaryCode) {
|
||||
getOnKeyboardActionListener().onKey(primaryCode, null,
|
||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
|
||||
BaseKeyboardView.NOT_A_TOUCH_COORDINATE,
|
||||
BaseKeyboardView.NOT_A_TOUCH_COORDINATE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class MiniKeyboardKeyDetector extends KeyDetector {
|
|||
final Key[] keys = getKeys();
|
||||
final int touchX = getTouchX(x);
|
||||
final int touchY = getTouchY(y);
|
||||
int closestKeyIndex = LatinKeyboardBaseView.NOT_A_KEY;
|
||||
int closestKeyIndex = BaseKeyboardView.NOT_A_KEY;
|
||||
int closestKeyDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare;
|
||||
final int keyCount = keys.length;
|
||||
for (int i = 0; i < keyCount; i++) {
|
||||
|
@ -52,7 +52,7 @@ class MiniKeyboardKeyDetector extends KeyDetector {
|
|||
closestKeyDist = dist;
|
||||
}
|
||||
}
|
||||
if (allKeys != null && closestKeyIndex != LatinKeyboardBaseView.NOT_A_KEY)
|
||||
if (allKeys != null && closestKeyIndex != BaseKeyboardView.NOT_A_KEY)
|
||||
allKeys[0] = keys[closestKeyIndex].codes[0];
|
||||
return closestKeyIndex;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package com.android.inputmethod.latin;
|
||||
|
||||
import com.android.inputmethod.latin.BaseKeyboard.Key;
|
||||
import com.android.inputmethod.latin.LatinKeyboardBaseView.OnKeyboardActionListener;
|
||||
import com.android.inputmethod.latin.LatinKeyboardBaseView.UIHandler;
|
||||
import com.android.inputmethod.latin.BaseKeyboardView.OnKeyboardActionListener;
|
||||
import com.android.inputmethod.latin.BaseKeyboardView.UIHandler;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.util.Log;
|
||||
|
@ -44,7 +44,7 @@ public class PointerTracker {
|
|||
private final int mMultiTapKeyTimeout;
|
||||
|
||||
// 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 final UIProxy mProxy;
|
||||
|
|
|
@ -36,8 +36,8 @@ class ProximityKeyDetector extends KeyDetector {
|
|||
final Key[] keys = getKeys();
|
||||
final int touchX = getTouchX(x);
|
||||
final int touchY = getTouchY(y);
|
||||
int primaryIndex = LatinKeyboardBaseView.NOT_A_KEY;
|
||||
int closestKey = LatinKeyboardBaseView.NOT_A_KEY;
|
||||
int primaryIndex = BaseKeyboardView.NOT_A_KEY;
|
||||
int closestKey = BaseKeyboardView.NOT_A_KEY;
|
||||
int closestKeyDist = mProximityThresholdSquare + 1;
|
||||
int[] distances = mDistances;
|
||||
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;
|
||||
}
|
||||
return primaryIndex;
|
||||
|
|
Loading…
Reference in New Issue