示例#1
0
  public static InputConnection getInputConnection() {
    InputService service = InputService.getInputService();
    if (service != null) {
      InputConnection connection = service.getCurrentInputConnection();

      if (connection != null) {
        return connection;
      } else {
        Log.w(LOG_TAG, "input service not connected");
      }
    } else if (!isInputServiceEnabled()) {
      Log.w(LOG_TAG, "input service not enabled");
    } else if (!isInputServiceSelected()) {
      Log.w(LOG_TAG, "input service not selected");
    } else {
      Log.w(LOG_TAG, "input service not started");
    }

    if (!isInputServiceSelected()) {
      Log.w(LOG_TAG, "showing input method picker");
      ApplicationUtilities.getInputMethodManager().showInputMethodPicker();
    }

    return null;
  }
示例#2
0
        @Override
        public boolean performAction() {
          if (ApplicationUtilities.haveSdkVersion(Build.VERSION_CODES.JELLY_BEAN)) {
            return performGlobalAction(AccessibilityService.GLOBAL_ACTION_RECENTS);
          }

          return false;
        }
示例#3
0
        @Override
        public boolean performAction() {
          if (ApplicationUtilities.haveSdkVersion(Build.VERSION_CODES.LOLLIPOP)) {
            return performGlobalAction(AccessibilityService.GLOBAL_ACTION_POWER_DIALOG);
          }

          return false;
        }
示例#4
0
  public static boolean isInputServiceSelected() {
    InputMethodInfo info = getInputMethodInfo();

    if (info != null) {
      if (info.getId().equals(ApplicationUtilities.getSelectedInputMethodIdentifier())) {
        return true;
      }
    }

    return false;
  }
示例#5
0
  public static InputMethodInfo getInputMethodInfo(Class classObject) {
    String className = classObject.getName();

    for (InputMethodInfo info :
        ApplicationUtilities.getInputMethodManager().getEnabledInputMethodList()) {
      if (info.getComponent().getClassName().equals(className)) {
        return info;
      }
    }

    return null;
  }
  public DeHyphenAFolder(
      ProcessListener listener,
      String workdir,
      String todofoldername,
      String database,
      VolumeDehyphenizer vd,
      String dataPrefix,
      String glossarytable,
      Glossary glossary) {
    this.listener = listener;
    this.glossarytable = glossarytable;
    this.database = database;
    this.vd = vd;
    // this.dataPrefix = dataPrefix;
    this.tablename = dataPrefix + "_" + ApplicationUtilities.getProperty("ALLWORDS");

    this.glossary = glossary;
    workdir = workdir.endsWith("/") ? workdir : workdir + "/";
    this.folder = new File(workdir + todofoldername);
    this.outfolder = new File(workdir + ApplicationUtilities.getProperty("DEHYPHENED"));
    if (!outfolder.exists()) {
      outfolder.mkdir();
    }

    try {
      if (conn == null) {
        Class.forName(ApplicationUtilities.getProperty("database.driverPath"));
        String URL = ApplicationUtilities.getProperty("database.url");
        conn = DriverManager.getConnection(URL);
        // createNumTextMixTable();
        createAllWordsTable();
      }
    } catch (Exception e) {
      LOGGER.error("Database is down! (VolumeDehyphenizer)", e);
      e.printStackTrace();
    }
  }
示例#7
0
  public static void logKeyEvent(int code, boolean press, String description) {
    if (ApplicationParameters.LOG_KEYBOARD_EVENTS) {
      StringBuilder sb = new StringBuilder();

      sb.append("key ");
      sb.append((press ? "press" : "release"));
      sb.append(' ');
      sb.append(description);

      sb.append(": ");
      sb.append(code);

      if (ApplicationUtilities.haveSdkVersion(Build.VERSION_CODES.HONEYCOMB_MR1)) {
        sb.append(" (");
        sb.append(KeyEvent.keyCodeToString(code));
        sb.append(")");
      }

      Log.d(LOG_TAG, sb.toString());
    }
  }