4040import android .view .inputmethod .InputMethodManager ;
4141import android .view .inputmethod .InputConnection ;
4242import android .view .inputmethod .BaseInputConnection ;
43+ import android .view .inputmethod .ExtractedText ;
44+ import android .view .inputmethod .ExtractedTextRequest ;
4345import android .opengl .GLSurfaceView ;
4446import android .net .Uri ;
4547import android .os .PowerManager ;
@@ -1128,7 +1130,7 @@ private void deleteLastText(){
11281130 @ Override
11291131 public boolean setComposingText (CharSequence text ,
11301132 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 ));
11321134 this .deleteLastText ();
11331135 // send text
11341136 for (int i = 0 ; i < text .length (); i ++){
@@ -1145,11 +1147,59 @@ public boolean setComposingText(CharSequence text,
11451147 @ Override
11461148 public boolean commitText (CharSequence text , int newCursorPosition ) {
11471149 // 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 ));
11491151 this .deleteLastText ();
11501152 mDelLen = 0 ;
11511153 return super .commitText (text , newCursorPosition );
11521154 }
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+ }
11531203 };
11541204 }
11551205
0 commit comments