Skip to content

Commit

Permalink
Listen to chnages in the gloabal layout for figuring out when the
Browse files Browse the repository at this point in the history
IME is activated.
  • Loading branch information
akshayaurora committed Feb 26, 2014
1 parent b1ba8dc commit df55cf7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/src/org/renpy/android/SDLSurfaceView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,6 @@ public void run(){

public void dispatchCommand(String message){

Boolean ret = false;
int delay = 0;
while (message.length() > 50){
delayed_message(message.substring(0, 50), delay);
Expand All @@ -1146,7 +1145,7 @@ public void dispatchCommand(String message){

if (DEBUG) Log.d(TAG, String.format("dispatch :%s", message));
int keyCode = 45;
//send control sequence start \x01
//send control sequence start
nativeKey(keyCode, 1, 1);
nativeKey(keyCode, 0, 1);

Expand All @@ -1156,18 +1155,28 @@ public void dispatchCommand(String message){
nativeKey(keyCode, 0, (int) message.charAt(i));
}

//send control sequence start \x01
//send control sequence end \x02
nativeKey(keyCode, 1, 2);
nativeKey(keyCode, 0, 2);

}

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
// setting inputtype to TYPE_CLASS_TEXT is necessary for swiftkey to enable
outAttrs.inputType = inputType;
// ask IME to avoid taking full screen on landscape mode
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI;

// add a listener for the layout chnages to the IME view
final android.view.View activityRootView = mActivity.getWindow().getDecorView();
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
//send control sequence start /x04 == kayboard layout changed
nativeKey(45, 1, 4);
nativeKey(45, 0, 4);
}
});
return new BaseInputConnection(this, false){

private void deleteLastText(){
Expand Down

0 comments on commit df55cf7

Please sign in to comment.