aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-08-30 21:09:44 +0900
committerTadashi G. Takaoka <takaoka@google.com>2010-08-30 21:20:55 +0900
commitd2a431efa726771dee5c7b90004a0ed670d9a129 (patch)
tree93115477711d20a1da9382617b4d2291cf2bca82 /java/src
parent4fc6539bcb8a99b489b5cb72bfc977b9829f5603 (diff)
downloadlatinime-d2a431efa726771dee5c7b90004a0ed670d9a129.tar.gz
latinime-d2a431efa726771dee5c7b90004a0ed670d9a129.tar.xz
latinime-d2a431efa726771dee5c7b90004a0ed670d9a129.zip
Remove extension keyboard
Bug: 2959287 Change-Id: I344ac58b4119e96daf5928c784275ee0b7095958
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/KeyboardSwitcher.java9
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboard.java9
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboardView.java184
3 files changed, 9 insertions, 193 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index dec29b7cb..45a54b1aa 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -261,14 +261,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|| id.mXml == R.xml.kbd_symbols_black), mHasVoice);
keyboard.setLanguageSwitcher(mLanguageSwitcher);
keyboard.setBlackFlag(isBlackSym());
- if (id.mKeyboardMode == KEYBOARDMODE_NORMAL
- || id.mKeyboardMode == KEYBOARDMODE_URL
- || id.mKeyboardMode == KEYBOARDMODE_IM
- || id.mKeyboardMode == KEYBOARDMODE_EMAIL
- || id.mKeyboardMode == KEYBOARDMODE_WEB
- ) {
- keyboard.setExtension(R.xml.kbd_extension);
- }
if (id.mEnableShiftLock) {
keyboard.enableShiftLock();
@@ -439,7 +431,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mLayoutId + "," + newLayout, e);
}
}
- mInputView.setExtentionLayoutResId(THEMES[newLayout]);
mInputView.setOnKeyboardActionListener(mInputMethodService);
mLayoutId = newLayout;
}
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
index db4d167d4..c35a1b05a 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
@@ -81,7 +81,6 @@ public class LatinKeyboard extends Keyboard {
private int mPrefLetterY;
private int mPrefDistance;
- private int mExtensionResId;
// TODO: generalize for any keyboardId
private boolean mIsBlackSym;
@@ -278,14 +277,6 @@ public class LatinKeyboard extends Keyboard {
return mIsAlphaKeyboard;
}
- public void setExtension(int resId) {
- mExtensionResId = resId;
- }
-
- public int getExtension() {
- return mExtensionResId;
- }
-
public void setBlackFlag(boolean f) {
mIsBlackSym = f;
if (f) {
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
index cca0de18e..7a993669b 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
@@ -16,8 +16,6 @@
package com.android.inputmethod.latin;
-import java.util.List;
-
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
@@ -27,9 +25,9 @@ import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.util.AttributeSet;
-import android.view.LayoutInflater;
import android.view.MotionEvent;
-import android.widget.PopupWindow;
+
+import java.util.List;
public class LatinKeyboardView extends LatinKeyboardBaseView {
@@ -41,21 +39,11 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
private Keyboard mPhoneKeyboard;
- /** Whether the extension of this keyboard is visible */
- private boolean mExtensionVisible;
- /** The view that is shown as an extension of this keyboard view */
- private LatinKeyboardView mExtension;
- /** The popup window that contains the extension of this keyboard */
- private PopupWindow mExtensionPopup;
- /** Whether this view is an extension of another keyboard */
- private boolean mIsExtensionType;
- private boolean mFirstEvent;
/** Whether we've started dropping move events because we found a big jump */
private boolean mDroppingEvents;
/**
- * Whether multi-touch disambiguation needs to be disabled for any reason. There are 2 reasons
- * for this to happen - (1) if a real multi-touch event has occured and (2) we've opened an
- * extension keyboard.
+ * Whether multi-touch disambiguation needs to be disabled if a real multi-touch event has
+ * occured
*/
private boolean mDisableDisambiguation;
/** The distance threshold at which we start treating the touch session as a multi-touch */
@@ -63,8 +51,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
/** The y coordinate of the last row */
private int mLastRowY;
- private int mExtensionLayoutResId = 0;
-
public LatinKeyboardView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -77,10 +63,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
mPhoneKeyboard = phoneKeyboard;
}
- public void setExtentionLayoutResId (int id) {
- mExtensionLayoutResId = id;
- }
-
@Override
public void setKeyboard(Keyboard k) {
super.setKeyboard(k);
@@ -214,11 +196,10 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
invalidate();
}
- // If an extension keyboard is visible or this is an extension keyboard, don't look
- // for sudden jumps. Otherwise, if there was a sudden jump, return without processing the
- // actual motion event.
- if (!mExtensionVisible && !mIsExtensionType
- && handleSuddenJump(me)) return true;
+ // If there was a sudden jump, return without processing the actual motion event.
+ if (handleSuddenJump(me))
+ return true;
+
// Reset any bounding box controls in the keyboard
if (me.getAction() == MotionEvent.ACTION_DOWN) {
keyboard.keyReleased();
@@ -236,154 +217,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
}
}
- // If we don't have an extension keyboard, don't go any further.
- if (keyboard.getExtension() == 0) {
- return super.onTouchEvent(me);
- }
- // If the motion event is above the keyboard and it's not an UP event coming
- // even before the first MOVE event into the extension area
- if (me.getY() < 0 && (mExtensionVisible || me.getAction() != MotionEvent.ACTION_UP)) {
- if (mExtensionVisible) {
- int action = me.getAction();
- if (mFirstEvent) action = MotionEvent.ACTION_DOWN;
- mFirstEvent = false;
- MotionEvent translated = MotionEvent.obtain(me.getEventTime(), me.getEventTime(),
- action,
- me.getX(), me.getY() + mExtension.getHeight(), me.getMetaState());
- boolean result = mExtension.onTouchEvent(translated);
- translated.recycle();
- if (me.getAction() == MotionEvent.ACTION_UP
- || me.getAction() == MotionEvent.ACTION_CANCEL) {
- closeExtension();
- }
- return result;
- } else {
- if (openExtension()) {
- MotionEvent cancel = MotionEvent.obtain(me.getDownTime(), me.getEventTime(),
- MotionEvent.ACTION_CANCEL, me.getX() - 100, me.getY() - 100, 0);
- super.onTouchEvent(cancel);
- cancel.recycle();
- if (mExtension.getHeight() > 0) {
- MotionEvent translated = MotionEvent.obtain(me.getEventTime(),
- me.getEventTime(),
- MotionEvent.ACTION_DOWN,
- me.getX(), me.getY() + mExtension.getHeight(),
- me.getMetaState());
- mExtension.onTouchEvent(translated);
- translated.recycle();
- } else {
- mFirstEvent = true;
- }
- // Stop processing multi-touch errors
- mDisableDisambiguation = true;
- }
- return true;
- }
- } else if (mExtensionVisible) {
- closeExtension();
- // Send a down event into the main keyboard first
- MotionEvent down = MotionEvent.obtain(me.getEventTime(), me.getEventTime(),
- MotionEvent.ACTION_DOWN,
- me.getX(), me.getY(), me.getMetaState());
- super.onTouchEvent(down);
- down.recycle();
- // Send the actual event
- return super.onTouchEvent(me);
- } else {
- return super.onTouchEvent(me);
- }
- }
-
- private void setExtensionType(boolean isExtensionType) {
- mIsExtensionType = isExtensionType;
- }
-
- private boolean openExtension() {
- // If the current keyboard is not visible, don't show the popup
- if (!isShown()) {
- return false;
- }
- if (((LatinKeyboard) getKeyboard()).getExtension() == 0) return false;
- makePopupWindow();
- mExtensionVisible = true;
- return true;
- }
-
- private void makePopupWindow() {
- if (mExtensionPopup == null) {
- int[] windowLocation = new int[2];
- mExtensionPopup = new PopupWindow(getContext());
- mExtensionPopup.setBackgroundDrawable(null);
- LayoutInflater li = (LayoutInflater) getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
- mExtension = (LatinKeyboardView) li.inflate(mExtensionLayoutResId == 0 ?
- R.layout.input_trans : mExtensionLayoutResId, null);
- mExtension.setExtensionType(true);
- mExtension.setOnKeyboardActionListener(
- new ExtensionKeyboardListener(getOnKeyboardActionListener()));
- mExtension.setPopupParent(this);
- mExtension.setPopupOffset(0, -windowLocation[1]);
- Keyboard keyboard;
- mExtension.setKeyboard(keyboard = new LatinKeyboard(getContext(),
- ((LatinKeyboard) getKeyboard()).getExtension()));
- mExtensionPopup.setContentView(mExtension);
- mExtensionPopup.setWidth(getWidth());
- mExtensionPopup.setHeight(keyboard.getHeight());
- mExtensionPopup.setAnimationStyle(-1);
- getLocationInWindow(windowLocation);
- // TODO: Fix the "- 30".
- mExtension.setPopupOffset(0, -windowLocation[1] - 30);
- mExtensionPopup.showAtLocation(this, 0, 0, -keyboard.getHeight()
- + windowLocation[1]);
- } else {
- mExtension.setVisibility(VISIBLE);
- }
- }
-
- @Override
- public void closing() {
- super.closing();
- if (mExtensionPopup != null && mExtensionPopup.isShowing()) {
- mExtensionPopup.dismiss();
- mExtensionPopup = null;
- }
- }
-
- private void closeExtension() {
- mExtension.closing();
- mExtension.setVisibility(INVISIBLE);
- mExtensionVisible = false;
- }
-
- private static class ExtensionKeyboardListener implements OnKeyboardActionListener {
- private OnKeyboardActionListener mTarget;
- ExtensionKeyboardListener(OnKeyboardActionListener target) {
- mTarget = target;
- }
- public void onKey(int primaryCode, int[] keyCodes, int x, int y) {
- mTarget.onKey(primaryCode, keyCodes, x, y);
- }
- public void onPress(int primaryCode) {
- mTarget.onPress(primaryCode);
- }
- public void onRelease(int primaryCode) {
- mTarget.onRelease(primaryCode);
- }
- public void onText(CharSequence text) {
- mTarget.onText(text);
- }
- public void swipeDown() {
- // Don't pass through
- }
- public void swipeLeft() {
- // Don't pass through
- }
- public void swipeRight() {
- // Don't pass through
- }
- public void swipeUp() {
- // Don't pass through
- }
+ return super.onTouchEvent(me);
}
/**************************** INSTRUMENTATION *******************************/