Skip to content
Snippets Groups Projects
Commit 1149abd8 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Remove all key preview from placer when window gets hide

Bug: 5130302
Change-Id: I70e3737c33bfbac99366ab36d3437b0801f5140a
parent 60a004f7
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ import android.util.TypedValue; ...@@ -35,6 +35,7 @@ import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.android.inputmethod.compat.FrameLayoutCompatUtils; import com.android.inputmethod.compat.FrameLayoutCompatUtils;
...@@ -349,8 +350,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { ...@@ -349,8 +350,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
* @param keyboard the keyboard to display in this view * @param keyboard the keyboard to display in this view
*/ */
public void setKeyboard(Keyboard keyboard) { public void setKeyboard(Keyboard keyboard) {
// Remove any pending messages, except dismissing preview // Remove any pending dismissing preview
mDrawingHandler.cancelAllShowKeyPreviews(); mDrawingHandler.cancelAllShowKeyPreviews();
if (mKeyboard != null) {
PointerTracker.dismissAllKeyPreviews();
}
mKeyboard = keyboard; mKeyboard = keyboard;
LatinImeLogger.onSetKeyboard(keyboard); LatinImeLogger.onSetKeyboard(keyboard);
requestLayout(); requestLayout();
...@@ -788,14 +792,15 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { ...@@ -788,14 +792,15 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
private void addKeyPreview(TextView keyPreview) { private void addKeyPreview(TextView keyPreview) {
if (mPreviewPlacer == null) { if (mPreviewPlacer == null) {
mPreviewPlacer = FrameLayoutCompatUtils.getPlacer( mPreviewPlacer = new RelativeLayout(getContext());
(ViewGroup)getRootView().findViewById(android.R.id.content)); final ViewGroup windowContentView =
(ViewGroup)getRootView().findViewById(android.R.id.content);
windowContentView.addView(mPreviewPlacer);
} }
final ViewGroup placer = mPreviewPlacer; mPreviewPlacer.addView(
placer.addView(keyPreview, FrameLayoutCompatUtils.newLayoutParam(placer, 0, 0)); keyPreview, FrameLayoutCompatUtils.newLayoutParam(mPreviewPlacer, 0, 0));
} }
// TODO: Introduce minimum duration for displaying key previews
private void showKey(final int keyIndex, PointerTracker tracker) { private void showKey(final int keyIndex, PointerTracker tracker) {
final TextView previewText = tracker.getKeyPreviewText(); final TextView previewText = tracker.getKeyPreviewText();
// If the key preview has no parent view yet, add it to the ViewGroup which can place // 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 { ...@@ -914,5 +919,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
public void onDetachedFromWindow() { public void onDetachedFromWindow() {
super.onDetachedFromWindow(); super.onDetachedFromWindow();
closing(); closing();
if (mPreviewPlacer != null) {
mPreviewPlacer.removeAllViews();
}
} }
} }
...@@ -281,9 +281,6 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke ...@@ -281,9 +281,6 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
*/ */
@Override @Override
public void setKeyboard(Keyboard keyboard) { public void setKeyboard(Keyboard keyboard) {
if (getKeyboard() != null) {
PointerTracker.dismissAllKeyPreviews();
}
// Remove any pending messages, except dismissing preview // Remove any pending messages, except dismissing preview
mKeyTimerHandler.cancelKeyTimers(); mKeyTimerHandler.cancelKeyTimers();
super.setKeyboard(keyboard); super.setKeyboard(keyboard);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment