aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-08-06 00:59:03 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-06 00:59:03 -0700
commit6983cf4a191dd6b0eb93bf7b126931f458f39ace (patch)
treecdcfe37bb5974a101770fa78bc1b898c835e29ae /java/src
parentcadb2128f54b49be31bb4dc06374afe81ed028b7 (diff)
parent1149abd876a5d6305076ad88e4d9adb164abf11f (diff)
downloadlatinime-6983cf4a191dd6b0eb93bf7b126931f458f39ace.tar.gz
latinime-6983cf4a191dd6b0eb93bf7b126931f458f39ace.tar.xz
latinime-6983cf4a191dd6b0eb93bf7b126931f458f39ace.zip
Merge "Remove all key preview from placer when window gets hide"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java20
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java3
2 files changed, 14 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index aab58b52c..da3aa50c5 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -35,6 +35,7 @@ import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.inputmethod.compat.FrameLayoutCompatUtils;
@@ -349,8 +350,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
* @param keyboard the keyboard to display in this view
*/
public void setKeyboard(Keyboard keyboard) {
- // Remove any pending messages, except dismissing preview
+ // Remove any pending dismissing preview
mDrawingHandler.cancelAllShowKeyPreviews();
+ if (mKeyboard != null) {
+ PointerTracker.dismissAllKeyPreviews();
+ }
mKeyboard = keyboard;
LatinImeLogger.onSetKeyboard(keyboard);
requestLayout();
@@ -788,14 +792,15 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
private void addKeyPreview(TextView keyPreview) {
if (mPreviewPlacer == null) {
- mPreviewPlacer = FrameLayoutCompatUtils.getPlacer(
- (ViewGroup)getRootView().findViewById(android.R.id.content));
+ mPreviewPlacer = new RelativeLayout(getContext());
+ final ViewGroup windowContentView =
+ (ViewGroup)getRootView().findViewById(android.R.id.content);
+ windowContentView.addView(mPreviewPlacer);
}
- final ViewGroup placer = mPreviewPlacer;
- placer.addView(keyPreview, FrameLayoutCompatUtils.newLayoutParam(placer, 0, 0));
+ mPreviewPlacer.addView(
+ keyPreview, FrameLayoutCompatUtils.newLayoutParam(mPreviewPlacer, 0, 0));
}
- // TODO: Introduce minimum duration for displaying key previews
private void showKey(final int keyIndex, PointerTracker tracker) {
final TextView previewText = tracker.getKeyPreviewText();
// If the key preview has no parent view yet, add it to the ViewGroup which can place
@@ -914,5 +919,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
closing();
+ if (mPreviewPlacer != null) {
+ mPreviewPlacer.removeAllViews();
+ }
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java
index abf28c73c..12aadcb5c 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java
@@ -281,9 +281,6 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
*/
@Override
public void setKeyboard(Keyboard keyboard) {
- if (getKeyboard() != null) {
- PointerTracker.dismissAllKeyPreviews();
- }
// Remove any pending messages, except dismissing preview
mKeyTimerHandler.cancelKeyTimers();
super.setKeyboard(keyboard);