Beispiel #1
0
 public void afterTextChanged(Editable paramEditable) {
   if (TextUtils.isEmpty(paramEditable.toString())) {}
   for (int i = 0; ; i = (int) Double.parseDouble(paramEditable.toString()) * 1000) {
     AutoForwardActivity.c(this.a).b(this.a.j() + "_autoforward_delay", i);
     return;
   }
 }
Beispiel #2
0
 private void saveEditedText() {
   if (mEditRestBaseURL != null) {
     final Editable ed = mEditRestBaseURL.getText();
     if (ed != null) {
       mRestBaseURL = ed.toString();
     }
   }
   if (mEditSigningRESTBaseURL != null) {
     final Editable ed = mEditSigningRESTBaseURL.getText();
     if (ed != null) {
       mSigningRESTBaseURL = ed.toString();
     }
   }
   if (mEditOAuthBaseURL != null) {
     final Editable ed = mEditOAuthBaseURL.getText();
     if (ed != null) {
       mOAuthBaseURL = ed.toString();
     }
   }
   if (mEditSigningOAuthBaseURL != null) {
     final Editable ed = mEditSigningOAuthBaseURL.getText();
     if (ed != null) {
       mSigningOAuthBaseURL = ed.toString();
     }
   }
 }
Beispiel #3
0
 private void testing() {
   if (emailE.length() == 0 && passwordE.length() == 0) {
     textView.setVisibility(View.VISIBLE);
     textView.setTextColor(getResources().getColor(R.color.Error));
     textView.setText(R.string.EmailAndPassNull);
   } else if (emailE.length() == 0) {
     textView.setVisibility(View.VISIBLE);
     textView.setTextColor(getResources().getColor(R.color.Error));
     textView.setText(R.string.EmailNull);
   } else if (passwordE.length() == 0) {
     textView.setVisibility(View.VISIBLE);
     textView.setTextColor(getResources().getColor(R.color.Error));
     textView.setText(R.string.PassNull);
   } else if (emailTest(emailE)) {
     textView.setVisibility(View.VISIBLE);
     textView.setTextColor(getResources().getColor(R.color.Ok));
     textView.setText("Ok");
     User.login = emailE.toString();
     User.password = passwordE.toString();
     HTTPClient.login(this);
   } else {
     textView.setVisibility(View.VISIBLE);
     textView.setTextColor(getResources().getColor(R.color.Error));
     textView.setText("Неверный Email");
   }
 }
  public void onTextChanged(CharSequence ss, int start, int before, int count) {
    editText.setTextColor(Color.BLACK);

    Editable editable = editText.getText();
    int len = editable.length();
    boolean bOK = false;

    if (checkLength(len)) {
      if (checkData(editable.toString())) bOK = true;
    }
    if (!bOK) {
      int selEndIndex = Selection.getSelectionEnd(editable);
      String str = editable.toString();
      String newStr = str.substring(0, len - 1);
      editText.setText(newStr);
      editable = editText.getText();
      // 新字符串长度
      int newLen = editable.length();
      // 旧光标位置超过字符串长度
      if (selEndIndex > newLen) {
        selEndIndex = newLen;
      }
      // 设置新的光标所在位置
      Selection.setSelection(editable, selEndIndex);

    } else {
      saveData(editable.toString());
    }
  }
Beispiel #5
0
 private boolean checkForm() {
   boolean bolAlertPop = false;
   boolean bolCheckResult = true;
   Editable editableMobile = this.inputMobile.getText();
   if (!editableMobile.toString().matches(".{11,11}")) {
     bolAlertPop = true;
     bolCheckResult = false;
     this.inputMobile.requestFocus();
     Utils.Dialog(
         this,
         getString(R.string.dialog_form_check_title),
         getString(R.string.dialog_form_check_err_mobile));
   }
   Editable editablePassword = this.inputPassword.getText();
   if (!bolAlertPop && !editablePassword.toString().matches(".{6,50}")) {
     bolAlertPop = true;
     bolCheckResult = false;
     this.inputPassword.requestFocus();
     Utils.Dialog(
         this,
         getString(R.string.dialog_form_check_title),
         getString(R.string.dialog_form_check_err_password));
   }
   return bolCheckResult;
 }
 @Override
 public void afterTextChanged(Editable editable) {
   if (onResponseChangedListener != null
       && (lastString != null && lastString.length() > 0)) {
     String response = editable.length() > 0 ? editable.toString() : null;
     onResponseChangedListener.onResponseChanged(rule, response);
   }
   lastString = editable.toString();
 }
 public void afterTextChanged(Editable aEditable) {
   Class<?> propertyType = getPropertyAccessor().getGetter().getReturnType();
   if (Float.class.isAssignableFrom(propertyType) || float.class.isAssignableFrom(propertyType)) {
     updateModel(
         StringUtil.isEmpty(aEditable.toString()) ? 0.0F : Float.parseFloat(aEditable.toString()));
   } else if (long.class.isAssignableFrom(propertyType)
       || Long.class.isAssignableFrom(propertyType)) {
     updateModel(
         StringUtil.isEmpty(aEditable.toString()) ? 0L : Long.parseLong(aEditable.toString()));
   } else if (int.class.isAssignableFrom(propertyType)
       || Integer.class.isAssignableFrom(propertyType)) {
     updateModel(
         StringUtil.isEmpty(aEditable.toString()) ? 0 : Integer.parseInt(aEditable.toString()));
   } else if (double.class.isAssignableFrom(propertyType)
       || Double.class.isAssignableFrom(propertyType)) {
     updateModel(
         StringUtil.isEmpty(aEditable.toString())
             ? 0.0D
             : Double.parseDouble(aEditable.toString()));
   } else if (UserExtract.class.isAssignableFrom(propertyType)) {
     throw new IllegalStateException("Benutzer können nicht editiert werden!");
   } else {
     updateModel(aEditable.toString());
   }
 }
  @Override
  public void afterTextChanged(Editable s) {
    // TODO Auto-generated method stub
    Log.i("PRAS", "in onQueryTextSubmit");

    if (s.toString() != null && s.toString().length() > 0) {
      String whereclause =
          "WHERE " + DataHelper.COLUMN_ENGLISHWORD + " like '" + s.toString() + "%'";
      updateWordList(rootView, listView, whereclause);
    }
  }
Beispiel #9
0
  private boolean checkPassword(Editable uname, Editable passwd) {
    // Just pretending to extract text and check password
    // String u = uname.toString();

    if (uname.toString().equals("vivek") && passwd.toString().equals("vivek")) {
      return true;
    } else {
      return false;
      // return new Random().nextBoolean();
    }
  }
Beispiel #10
0
  public String getUnmaskedText() {
    Editable text = super.getText();
    if (mask != null && !mask.isEmpty()) {
      Editable unMaskedText = new SpannableStringBuilder();
      for (Integer index : listValidCursorPositions) {
        if (text != null) {
          unMaskedText.append(text.charAt(index));
        }
      }
      if (format != null && !format.isEmpty()) return formatText(unMaskedText.toString(), format);
      else return unMaskedText.toString().trim();
    }

    return text.toString().trim();
  }
  @Override
  public void afterTextChanged(Editable s) {
    String mask = mMask;
    String value = s.toString();
    if (value.equals(mResult)) return;
    try {
        /* prepare the formatter*/
      MaskedFormatter formatter = new MaskedFormatter(mask);
      formatter.setValueContainsLiteralCharacters(false);
      formatter.setPlaceholderCharacter(
          (char) 1); /* get a string with applied mask and placeholder chars*/
      value = formatter.valueToString(value);
      try {
          /* find first placeholder*/
        value = value.substring(0, value.indexOf((char) 1)); /*process a mask char*/
        if (value.charAt(value.length() - 1) == mask.charAt(value.length() - 1))
          value = value.substring(0, value.length() - 1);

      } catch (Exception e) {
      }

      mResult = value;

      s.replace(0, s.length(), value);

    } catch (ParseException e) {

      // the entered value does not match a mask
      int offset = e.getErrorOffset();
      value = removeCharAt(value, offset);
      s.replace(0, s.length(), value);
    }
  }
    @Override
    public void afterTextChanged(Editable s) {

      boolean updated = false;
      int value;
      try {
        value = Integer.parseInt(s.toString());
      } catch (NumberFormatException e) {
        value = mDefault;
      }

      if (value < mMin) {
        value = mMin;
        updated = true;
      } else if (value > mMax) {
        updated = true;
        value = mMax;
      }

      // Update UI
      if (updated) {
        s.clear();
        s.append(Integer.toString(value));
      }

      updateDoneButtonState();
      onChange(value);
    }
 @Override
 public void afterTextChanged(Editable s) {
   requestString = s.toString();
   if (!TextUtils.isEmpty(requestString)) {
     requestLayout.setErrorEnabled(false);
   }
 }
  @Override
  public ExtractedText getExtractedText(ExtractedTextRequest req, int flags) {
    if (req == null) return null;

    if ((flags & GET_EXTRACTED_TEXT_MONITOR) != 0) mUpdateRequest = req;

    Editable editable = getEditable();
    if (editable == null) {
      return null;
    }
    int selStart = Selection.getSelectionStart(editable);
    int selEnd = Selection.getSelectionEnd(editable);

    ExtractedText extract = new ExtractedText();
    extract.flags = 0;
    extract.partialStartOffset = -1;
    extract.partialEndOffset = -1;
    extract.selectionStart = selStart;
    extract.selectionEnd = selEnd;
    extract.startOffset = 0;
    if ((req.flags & GET_TEXT_WITH_STYLES) != 0) {
      extract.text = new SpannableString(editable);
    } else {
      extract.text = editable.toString();
    }
    return extract;
  }
 @Override
 public void afterTextChanged(Editable s) {
   phoneusers.clear();
   if (AssertValue.isNotNullAndNotEmpty(s.toString())) {
     for (PhoneUser user : textwatchusers) {
       if (StringUtil.contains(user.getUsername(), s.toString(), true)
           || StringUtil.contains(
               PinYinMaUtil.stringToPinyin(user.getUsername(), true), s.toString(), true)) {
         phoneusers.add(user);
       }
     }
   } else {
     phoneusers.addAll(textwatchusers);
   }
   phoneUserAdapter.notifyDataSetChanged();
 }
    @Override
    public void afterTextChanged(Editable s) {
      final String searchTerm = s.toString();

      if (searchTerm.length() > 0) {
        if (mHistoryRecyclerView != null) {
          mHistoryRecyclerView.setVisibility(View.GONE);
        }
        mSearchResultRecyclerView.setVisibility(View.VISIBLE);
      } else {
        mHandler.removeMessages(MESSAGE_TEXT_CHANGED);
        if (mHistoryRecyclerView != null) {
          mHistoryRecyclerView.setVisibility(View.VISIBLE);
        }
        mSearchResultRecyclerView.setVisibility(View.GONE);
        mProgressBar.hide();
      }

      if (TextUtils.getTrimmedLength(searchTerm) <= 1) {
        if (TextUtils.getTrimmedLength(searchTerm) == 0) {
          mSearchResultAdapter.clear();
        }
        mProgressBar.hide();
        return;
      }

      mProgressBar.show();
      mHandler.removeMessages(MESSAGE_TEXT_CHANGED);
      mHandler.sendMessageDelayed(
          mHandler.obtainMessage(MESSAGE_TEXT_CHANGED, searchTerm.trim()), AUTO_COMPLETE_DELAY);
    }
  @Override
  public ExtractedText getExtractedText(ExtractedTextRequest req, int flags) {
    if (req == null) return null;

    final Editable content = getEditable();
    if (content == null) return null;

    if ((flags & GET_EXTRACTED_TEXT_MONITOR) != 0) mUpdateRequest = req;

    ExtractedText extract = new ExtractedText();
    extract.flags = 0;
    extract.partialStartOffset = -1;
    extract.partialEndOffset = -1;

    clampSelection();
    extract.selectionStart = Selection.getSelectionStart(content);
    extract.selectionEnd = Selection.getSelectionEnd(content);
    extract.startOffset = 0;

    try {
      extract.text = content.toString();
    } catch (IndexOutOfBoundsException iob) {
      Log.d(
          LOGTAG,
          "IndexOutOfBoundsException thrown from getExtractedText(). start: "
              + Selection.getSelectionStart(content)
              + " end: "
              + Selection.getSelectionEnd(content));
      return null;
    }
    return extract;
  }
Beispiel #18
0
  @Override
  public void onClick(View v) {
    /*  botones de centreo */
    if (v.getId() == R.id.btn_adelante) {
      try {
        connectionFuture.get().write(("a").getBytes());
        displayedTextBox.setText("adelante");
      } catch (IOException e) {
        debug("Write failed.");
      }
    }

    if (v.getId() == R.id.btn_atras) {
      try {
        connectionFuture.get().write(("b").getBytes());
        displayedTextBox.setText("atras");
      } catch (IOException e) {
        debug("Write failed.");
      }
    }
    if (v.getId() == R.id.btn_izquiera) {
      try {
        connectionFuture.get().write(("c").getBytes());
        displayedTextBox.setText("izquierda");
      } catch (IOException e) {
        debug("Write failed.");
      }
    }
    if (v.getId() == R.id.btn_derecha) {
      try {
        connectionFuture.get().write(("d").getBytes());
        displayedTextBox.setText("derecha");
      } catch (IOException e) {
        debug("Write failed.");
      }
    }
    if (v.getId() == R.id.btn_stop) {
      try {
        connectionFuture.get().write(("e").getBytes());
        displayedTextBox.setText("stop");
      } catch (IOException e) {
        debug("Write failed.");
      }
    }
    if (v.getId() == R.id.button_transmit) {
      synchronized (transmitTextBox) {
        Editable transmitText = transmitTextBox.getText();
        String text = transmitText.toString();
        transmitText.clear();
        try {
          // Disable and block until this is ready
          connectionFuture.get().write(text.getBytes());
          displayedTextBox.setText("CMD : " + text);
          debug("Wrote message: " + text);
        } catch (IOException e) {
          debug("Write failed.");
        }
      }
    }
  }
Beispiel #19
0
 @Override
 public void afterTextChanged(Editable s) {
   if (!mReady) {
     return;
   }
   EntryHolder holder = (EntryHolder) mHost.getTag();
   String text = s.toString();
   if (mHost.getId() == R.id.field_name) {
     holder.mEntryItem.mName = text;
   } else {
     holder.mEntryItem.mValue = text;
   }
   boolean savable = false;
   if (!text.isEmpty()) {
     savable = true;
     for (EntryHolder eh : mEntries) {
       if (eh.mEntryItem.mName.isEmpty() || eh.mEntryItem.mValue.isEmpty()) {
         savable = false;
         break;
       }
     }
   }
   mSavable = savable;
   changeSaveStatus();
 }
Beispiel #20
0
 @Override
 public void afterTextChanged(Editable edt) {
   if (filterFlag > 0) {
     try {
       String temp = edt.toString();
       String tem = temp.substring(temp.length() - 1, temp.length());
       char[] temC = tem.toCharArray();
       int mid = temC[0];
       if (filterFlag == 1 || filterFlag == 2) {
         if (mid >= 48 && mid <= 57) { // 数字
           return;
         }
         if (mid >= 65 && mid <= 90) { // 大写字母 和@
           return;
         }
         if (mid >= 97 && mid <= 122) { // 小写字母
           return;
         }
         if (mid == 46) { // .
           return;
         }
         if (mid == 64) { // @
           return;
         }
       } else {
         if (mid >= 33 && mid <= 126) {
           return;
         }
       }
       edt.delete(temp.length() - 1, temp.length());
     } catch (Exception e) {
     }
   }
 }
Beispiel #21
0
 /** 登录联网操作 */
 private void beginLogin() {
   // showDialog(DIALOG_PROGRESS);
   EditText password_edit = (EditText) findViewById(R.id.password_edit);
   Editable password = password_edit.getText();
   final String password_string = String.valueOf(password);
   if (remPwd_checkBox.isChecked()) shellRW.putStringValue("password", password_string);
   // 判断手机号长度是否正确
   EditText phone_name_Text = (EditText) findViewById(R.id.phoneNum_edit);
   Editable editText = phone_name_Text.getText();
   // fqc edit 7/3/2010 判断密码长度 必须在6~16之间
   EditText password_text = (EditText) findViewById(R.id.password_edit);
   int passwordLength = password_text.getText().toString().length();
   if (editText.toString().equals("")) {
     Toast.makeText(this, "用户名不能为空!", Toast.LENGTH_LONG).show();
   } else if (passwordLength < 6 || passwordLength > 16) {
     password_edit.startAnimation(shake);
     Toast.makeText(this, "密码必须为6~16位!", Toast.LENGTH_LONG).show();
   } else { //
     //			if(auto_login_checkBox.isChecked()){
     //				isAutoLogin = "******";
     //			}else{
     //				isAutoLogin = "******";
     //			}
     regToLogin(String.valueOf(phoneNum_edit.getText()), password_string, isAutoLogin);
   }
 }
  @Override
  public void onClick(DialogInterface dialog, int which) {
    switch (which) {
      case DialogInterface.BUTTON_POSITIVE:
        Editable text = mPunctuationCharacters.getText();
        String characters = null;
        int level;
        if (text != null) {
          characters = text.toString();
        }

        if (mNone.isChecked()) {
          level = SpeechSynthesis.PUNCT_NONE;
        } else if (characters == null || characters.isEmpty()) {
          level = mAll.isChecked() ? SpeechSynthesis.PUNCT_ALL : SpeechSynthesis.PUNCT_NONE;
        } else {
          level = mAll.isChecked() ? SpeechSynthesis.PUNCT_ALL : SpeechSynthesis.PUNCT_SOME;
        }

        onDataChanged(level, characters);

        if (shouldCommit()) {
          SharedPreferences.Editor editor = getEditor();
          if (editor != null) {
            editor.putString(VoiceSettings.PREF_PUNCTUATION_CHARACTERS, characters);
            editor.putString(VoiceSettings.PREF_PUNCTUATION_LEVEL, Integer.toString(level));
            editor.commit();
          }
        }
        break;
    }
    super.onClick(dialog, which);
  }
 // Update time when duration field is edited
 @Override
 public void afterTextChanged(Editable editable) {
   try {
     mStop.setTimeInMillis(mStart.getTimeInMillis() + Util.durationToMs(editable.toString()));
     timeUpdated(false);
   } catch (NumberFormatException ignored) {
   }
 }
 @Override
 public void afterTextChanged(Editable romaji) {
   unbind();
   // Convert the text
   String sKana = wanaKana.toKana(romaji.toString());
   gInputWindow.setText(sKana);
   gInputWindow.setSelection(gInputWindow.getText().length());
   bind();
 }
 @VisibleForTesting
 ImeState getImeStateForTesting() {
   String text = mEditable.toString();
   int selectionStart = Selection.getSelectionStart(mEditable);
   int selectionEnd = Selection.getSelectionEnd(mEditable);
   int compositionStart = getComposingSpanStart(mEditable);
   int compositionEnd = getComposingSpanEnd(mEditable);
   return new ImeState(text, selectionStart, selectionEnd, compositionStart, compositionEnd);
 }
 @Override
 public void afterTextChanged(Editable s) {
   // TODO Auto-generated method stub
   String input = s.toString();
   adapter.mList.clear();
   autoAddEmails(input);
   adapter.notifyDataSetChanged();
   userEmail.showDropDown();
 }
 public void afterTextChanged(Editable s) {
   adapter.clear();
   for (Node nodeitem : NodeList.nodelist) {
     if (nodeitem.getName().startsWith(s.toString())) {
       adapter.add(nodeitem);
     }
   }
   nodeListView.setAdapter(adapter);
 }
Beispiel #28
0
 @Override
 public void afterTextChanged(Editable s) {
   try {
     if (s == null) return;
     int color = Color.parseColor(s.toString());
     setColor(color);
   } catch (Exception e) {
   }
 }
        @Override
        public void onClick(View v) {
          v.setBackgroundResource(R.drawable.green_btn_default_pressed_holo_light);

          boolean invalidLoginData = false;

          EditText usernameField = (EditText) findViewById(R.id.login_field);
          EditText passwordField = (EditText) findViewById(R.id.passwordField);

          Editable usernameEditable = usernameField.getText();
          Editable passwordEditable = passwordField.getText();

          String username = "";
          String password = "";

          if (usernameEditable == null
              || usernameEditable.toString().isEmpty()
              || passwordEditable == null
              || passwordEditable.toString().isEmpty()) {
            invalidLoginData = true;
          } else {
            username = usernameEditable.toString();
            password = passwordEditable.toString();
          }

          if (!invalidLoginData) {

            try {
              Response response = new AsyncLogin().execute(username, password).get();
              if (response != null && response.code() != 408) {
                loginApproved();
              }
              loginApproved();
            } catch (Exception e) {
              e.printStackTrace();
            }
          } else {
            Toast.makeText(
                    getApplicationContext(),
                    "Nome de usuario ou senha incorretos",
                    Toast.LENGTH_LONG)
                .show();
          }
        }
 @Override
 public void afterTextChanged(Editable s) {
   if (ignoreChanges) return;
   final View f = getFocusedChild();
   if (f == txtH || f == txtS || f == txtV) {
     int nh, ns, nv;
     try {
       nh = Integer.parseInt(txtH.getText().toString());
       if (nh > 360 || nh < 0) return;
       ns = Integer.parseInt(txtS.getText().toString());
       if (ns > 100 || ns < 0) return;
       nv = Integer.parseInt(txtV.getText().toString());
       if (nv > 100 || nv < 0) return;
       hsv.h = (double) nh / 360.0;
       hsv.s = (double) ns / 100.0;
       hsv.v = (double) nv / 100.0;
     } catch (Throwable ex) {
       return;
     }
     ignoreChanges = true;
     currentColor = hsv.toRGB(false);
     barH.setValue(nh);
     barS.setValue(ns);
     barV.setValue(nv);
     txt.setText(ColorUtils.toHexColor(currentColor));
     ignoreChanges = false;
   } else {
     String cs = s.toString().trim();
     if (cs.length() < 6) return;
     if (cs.charAt(0) == '#') cs = cs.substring(1).trim();
     if (cs.length() != 6) return;
     int c = ColorUtils.parseHexColor(cs);
     if (c == 0) return;
     currentColor = c;
     hsv.fromRGB(c);
     ignoreChanges = true;
     c = (int) (hsv.h * 360.0);
     barH.setValue(c);
     txtH.setText(Integer.toString(c));
     c = (int) (hsv.s * 100.0);
     barS.setValue(c);
     txtS.setText(Integer.toString(c));
     c = (int) (hsv.v * 100.0);
     barV.setValue(c);
     txtV.setText(Integer.toString(c));
     ignoreChanges = false;
   }
   updateGH();
   updateGS();
   updateGV();
   barH.invalidate();
   barS.invalidate();
   barV.invalidate();
   bgCurrent.setColor(currentColor);
   lblCurrent.invalidate();
 }