MainActivity.java 947 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //% IMPORTS
  2. import android.view.inputmethod.InputMethodManager;
  3. import android.os.Environment;
  4. import autosuggest.CustomInputConnection;
  5. //% END
  6. //% MAIN_ACTIVITY_BODY
  7. public void cancelComposition() {
  8. InputMethodManager imm =
  9. (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  10. imm.restartInput(view);
  11. }
  12. public String getAppDataPath() {
  13. return getApplicationContext().getDataDir().getAbsolutePath();
  14. }
  15. public String getExternalStoragePath() {
  16. return Environment.getExternalStorageDirectory().getAbsolutePath();
  17. }
  18. //% END
  19. //% QUAD_SURFACE_ON_CREATE_INPUT_CONNECTION
  20. // Needed to fix error: unreachable statement in Java
  21. if (true) {
  22. outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT
  23. | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
  24. outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN
  25. | EditorInfo.IME_ACTION_NONE;
  26. return new CustomInputConnection(this, outAttrs);
  27. }
  28. //% END