@@ -1133,7 +1133,6 @@ public void run(){
11331133
11341134 public void dispatchCommand (String message ){
11351135
1136- Boolean ret = false ;
11371136 int delay = 0 ;
11381137 while (message .length () > 50 ){
11391138 delayed_message (message .substring (0 , 50 ), delay );
@@ -1147,7 +1146,7 @@ public void dispatchCommand(String message){
11471146
11481147 if (DEBUG ) Log .d (TAG , String .format ("dispatch :%s" , message ));
11491148 int keyCode = 45 ;
1150- //send control sequence start \x01
1149+ //send control sequence start
11511150 nativeKey (keyCode , 1 , 1 );
11521151 nativeKey (keyCode , 0 , 1 );
11531152
@@ -1157,18 +1156,28 @@ public void dispatchCommand(String message){
11571156 nativeKey (keyCode , 0 , (int ) message .charAt (i ));
11581157 }
11591158
1160- //send control sequence start \x01
1159+ //send control sequence end \x02
11611160 nativeKey (keyCode , 1 , 2 );
11621161 nativeKey (keyCode , 0 , 2 );
11631162
11641163 }
11651164
11661165 @ Override
11671166 public InputConnection onCreateInputConnection (EditorInfo outAttrs ) {
1168- // setting inputtype to TYPE_CLASS_TEXT is necessary for swiftkey to enable
11691167 outAttrs .inputType = inputType ;
11701168 // ask IME to avoid taking full screen on landscape mode
11711169 outAttrs .imeOptions = EditorInfo .IME_FLAG_NO_EXTRACT_UI ;
1170+
1171+ // add a listener for the layout chnages to the IME view
1172+ final android .view .View activityRootView = mActivity .getWindow ().getDecorView ();
1173+ activityRootView .getViewTreeObserver ().addOnGlobalLayoutListener (new android .view .ViewTreeObserver .OnGlobalLayoutListener () {
1174+ @ Override
1175+ public void onGlobalLayout () {
1176+ //send control sequence start /x04 == kayboard layout changed
1177+ nativeKey (45 , 1 , 4 );
1178+ nativeKey (45 , 0 , 4 );
1179+ }
1180+ });
11721181 return new BaseInputConnection (this , false ){
11731182
11741183 private void deleteLastText (){
0 commit comments