public void onClick(View v) {

    if (v == button0) displayNumber.append("0");
    if (v == button1) displayNumber.append("1");
    if (v == button2) displayNumber.append("2");
    if (v == button3) displayNumber.append("3");
    if (v == button4) displayNumber.append("4");
    if (v == button5) displayNumber.append("5");
    if (v == button6) displayNumber.append("6");
    if (v == button7) displayNumber.append("7");
    if (v == button8) displayNumber.append("8");
    if (v == button9) displayNumber.append("9");

    if (v == buttonClear) {
      int length = displayNumber.getText().length();
      if (length != 0) {
        displayNumber.getText().replace(length - 1, length, "");
      }
    }

    if ((Button) v == buttonCall) {
      String number = displayNumber.getText().toString();
      Uri uri = Uri.parse("tel:" + number);
      callIntent = new Intent("android.intent.action.CALL", uri);
      try {
        startActivity(callIntent);
      } catch (ActivityNotFoundException e) {
      }
    }
  }
Example #2
0
 public void appendToMessageHistory(String username, String message) {
   if (username != null && message != null) {
     if (friend.userName.equals(username)) {
       messageHistoryText.append("*" + username + "*:\n");
       messageHistoryText.append(message + "\n\n");
     } else {
       messageHistoryText.append(username + ":\n");
       messageHistoryText.append(message + "\n\n");
     }
   }
 }
 @Test
 public void watcher_formataOkComSimbolo() {
   editText.addTextChangedListener(
       new ValorMonetarioWatcher.Builder().comSimboloReal().comMantemZerosAoLimpar().build());
   editText.append("1234567890");
   assertThat(editText.getText().toString(), is("R$ 12.345.678,90"));
 }
Example #4
0
 public static void showInputDialog(
     Activity context, int title, int hint, String prefillInput, final InputCallback callback) {
   @SuppressLint("InflateParams")
   final View view = context.getLayoutInflater().inflate(R.layout.dialog_input, null);
   MaterialDialog.Builder dialog =
       new MaterialDialog.Builder(context)
           .title(title)
           .positiveText(android.R.string.ok)
           .negativeText(android.R.string.cancel)
           .callback(
               new MaterialDialog.ButtonCallback() {
                 @Override
                 public void onPositive(MaterialDialog dialog) {
                   if (callback != null) {
                     EditText input = (EditText) view.findViewById(R.id.input);
                     callback.onInput(input.getText().toString().trim());
                   }
                 }
               })
           .customView(view, true);
   final EditText input = (EditText) view.findViewById(R.id.input);
   if (hint != 0) input.setHint(hint);
   if (prefillInput != null) input.append(prefillInput);
   MaterialDialog alert = dialog.build();
   alert.setOnDismissListener(
       new DialogInterface.OnDismissListener() {
         @Override
         public void onDismiss(DialogInterface dialog) {
           if (callback instanceof InputCancelCallback)
             ((InputCancelCallback) callback).onCancel();
         }
       });
   alert.show();
 }
  private void addContactInfo(Uri contactUri) {
    ContactAccessor contactDataList = ContactAccessor.getInstance();
    ContactData contactData = contactDataList.getContactData(this, contactUri);

    if (contactData.numbers.size() == 1) composeText.append(contactData.numbers.get(0).number);
    else if (contactData.numbers.size() > 1) selectContactInfo(contactData);
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   targetActivity = (EditText) findViewById(R.id.editText1);
   flags = (EditText) findViewById(R.id.editText2);
   cheatSheet = (EditText) findViewById(R.id.editText3);
   for (String item : flagsList) {
     cheatSheet.append(item);
     cheatSheet.append("\n");
   }
   Intent whoCalled = getIntent();
   helloView = ((TextView) findViewById(R.id.textView3));
   helloView.setTextColor(android.graphics.Color.WHITE);
   helloView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
   helloView.setText("Flags: 0x" + Integer.toHexString(whoCalled.getFlags()));
   if (whoCalled.getExtras() != null) {
     boolean areErrors = whoCalled.getExtras().getBoolean("existErrors", false);
     if (areErrors) {
       helloView.append(" There were errors!");
       helloView.setTextColor(android.graphics.Color.RED);
       helloView.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
     }
   }
   //        actManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
   //        logSystemInfo();
   ActivityManager am = (ActivityManager) getSystemService(Service.ACTIVITY_SERVICE);
   List<ActivityManager.RunningAppProcessInfo> processes;
   processes = am.getRunningAppProcesses();
   for (ActivityManager.RunningAppProcessInfo info : processes) {
     Log.i("Process:", info.processName);
   }
 }
 public void enterNumber(View v) {
   String number = ((Button) v).getText().toString();
   if (enterNumbers.size() < 4 && !enterNumbers.contains(number)) {
     input.append(number);
     enterNumbers.add(number);
   }
 }
 public void delete(View v) {
   if (enterNumbers.size() > 0) {
     enterNumbers.remove(enterNumbers.size() - 1);
     String text = input.getEditableText().toString();
     input.setText("");
     input.append(text.substring(0, text.length() - 1));
   }
 }
Example #9
0
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case 0:
       termOut.append((String) msg.obj);
       break;
     case 1:
       termOut.append(
           Html.fromHtml("<font color='Aqua'>" + (String) msg.obj + "</font><br/>"));
       break;
     case 2:
       termOut.append(
           Html.fromHtml("<font color='fuchsia'>" + (String) msg.obj + "</font><br/>"));
       break;
     case 3:
       String[] strArr = ((String) msg.obj).split("\n");
       for (String strline : strArr) {
         if (strline.matches("(.*)\\[ALER](.*)")) {
           termOut.append(Html.fromHtml("<font color='Red'>" + strline + "</font><br/>"));
         } else if (strline.matches("(.*)\\[CRIT](.*)")) {
           termOut.append(Html.fromHtml("<font color='Red'>" + strline + "</font><br/>"));
         } else if (strline.matches("(.*)\\[ERROR](.*)")) {
           termOut.append(Html.fromHtml("<font color='Red'>" + strline + "</font><br/>"));
         } else if (strline.matches("(.*)\\[WARNING](.*)")) {
           // violet
           termOut.append(
               Html.fromHtml("<font color='#EE82EE'>" + strline + "</font><br/>"));
         } else if (strline.matches("(.*)\\[NOTICE](.*)")) {
           // orange
           termOut.append(
               Html.fromHtml("<font color='#FFA500'>" + strline + "</font><br/>"));
         } else if (strline.matches("(.*)\\[INFO](.*)")) {
           termOut.append(Html.fromHtml("<font color='green'>" + strline + "</font>"));
         } else if (strline.matches("(.*)\\[DEBUG](.*)")) {
           termOut.append(Html.fromHtml("<font color='yellow'>" + strline + "</font>"));
         }
       }
       break;
     case 4:
       termOut.setText((String) msg.obj);
       break;
     default:
   }
   scrollDown();
   prompt_box.requestFocusFromTouch();
 }
        @Override
        public void handleMessage(Message msg) {
          Log.e(">>@@", "handleMessage+ v0930");

          if (msg.what == 0) {
            Log.e(">>@@", "handleMessage-0");
            if (iavailable_0 > 0) {
              Log.e(
                  ">>@@",
                  "handle 0 iava:"
                      + iavailable_0
                      + " Data:"
                      + String.copyValueOf(readDataToText_0, 0, iavailable_0));
              // readText_0.setText("");
              readText_0.append(String.copyValueOf(readDataToText_0, 0, iavailable_0));
              Toast.makeText(
                      DeviceFT2232HTestContext,
                      "Port 0 get data:" + String.copyValueOf(readDataToText_0, 0, iavailable_0),
                      Toast.LENGTH_SHORT)
                  .show();
            }
          } else if (msg.what == 1) {
            Log.e(">>@@", "handleMessage-1");
            if (iavailable_1 > 0) {
              Log.e(
                  ">>@@",
                  "handle 1 iava:"
                      + iavailable_1
                      + " Data:"
                      + String.copyValueOf(readDataToText_1, 0, iavailable_1));
              // readText_1.setText("");
              readText_1.append(String.copyValueOf(readDataToText_1, 0, iavailable_1));
              Toast.makeText(
                      DeviceFT2232HTestContext,
                      "Port 1 get data:" + String.copyValueOf(readDataToText_1, 0, iavailable_1),
                      Toast.LENGTH_SHORT)
                  .show();
            }
          } else {
            Log.e(">>@@", "handleMessage-other");
          }

          Log.e(">>@@", "handleMessage-");
        }
Example #11
0
 @Override
 public void onStickerSelected(String code) {
   if (StickersManager.isSticker(code)) {
     sendChatMessage(code);
     //                setStickersFrameVisible(false);
   } else {
     // append emoji to edit
     messageEditText.append(code);
   }
 }
Example #12
0
 @Override
 public void onItemClick(AdapterView adapterView, View view, int position, long id) {
   Log.d(TAG, "onItemClick: position: " + position + ", id: " + id);
   String item = listAdapter.getItem(position).trim();
   if (item.endsWith(" =")) {
     item = item.substring(0, item.length() - 2);
   }
   if (!item.startsWith("no result")) {
     inputView.append(item);
   }
 }
 public void onResult(HashMap<String, Object> data) {
   if (data != null && data.containsKey("selected")) {
     @SuppressWarnings("unchecked")
     ArrayList<String> selected = (ArrayList<String>) data.get("selected");
     StringBuilder sb = new StringBuilder();
     for (String sel : selected) {
       sb.append('@').append(sel).append(' ');
     }
     etContent.append(sb.toString());
   }
 }
Example #14
0
  public void extraBtnclick(View v) {

    Button clickedBtn = (Button) findViewById(v.getId());
    String btnTxt = clickedBtn.getText().toString();

    EditText measurementField;
    measurementField = (EditText) findViewById(R.id.editText_measurement);
    /*String currentMesurementText = measurementField.getText().toString();
    currentMesurementText = currentMesurementText + btnTxt+"\t";  */

    measurementField.append(btnTxt + "\t");
  }
  @Test
  public void watcher_canEmptyTextWithoutZeroes() {
    editText.addTextChangedListener(new ValorMonetarioWatcher.Builder().comSimboloReal().build());
    editText.append("1234567890");
    assertThat(editText.getText().toString(), is("R$ 12.345.678,90"));

    editText.getText().clear();
    assertThat(editText.getText().toString(), is(""));

    editText.getText().append('1');
    assertThat(editText.getText().toString(), is("R$ 0,01"));
  }
 private void addImage() {
   int randomId = 1 + new Random().nextInt(5);
   try {
     Field field = R.drawable.class.getDeclaredField("emo_" + randomId);
     int resourceId = Integer.parseInt(field.get(null).toString());
     // android中显示图片信息,要使用bitmap位图的对象来装载
     Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
     ImageSpan imageSpan = new ImageSpan(EditTextActivity.this, bitmap);
     SpannableString spannableString = new SpannableString("emo_" + randomId);
     spannableString.setSpan(imageSpan, 0, 5, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
     editText.append(spannableString);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Example #17
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   Toast t = Toast.makeText(getApplicationContext(), "HJelkfd", Toast.LENGTH_LONG);
   t.show();
   if (requestCode == SPEECH_INPUT_ID && resultCode == RESULT_OK) {
     ArrayList<String> outputList = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
     noteBody.append(" " + outputList.get(0));
   } else if (requestCode == TAKE_PICTURE_ID && resultCode == RESULT_OK) {
     Bundle extras = data.getExtras();
     String fileName = extras.getString("FILE_PATH");
     System.out.println(fileName);
     Bitmap bitmapToDisplayFromSDCard = BitmapFactory.decodeFile(fileName);
     picTaken.setImageBitmap(bitmapToDisplayFromSDCard);
   }
 }
  private void handleDecimal() {
    if (operator == 0) reset();

    if (readyToClear) {
      txtCalc.setText("0.");
      txtCalc.setSelection(2);
      readyToClear = false;
      hasChanged = true;
    } else {
      String txt = txtCalc.getText().toString();

      if (!txt.contains(".")) {
        txtCalc.append(".");
        hasChanged = true;
      }
    }
  }
  private void calls() {
    String[] projection = new String[] {Calls.TYPE, Calls.NUMBER};

    Uri llamadasUri = Calls.CONTENT_URI;

    ContentResolver cr = getContentResolver();

    Cursor cur =
        cr.query(
            llamadasUri,
            projection, // Columnas a
            // devolver
            null, // Condici—n de la query
            null, // Argumentos variables de la query
            null); // Orden de los resultados

    if (cur.moveToFirst()) {
      int type;
      String callType = "";
      String phone;

      int ctype = cur.getColumnIndex(Calls.TYPE);
      int cnumber = cur.getColumnIndex(Calls.NUMBER);

      text.setText("");

      do {

        type = cur.getInt(ctype);
        phone = cur.getString(cnumber);

        if (type == Calls.INCOMING_TYPE) callType = "ENTRANTE";
        else if (type == Calls.OUTGOING_TYPE) callType = "SALIENTE";
        else if (type == Calls.MISSED_TYPE) callType = "PERDIDA";

        text.append(callType + " - " + phone + "\n");

      } while (cur.moveToNext());
    } else {
      text.setText("No hay llamadas");
    }
  }
 public void guess(View v) {
   int countA = 0;
   int countB = 0;
   for (int i = 0; i < enterNumbers.size(); i++) {
     String number = enterNumbers.get(i);
     if (number.equals(randomNumbers.get(i))) {
       countA++;
       System.out.println(countA);
     } else if (randomNumbers.contains(number)) {
       countB++;
     }
   }
   String checkResult = input.getText() + ":" + countA + "A" + countB + "B";
   if (checkResult.endsWith("4A0B")) {
     checkResult = checkResult + " Congratulation!";
   }
   result.append("\n" + checkResult);
   input.setText("");
   enterNumbers.clear();
 }
Example #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_note);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    Intent intent = getIntent();
    mEditText = (EditText) findViewById(R.id.note_text);
    if (intent.hasExtra("valueOfListItem")) {
      String listItemValue =
          intent
              .getExtras()
              .getString(
                  "valueOfListItem"); // Value of the list item, passed from the main activity :D
      mItemId = intent.getExtras().getString("valueOfRowId"); // Value of the ID in the database
      mEditText.append(listItemValue);
    }

    mSaveButton = (Button) findViewById(R.id.save_button);

    if (!intent.hasExtra("valueOfRowId")) {
      mSaveButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              writeToDatabase();
            }
          });
    } else {
      mSaveButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              updateDatabase();
            }
          });
    }
  }
Example #22
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.one:
        et1.append("1");
        break;

      case R.id.two:
        et1.append("2");
        break;

      case R.id.three:
        et1.append("3");
        break;

      case R.id.four:
        et1.append("4");
        break;

      case R.id.five:
        et1.append("5");
        break;

      case R.id.six:
        et1.append("6");
        break;

      case R.id.seven:
        et1.append("7");
        break;

      case R.id.eight:
        et1.setText("8");
        break;

      case R.id.nine:
        et1.setText("9");
        break;
    }
  }
  private void readClients() {
    // Columnas de la tabla a recuperar
    String[] projection =
        new String[] {Clients._ID, Clients.C_NAME, Clients.C_PHONE, Clients.C_EMAIL};

    Uri clientesUri = ClientsProvider.CONTENT_URI;
    ContentResolver cr = getContentResolver();

    // Hacemos la consulta
    Cursor cur = cr.query(clientesUri, projection, null, null, null);

    try {
      if (cur.moveToFirst()) {
        String name;
        String phone;
        String email;

        int cname = cur.getColumnIndex(Clients.C_NAME);
        int cphone = cur.getColumnIndex(Clients.C_PHONE);
        int cemail = cur.getColumnIndex(Clients.C_EMAIL);

        text.setText("");

        do {
          name = cur.getString(cname);
          phone = cur.getString(cphone);
          email = cur.getString(cemail);

          text.append(name + " - " + phone + " - " + email + "\n");

        } while (cur.moveToNext());
      }
    } catch (Exception e) {
      Toast.makeText(getBaseContext(), "Ha habido un error...", Toast.LENGTH_LONG).show();
    }
  }
 /**
  * * Set the searchbox's current text manually
  *
  * @param text Text
  */
 public void setSearchString(String text) {
   search.setText("");
   search.append(text);
 }
  /** 提现窗口 */
  protected View getMoneyDialog() {
    start = true;
    LayoutInflater inflater = LayoutInflater.from(this);
    View getView = inflater.inflate(R.layout.get_money_submit, null);
    LinearLayout layout1 = (LinearLayout) getView.findViewById(R.id.LinearLayout_one);
    LinearLayout layout2 = (LinearLayout) getView.findViewById(R.id.LinearLayout_two);
    LinearLayout layout3 = (LinearLayout) getView.findViewById(R.id.LinearLayout_third);
    final EditText name = (EditText) getView.findViewById(R.id.get_money_name_edit);
    final Spinner money_brank = (Spinner) getView.findViewById(R.id.get_money_bank_spinner);
    //
    allcountries = new ArrayList<String>();
    if (info.getAllbankname() != null && info.getAllbankname().length > 0) {
      allName = info.getAllbankname();
    } else {
      allName = allBankName;
    }
    for (int i = 0; i < allName.length; i++) {
      allcountries.add(allName[i]);
    }
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, allcountries);
    adapter.setDropDownViewResource(R.layout.myspinner_dropdown);
    money_brank.setAdapter(adapter);
    //
    money_brank.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            int position = money_brank.getSelectedItemPosition();
            bankName = allName[position];
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });
    final TextView drawbalanceText = (TextView) getView.findViewById(R.id.withdraw_drawbalance);
    if (drawBStr == null || drawBStr == "" || drawBStr == "null") {
      drawBStr = "联网获取失败";
    }
    drawbalanceText.setText("您的账户可提现余额为:" + drawBStr);
    final String drawMoney = drawBStr.substring(0, drawBStr.length() - 1);
    final EditText money_bank_start =
        (EditText) getView.findViewById(R.id.get_money_bank_start_edit);
    final EditText money_bank_num = (EditText) getView.findViewById(R.id.get_money_bank_num_edit);
    final EditText money = (EditText) getView.findViewById(R.id.get_money_money_edit);
    Button submit = (Button) getView.findViewById(R.id.get_money_img_submit);
    submit.setBackgroundResource(R.drawable.join_info_btn_selecter);
    Button cancel = (Button) getView.findViewById(R.id.get_money_img_back);
    cancel.setBackgroundResource(R.drawable.join_info_btn_selecter);
    submit.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            ChangeWithdrawPojo changeWithdPojo = new ChangeWithdrawPojo();
            String nameStr = name.getText().toString();
            String moneyStr = money.getText().toString();
            String bankNameStr = bankName;
            String bankAreaStr = money_bank_start.getText().toString();
            String bankNoStr = money_bank_num.getText().toString();
            changeWithdPojo.setUserno(userno);
            changeWithdPojo.setPhonenum(phonenum);
            changeWithdPojo.setSessionid(sessionid);
            if (info.getBankName().equals("") || info.getBankName().equals("null")) {
              changeWithdPojo.setBankname(bankNameStr);
            } else {
              changeWithdPojo.setBankname(info.getBankName());
            }
            if (nameStr.equals("")) {
              Toast.makeText(AccountWithdrawActivity.this, "持卡人名不能为空!", Toast.LENGTH_SHORT).show();
            } else if (bankAreaStr.equals("")) {
              Toast.makeText(AccountWithdrawActivity.this, "开卡地址不能为空!", Toast.LENGTH_SHORT).show();
            } else if (bankNoStr.equals("")) {
              Toast.makeText(AccountWithdrawActivity.this, "银行卡号不能为空!", Toast.LENGTH_SHORT).show();
            } else if (moneyStr.equals("")) {
              Toast.makeText(AccountWithdrawActivity.this, "提现金额不能为空!", Toast.LENGTH_SHORT).show();
            } else if (Integer.parseInt(moneyStr) < 1) {
              Toast.makeText(AccountWithdrawActivity.this, "至少提现一元!", Toast.LENGTH_SHORT).show();
            } else if (Float.parseFloat(moneyStr) > Float.parseFloat(drawMoney)) {
              Toast.makeText(AccountWithdrawActivity.this, "您提现的金额大于您的可提现余额!", Toast.LENGTH_SHORT)
                  .show();
            } else {
              changeWithdPojo.setName(nameStr);
              changeWithdPojo.setAmount(PublicMethod.toFen(moneyStr));
              changeWithdPojo.setAraeaname(bankAreaStr);
              changeWithdPojo.setBankcardno(bankNoStr);
              accountWithdrawNet(changeWithdPojo);
            }
          }
        });
    cancel.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            finish();
          }
        });
    name.append(info.getNameStr());
    money_bank_start.append(info.getAdd());
    money_bank_num.append(info.getNum());
    if (info.getBindState().equals("1")) { // dna是否绑定
      layout1.setVisibility(LinearLayout.GONE);
      layout3.setVisibility(LinearLayout.GONE);
      if (info.getBankName().equals("") || info.getBankName().equals("null")) {
        layout2.setVisibility(LinearLayout.VISIBLE);
      } else {
        layout2.setVisibility(LinearLayout.GONE);
      }
      money_bank_num.setEnabled(false);
    }
    return getView;
  }
 @Test
 public void watcher_formataOk() {
   editText.addTextChangedListener(new ValorMonetarioWatcher());
   editText.append("1234567890");
   assertThat(editText.getText().toString(), is("12.345.678,90"));
 }
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
      int id = getArguments().getInt("id");
      switch (id) {
        case DLG_AUTO_SMS_MESSAGE:
          final String defaultText = getResources().getString(R.string.quiet_hours_auto_sms_null);
          final String autoText = getOwner().mPrefs.getString(KEY_AUTO_SMS_MESSAGE, defaultText);

          final EditText input = new EditText(getActivity());
          InputFilter[] filter = new InputFilter[1];
          // No multi/split messages for ease of compatibility
          filter[0] = new InputFilter.LengthFilter(160);
          input.append(autoText);
          input.setFilters(filter);

          return new AlertDialog.Builder(getActivity())
              .setTitle(R.string.quiet_hours_auto_string_title)
              .setMessage(R.string.quiet_hours_auto_string_explain)
              .setView(input)
              .setNegativeButton(R.string.cancel, null)
              .setPositiveButton(
                  R.string.dlg_ok,
                  new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      String value = input.getText().toString();
                      if (TextUtils.isEmpty(value)) {
                        value = defaultText;
                      }
                      SharedPreferences.Editor editor = getOwner().mPrefs.edit();
                      editor.putString(KEY_AUTO_SMS_MESSAGE, value).apply();
                    }
                  })
              .create();
        case DLG_SMS_BYPASS_CODE:
          final String defaultCode = getResources().getString(R.string.quiet_hours_sms_code_null);
          final String code = getOwner().mPrefs.getString(KEY_SMS_BYPASS_CODE, defaultCode);

          final EditText inputCode = new EditText(getActivity());
          InputFilter[] filterCode = new InputFilter[1];
          filterCode[0] = new InputFilter.LengthFilter(20);
          inputCode.append(code);
          inputCode.setFilters(filterCode);

          return new AlertDialog.Builder(getActivity())
              .setTitle(R.string.quiet_hours_sms_code_title)
              .setMessage(R.string.quiet_hours_sms_code_explain)
              .setView(inputCode)
              .setNegativeButton(R.string.cancel, null)
              .setPositiveButton(
                  R.string.dlg_ok,
                  new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      String value = inputCode.getText().toString();
                      if (TextUtils.isEmpty(value)) {
                        value = defaultCode;
                      }
                      SharedPreferences.Editor editor = getOwner().mPrefs.edit();
                      editor.putString(KEY_SMS_BYPASS_CODE, value).apply();
                    }
                  })
              .create();
      }
      throw new IllegalArgumentException("unknown id " + id);
    }
 public void updateConsole(String msg) {
   console.append(msg + "\n");
 }
Example #29
0
 /**
  * 表情输入
  *
  * @param emojiContent
  */
 public void onEmojiconInputEvent(CharSequence emojiContent) {
   editText.append(emojiContent);
 }
 public void onResult(HashMap<String, Object> data) {
   String atText = getJoinSelectedUser(data);
   if (atText != null) {
     textEditText.append(atText);
   }
 }