Potential fix for extension keyboard not cleaning up bubbles sometimes.

This might also fix the keyboard closing suddenly when using the extension.
Re-enable bubble for landscape extension keyboard, since the framework can
now display it to the side.
main
Amith Yamasani 2010-03-19 17:31:54 -07:00
parent 7be15a1899
commit bad436e93b
2 changed files with 37 additions and 7 deletions

View File

@ -25,5 +25,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#A0000000" android:background="#A0000000"
android:verticalCorrection="0dip"
android:keyBackground="@drawable/btn_keyboard_key_fulltrans" android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
/> />

View File

@ -19,11 +19,11 @@ package com.android.inputmethod.latin;
import java.util.List; import java.util.List;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.inputmethodservice.Keyboard; import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView; import android.inputmethodservice.KeyboardView;
import android.inputmethodservice.KeyboardView.OnKeyboardActionListener;
import android.inputmethodservice.Keyboard.Key; import android.inputmethodservice.Keyboard.Key;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
@ -173,19 +173,17 @@ public class LatinKeyboardView extends KeyboardView {
LayoutInflater li = (LayoutInflater) getContext().getSystemService( LayoutInflater li = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE); Context.LAYOUT_INFLATER_SERVICE);
mExtension = (LatinKeyboardView) li.inflate(R.layout.input_trans, null); mExtension = (LatinKeyboardView) li.inflate(R.layout.input_trans, null);
mExtension.setOnKeyboardActionListener((LatinIME) getContext()); mExtension.setOnKeyboardActionListener(
new ExtensionKeyboardListener(getOnKeyboardActionListener()));
mExtension.setPopupParent(this); mExtension.setPopupParent(this);
mExtension.setPopupOffset(0, -windowLocation[1]); mExtension.setPopupOffset(0, -windowLocation[1]);
Keyboard keyboard; Keyboard keyboard;
mExtension.setKeyboard(keyboard = new LatinKeyboard(getContext(), mExtension.setKeyboard(keyboard = new LatinKeyboard(getContext(),
((LatinKeyboard) getKeyboard()).getExtension())); ((LatinKeyboard) getKeyboard()).getExtension()));
if (getContext().getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE) {
mExtension.setPreviewEnabled(false);
}
mExtensionPopup.setContentView(mExtension); mExtensionPopup.setContentView(mExtension);
mExtensionPopup.setWidth(getWidth()); mExtensionPopup.setWidth(getWidth());
mExtensionPopup.setHeight(keyboard.getHeight()); mExtensionPopup.setHeight(keyboard.getHeight());
mExtensionPopup.setAnimationStyle(-1);
getLocationInWindow(windowLocation); getLocationInWindow(windowLocation);
// TODO: Fix the "- 30". // TODO: Fix the "- 30".
mExtension.setPopupOffset(0, -windowLocation[1] - 30); mExtension.setPopupOffset(0, -windowLocation[1] - 30);
@ -206,11 +204,42 @@ public class LatinKeyboardView extends KeyboardView {
} }
private void closeExtension() { private void closeExtension() {
mExtension.setVisibility(INVISIBLE);
mExtension.closing(); mExtension.closing();
mExtension.setVisibility(INVISIBLE);
mExtensionVisible = false; mExtensionVisible = false;
} }
private static class ExtensionKeyboardListener implements OnKeyboardActionListener {
private OnKeyboardActionListener mTarget;
ExtensionKeyboardListener(OnKeyboardActionListener target) {
mTarget = target;
}
public void onKey(int primaryCode, int[] keyCodes) {
mTarget.onKey(primaryCode, keyCodes);
}
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
}
}
/**************************** INSTRUMENTATION *******************************/ /**************************** INSTRUMENTATION *******************************/
static final boolean DEBUG_AUTO_PLAY = false; static final boolean DEBUG_AUTO_PLAY = false;