40
40
import android .view .inputmethod .InputMethodManager ;
41
41
import android .view .inputmethod .InputConnection ;
42
42
import android .view .inputmethod .BaseInputConnection ;
43
+ import android .view .inputmethod .ExtractedText ;
44
+ import android .view .inputmethod .ExtractedTextRequest ;
43
45
import android .opengl .GLSurfaceView ;
44
46
import android .net .Uri ;
45
47
import android .os .PowerManager ;
@@ -1128,7 +1130,7 @@ private void deleteLastText(){
1128
1130
@ Override
1129
1131
public boolean setComposingText (CharSequence text ,
1130
1132
int newCursorPosition ){
1131
- // Log.i("Python:", String.format("set Composing Text %s", text));
1133
+ if ( DEBUG ) Log .i ("Python:" , String .format ("set Composing Text %s" , text ));
1132
1134
this .deleteLastText ();
1133
1135
// send text
1134
1136
for (int i = 0 ; i < text .length (); i ++){
@@ -1145,11 +1147,59 @@ public boolean setComposingText(CharSequence text,
1145
1147
@ Override
1146
1148
public boolean commitText (CharSequence text , int newCursorPosition ) {
1147
1149
// some code which takes the input and manipulates it and calls editText.getText().replace() afterwards
1148
- // Log.i("Python:", String.format("Commit Text %s", text));
1150
+ if ( DEBUG ) Log .i ("Python:" , String .format ("Commit Text %s" , text ));
1149
1151
this .deleteLastText ();
1150
1152
mDelLen = 0 ;
1151
1153
return super .commitText (text , newCursorPosition );
1152
1154
}
1155
+
1156
+ @ Override
1157
+ public boolean sendKeyEvent (KeyEvent event ){
1158
+ if (DEBUG ) Log .d ("Python:" , String .format ("sendKeyEvent %s" , event .getKeyCode ()));
1159
+ return super .sendKeyEvent (event );
1160
+ }
1161
+
1162
+ @ Override
1163
+ public boolean setComposingRegion (int start , int end ){
1164
+ if (DEBUG ) Log .d ("Python:" , String .format ("Set Composing Region %s %s" , start , end ));
1165
+ return super .setComposingRegion (start , end );
1166
+ }
1167
+
1168
+ @ Override
1169
+ public boolean deleteSurroundingText (int beforeLength , int afterLength ){
1170
+ if (DEBUG ) Log .d ("Python:" , String .format ("deleteLastText %s %s" , beforeLength , afterLength ));
1171
+ return super .deleteSurroundingText (beforeLength , afterLength );
1172
+ }
1173
+
1174
+ @ Override
1175
+ public ExtractedText getExtractedText (ExtractedTextRequest request , int flags ){
1176
+ if (DEBUG ) Log .d ("Python:" , String .format ("getExtractedText %s %s" , request .describeContents (), flags ));
1177
+ return super .getExtractedText (request , flags );
1178
+ }
1179
+
1180
+ @ Override
1181
+ public CharSequence getSelectedText (int flags ){
1182
+ if (DEBUG ) Log .d ("Python:" , String .format ("getSelectedText %s" , flags ));
1183
+ return super .getSelectedText (flags );
1184
+ }
1185
+
1186
+ @ Override
1187
+ public CharSequence getTextBeforeCursor (int n , int flags ){
1188
+ if (DEBUG ) Log .d ("Python:" , String .format ("getTextBeforeCursor %s %s" , n , flags ));
1189
+ return new String (new char [1024 ]).replace ("\0 " , " " );//#super.getTextBeforeCursor(n, flags);
1190
+ }
1191
+
1192
+ @ Override
1193
+ public CharSequence getTextAfterCursor (int n , int flags ){
1194
+ if (DEBUG ) Log .d ("Python:" , String .format ("getTextAfterCursor %s %s" , n , flags ));
1195
+ return " " ;//super.getTextAfterCursor(n, flags);
1196
+ }
1197
+
1198
+ @ Override
1199
+ public boolean setSelection (int start , int end ){
1200
+ if (DEBUG ) Log .d ("Python:" , String .format ("Set Selection %s %s" , start , end ));
1201
+ return super .setSelection (start , end );
1202
+ }
1153
1203
};
1154
1204
}
1155
1205
0 commit comments