@@ -1133,7 +1133,6 @@ public void run(){
1133
1133
1134
1134
public void dispatchCommand (String message ){
1135
1135
1136
- Boolean ret = false ;
1137
1136
int delay = 0 ;
1138
1137
while (message .length () > 50 ){
1139
1138
delayed_message (message .substring (0 , 50 ), delay );
@@ -1147,7 +1146,7 @@ public void dispatchCommand(String message){
1147
1146
1148
1147
if (DEBUG ) Log .d (TAG , String .format ("dispatch :%s" , message ));
1149
1148
int keyCode = 45 ;
1150
- //send control sequence start \x01
1149
+ //send control sequence start
1151
1150
nativeKey (keyCode , 1 , 1 );
1152
1151
nativeKey (keyCode , 0 , 1 );
1153
1152
@@ -1157,18 +1156,28 @@ public void dispatchCommand(String message){
1157
1156
nativeKey (keyCode , 0 , (int ) message .charAt (i ));
1158
1157
}
1159
1158
1160
- //send control sequence start \x01
1159
+ //send control sequence end \x02
1161
1160
nativeKey (keyCode , 1 , 2 );
1162
1161
nativeKey (keyCode , 0 , 2 );
1163
1162
1164
1163
}
1165
1164
1166
1165
@ Override
1167
1166
public InputConnection onCreateInputConnection (EditorInfo outAttrs ) {
1168
- // setting inputtype to TYPE_CLASS_TEXT is necessary for swiftkey to enable
1169
1167
outAttrs .inputType = inputType ;
1170
1168
// ask IME to avoid taking full screen on landscape mode
1171
1169
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
+ });
1172
1181
return new BaseInputConnection (this , false ){
1173
1182
1174
1183
private void deleteLastText (){
0 commit comments