Esempio n. 1
0
 public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
   mSettings.readPrefs(mPrefs);
   if (evtsock != null) evtsock.changesetting(mSettings);
 }
Esempio n. 2
0
  public void enter_pressed() {
    String cmd = prompt_box.getText().toString();
    int promptlen = getResources().getString(R.string.Prompt).length();
    termOut.append(cmd + "\n");
    if (cmd.length() > promptlen) {
      addHistory(cmd.substring(promptlen));
      if (cmd.charAt(promptlen) == '/') {
        String[] strArr = cmd.substring(promptlen + 1).split(" ");
        if (strArr[0].equals("help")) {
          for (String strline : cli_usage) {
            handle.sendMessage(Message.obtain(this.handle, 0, strline));
          }
        } else if (strArr[0].equals("exit")
            || strArr[0].equals("quit")
            || strArr[0].equals("bye")) {
          evtsock.exit();
        } else if (strArr[0].equals("event")) {
          String fmt;
          StringBuilder evt;
          fmt = "plain";
          evt = new StringBuilder();
          for (int i = 1; i < strArr.length; i++) {
            if (i == 1) {
              if (strArr[i].equals("plain") || strArr[i].equals("xml")) {
                fmt = strArr[i];
                continue;
              }
            }
            evt.append(strArr[i] + " ");
          }
          evtsock.sub_event(fmt, evt.toString());
        } else if (strArr[0].equals("noevents")) {
          evtsock.no_events();
        } else if (strArr[0].equals("nixevent")) {

        } else if (strArr[0].equals("log")) {
          String loglevel = new String("7");
          if (strArr.length > 1) loglevel = strArr[1];
          evtsock.log(loglevel);
        } else if (strArr[0].equals("nolog")) {
          evtsock.no_log();
        } else if (strArr[0].equals("uuid")) {

        } else if (strArr[0].equals("filter")) {

        } else if (strArr[0].equals("debug")) {

        } else {

        }
      } else {
        if (cmd.substring(promptlen, promptlen + 5).equals("bgapi"))
          evtsock.send_bgapicmd(cmd.substring(promptlen + 5));
        else evtsock.send_apicmd(cmd.substring(promptlen));
      }
    }

    scrollDown();
    // prompt_box.selectAll();
    prompt_box.setText(R.string.Prompt);
    prompt_box.setSelection(prompt_box.getText().length());
    prompt_box.requestFocusFromTouch();
  }