Java 类android.text.method.PasswordTransformationMethod 实例源码

项目:wirtualnaApteczka    文件:LogInActivity.java   
private void initializeViewComponents() {
    logInGoogleBtn = (Button) findViewById(R.id.log_in_google_btn);
    logInDefaultBtn = (Button) findViewById(R.id.log_in_default_btn);
    registerBtn = (TextView) findViewById(R.id.register_btn);
    forgotPasswordBtn = (TextView) findViewById(R.id.forgot_password_btn);
    regulations = (TextView) findViewById(R.id.regulations_btn);

    emailText = (EditText) findViewById(R.id.email_login_text);
    emailText.setSelected(false);

    updateRememberedEmail();

    passwordText = (EditText) findViewById(R.id.password_login_text);
    passwordText.setTypeface(Typeface.DEFAULT);
    passwordText.setTransformationMethod(new PasswordTransformationMethod());
    passwordText.setSelected(false);
}
项目:wirtualnaApteczka    文件:RegistrationActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_registration);

    registerRegulationsBtn = (TextView) findViewById(R.id.register_regulations_btn);
    registerRegulationsBtn.setOnClickListener(new RegulationsOnClickListener());

    registerNewUserBtn = (Button) findViewById(R.id.register_new_user_btn);
    registerNewUserBtn.setOnClickListener(new RegisterNewUserOnClickListener());

    passwordEditText = (EditText) findViewById(R.id.register_password_text);
    passwordEditText.setTypeface(Typeface.DEFAULT);
    passwordEditText.setTransformationMethod(new PasswordTransformationMethod());

    repeatPasswordEditText = (EditText) findViewById(R.id.register_password_repeat_text);
    repeatPasswordEditText.setTypeface(Typeface.DEFAULT);
    repeatPasswordEditText.setTransformationMethod(new PasswordTransformationMethod());
}
项目:africastalking-android    文件:PinTextInputLayout.java   
public void passwordVisibilityToggleRequested() throws NoSuchFieldException, IllegalAccessException {
    // Store the current cursor position
    int selection = getEditText().getSelectionEnd();

    if (!getEditText().getText().toString().isEmpty()) {
        getEditText().setTransformationMethod(PasswordTransformationMethod.getInstance());
        toggleEnabled("mPasswordToggledVisible", false);
        mPasswordToggleView.setChecked(false);
    } else {
        getEditText().setTransformationMethod(null);
        toggleEnabled("mPasswordToggledVisible", true);
        mPasswordToggleView.setChecked(true);
    }
    // And restore the cursor position
    getEditText().setSelection(selection);

}
项目:airgram    文件:PasscodeActivity.java   
private void updateDropDownTextView() {
    if (dropDown != null) {
        if (currentPasswordType == 0) {
            dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
        } else if (currentPasswordType == 1) {
            dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
        }
    }
    if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) {
        InputFilter[] filterArray = new InputFilter[1];
        filterArray[0] = new InputFilter.LengthFilter(4);
        passwordEditText.setFilters(filterArray);
        passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE);
        passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890"));
    } else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) {
        passwordEditText.setFilters(new InputFilter[0]);
        passwordEditText.setKeyListener(null);
        passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    }
    passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
项目:letv    文件:LoginActivity.java   
private void beautyView() {
    beautyEditText(this.mInputAccount, L10NString.getString("umgr_please_input_username"), this.mAccountTextWatcher);
    beautyCleanButton(this.mClearInputAccount, this);
    this.mInputAccountLayout.setOnClickListener(this);
    beautyCleanButton(this.mClearInputPassword, this);
    this.mInputPassword.setOnClickListener(this);
    beautyEditText(this.mInputPassword, L10NString.getString("umgr_please_input_password"), this.mPasswordTextWatcher);
    beautyColorTextView(this.mRegister, "#007dc4", false, L10NString.getString("umgr_whether_register_ornot"), this);
    beautyColorTextView(this.mFindpwd, "#007dc4", false, L10NString.getString("umgr_whether_forget_password"), this);
    beautyColorTextView(this.mSwitchAccount, "#007dc4", false, L10NString.getString("umgr_third_login_qihoo_tip"), this);
    beautyButtonGreen(this.mLogin, L10NString.getString("umgr_login"), this);
    beautyTextView(this.mAgreeClause1, L10NString.getString("umgr_login_agree_clause_1"));
    beautyTextView(this.mAgreeClauseUser, L10NString.getString("umgr_agree_clause_2_user"));
    beautyColorTextView(this.mAgreement, "#0099e5", true, L10NString.getString("umgr_agree_clause_2_agreement"), this);
    beautyTextView(this.mAnd, L10NString.getString("umgr_agree_clause_2_and"));
    beautyColorTextView(this.mPrivacy, "#0099e5", true, L10NString.getString("umgr_agree_clause_2_privacy"), this);
    beautyCheckButton(this.mShowPwd, new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            LoginActivity.this.mInputPassword.setTransformationMethod(LoginActivity.this.mShowPwd.isChecked() ? HideReturnsTransformationMethod.getInstance() : PasswordTransformationMethod.getInstance());
        }
    });
    loadPrivateConfig();
}
项目:CustomFormViews    文件:CustomTextView.java   
private void init(Context context, String hint, String text, int inputType, boolean editable,
        boolean password) {
    mHint = hint;
    View rootView = getView(context);
    ButterKnife.bind(this, rootView);
    txtHint.setText(hint);
    txtHintLayout.setVisibility(GONE);
    inputEditText.setHint(hint);
    inputEditText.setEnabled(editable);
    inputEditText.setText(text);
    if (password) {
        inputEditText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
        inputEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
    } else {
        inputEditText.setInputType(inputType);
    }
}
项目:cwac-crossport    文件:TextInputLayout.java   
/**
 * Returns whether the password visibility toggle functionality is enabled or not.
 *
   * <p>When enabled, a button is placed at the end of the EditText which enables the user
   * to switch between the field's input being visibly disguised or not.</p>
 *
 * @param enabled true to enable the functionality
   *
 * @attr ref android.support.design.R.styleable#TextInputLayout_passwordToggleEnabled
 */
public void setPasswordVisibilityToggleEnabled(final boolean enabled) {
  if (mPasswordToggleEnabled != enabled) {
    mPasswordToggleEnabled = enabled;

    if (!enabled && mPasswordToggledVisible && mEditText != null) {
      // If the toggle is no longer enabled, but we remove the PasswordTransformation
      // to make the password visible, add it back
      mEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }

    // Reset the visibility tracking flag
    mPasswordToggledVisible = false;

    updatePasswordToggleView();
  }
}
项目:cwac-crossport    文件:TextInputLayout.java   
private void passwordVisibilityToggleRequested(boolean shouldSkipAnimations) {
  if (mPasswordToggleEnabled) {
    // Store the current cursor position
    final int selection = mEditText.getSelectionEnd();

    if (hasPasswordTransformation()) {
      mEditText.setTransformationMethod(null);
      mPasswordToggledVisible = true;
    } else {
      mEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
      mPasswordToggledVisible = false;
    }

    mPasswordToggleView.setChecked(mPasswordToggledVisible);
          if (shouldSkipAnimations) {
              mPasswordToggleView.jumpDrawablesToCurrentState();
          }

    // And restore the cursor position
    mEditText.setSelection(selection);
  }
}
项目:Luhn    文件:PinTextInputLayout.java   
public void passwordVisibilityToggleRequested() throws NoSuchFieldException, IllegalAccessException {
    // Store the current cursor position
    int selection = getEditText().getSelectionEnd();

    if (!getEditText().getText().toString().isEmpty()) {
        getEditText().setTransformationMethod(PasswordTransformationMethod.getInstance());
        toggleEnabled("mPasswordToggledVisible", false);
        mPasswordToggleView.setChecked(false);
    } else {
        getEditText().setTransformationMethod(null);
        toggleEnabled("mPasswordToggledVisible", true);
        mPasswordToggleView.setChecked(true);
    }
    // And restore the cursor position
    getEditText().setSelection(selection);

}
项目:PlusGram    文件:PasscodeActivity.java   
private void updateDropDownTextView() {
    if (dropDown != null) {
        if (currentPasswordType == 0) {
            dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
        } else if (currentPasswordType == 1) {
            dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
        }
    }
    if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) {
        InputFilter[] filterArray = new InputFilter[1];
        filterArray[0] = new InputFilter.LengthFilter(4);
        passwordEditText.setFilters(filterArray);
        passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE);
        passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890"));
    } else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) {
        passwordEditText.setFilters(new InputFilter[0]);
        passwordEditText.setKeyListener(null);
        passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    }
    passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
项目:boohee_v5.6    文件:PasscodeView.java   
private void findView() {
    this.titleText = (TextView) findViewById(R.id.title);
    this.password1 = (EditText) findViewById(R.id.password1);
    this.password2 = (EditText) findViewById(R.id.password2);
    this.password3 = (EditText) findViewById(R.id.password3);
    this.password4 = (EditText) findViewById(R.id.password4);
    setFocusable(1);
    this.password1.setTransformationMethod(PasswordTransformationMethod.getInstance());
    this.password2.setTransformationMethod(PasswordTransformationMethod.getInstance());
    this.password3.setTransformationMethod(PasswordTransformationMethod.getInstance());
    this.password4.setTransformationMethod(PasswordTransformationMethod.getInstance());
    setTextChangeListener(this.password1, 2);
    setTextChangeListener(this.password2, 3);
    setTextChangeListener(this.password3, 4);
    setTextChangeListener(this.password4, 0);
}
项目:okwallet    文件:ShowPasswordCheckListener.java   
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
    final TransformationMethod transformationMethod = isChecked ? null : PasswordTransformationMethod.getInstance();

    for (final EditText passwordView : passwordViews)
        passwordView.setTransformationMethod(transformationMethod);
}
项目:appinventor-extensions    文件:PasswordTextBox.java   
/**
 * Creates a new PasswordTextBox component.
 *
 * @param container  container, component will be placed in
 */
public PasswordTextBox(ComponentContainer container) {
  super(container, new EditText(container.$context()));

  // Disable auto-suggestion.
  view.setRawInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);

  // make the box single line
  view.setSingleLine(true);
  // Add a transformation method to hide password text.   This must
  // be done after the SingleLine command
  view.setTransformationMethod(new PasswordTransformationMethod());

  // make sure the done action is Done and not Next.  See comment in Textbox.java
  view.setImeOptions(EditorInfo.IME_ACTION_DONE);

}
项目:oversec_crypto    文件:EditTextPasswordWithVisibilityToggle.java   
private void updatePasswordVisibility() {

        if (mPasswordVisible) {
            setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        } else {
            setTransformationMethod(PasswordTransformationMethod.getInstance());
        }


        Drawable drawable = ContextCompat.getDrawable(getContext(),R.drawable.ic_remove_red_eye_black_18dp);
        Drawable wrap = DrawableCompat.wrap(drawable);
        if (mPasswordVisible) {

            DrawableCompat.setTint(wrap, ContextCompat.getColor(getContext(), R.color.colorPrimary));
            DrawableCompat.setTintMode(wrap, PorterDuff.Mode.SRC_IN);
            wrap = wrap.mutate();
        } else {
            DrawableCompat.setTint(wrap, Color.BLACK);
            DrawableCompat.setTintMode(wrap, PorterDuff.Mode.SRC_IN);
            wrap = wrap.mutate();
        }
        setCompoundDrawablesWithIntrinsicBounds(null, null, wrap, null);
        setCompoundDrawablePadding(10);
    }
项目:EncuentraloFacil-Android    文件:LoginActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    String font_path = "font/FredokaOne-Regular.ttf";
    Typeface TF = Typeface.createFromAsset(getAssets(), font_path);
    TextView app_name1 = (TextView) findViewById(R.id.app_name1);
    app_name1.setTypeface(TF);
    TextView app_name2 = (TextView) findViewById(R.id.app_name2);
    app_name2.setTypeface(TF);
    TextView app_name3 = (TextView) findViewById(R.id.app_name3);
    app_name3.setTypeface(TF);

    input_user = (EditText) findViewById(R.id.input_user);
    input_password = (EditText) findViewById(R.id.input_password);
    input_password.setTypeface(Typeface.DEFAULT);
    input_password.setTransformationMethod(new PasswordTransformationMethod());

    RelativeLayout text_register = (RelativeLayout) findViewById(R.id.text_register);
    text_register.setOnClickListener(this);
    Button button_log_in = (Button) findViewById(R.id.button_log_in);
    button_log_in.setOnClickListener(this);
    Button button_log_in_facebook = (Button) findViewById(R.id.button_log_in_facebook);
    button_log_in_facebook.setOnClickListener(this);
}
项目:LeanoteAndroid    文件:RegisterActivity.java   
@OnClick(R.id.img_pwd_visible)
public void pwdVisible() {
    if (mPwdVisible) {
        mPwdVisible = false;
        mEditUsername.setTransformationMethod(PasswordTransformationMethod.getInstance());
        mEditPasswordConfim.setTransformationMethod(PasswordTransformationMethod.getInstance());
        mImgPwdVisible.setImageResource(R.drawable.ic_login_not_show_pwd);
    } else {
        mPwdVisible = true;
        mEditUsername.setTransformationMethod(null);
        mEditPasswordConfim.setTransformationMethod(null);
        mImgPwdVisible.setImageResource(R.drawable.ic_login_show_pwd);
    }
    mEditPassword.setSelection(mEditPassword.length());
    mEditPasswordConfim.setSelection(mEditPasswordConfim.length());
}
项目:RenewPass    文件:IntroActivity.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.credential_slide, container, false);

    final EditText editText = (EditText) view.findViewById(R.id.password_field);

    CheckBox checkBox = (CheckBox) view.findViewById(R.id.password_checkbox);
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                editText.setTransformationMethod(null);
            } else {
                editText.setTransformationMethod(new PasswordTransformationMethod());
            }
        }
    });

    return view;
}
项目:RenewPass    文件:PasswordPreference.java   
private CheckBox makePasswordCheckbox(View view) {
    final EditText editText = getEditText();

    CheckBox checkBox = new CheckBox(view.getContext());
    checkBox.setText(R.string.checkbox_show_password);
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                editText.setTransformationMethod(null);
            }
            else {
                editText.setTransformationMethod(new PasswordTransformationMethod());
            }
        }
    });
    return checkBox;
}
项目:cocos2dx-explode-animation    文件:Cocos2dxEditBox.java   
public void setInputFlag(int inputFlag) {

        switch (inputFlag) {
            case kEditBoxInputFlagPassword:
                this.mInputFlagConstraints = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
                this.setTypeface(Typeface.DEFAULT);
                this.setTransformationMethod(new PasswordTransformationMethod());
                break;
            case kEditBoxInputFlagSensitive:
                this.mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
                break;
            case kEditBoxInputFlagInitialCapsWord:
                this.mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_CAP_WORDS;
                break;
            case kEditBoxInputFlagInitialCapsSentence:
                this.mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
                break;
            case kEditBoxInputFlagInitialCapsAllCharacters:
                this.mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
                break;
            default:
                break;
        }

        this.setInputType(this.mInputFlagConstraints | this.mInputModeConstraints);
    }
项目:BufferTextInputLayout    文件:BufferTextInputLayout.java   
void passwordVisibilityToggleRequested() {
    if (passwordToggleEnabled) {
        // Store the current cursor position
        final int selection = editText.getSelectionEnd();
        if (hasPasswordTransformation()) {
            editText.setTransformationMethod(null);
            passwordToggledVisible = true;
        } else {
            editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            passwordToggledVisible = false;
        }
        passwordToggleView.setChecked(passwordToggledVisible);
        // And restore the cursor position
        editText.setSelection(selection);
    }
}
项目:Eulen    文件:login.java   
private void clearForm() {
    EditText editTextPassphrase = (EditText) findViewById(R.id.editTextPassphraseLogin);
    EditText editTextPin = (EditText) findViewById(R.id.editTextPinLogin);
    CheckBox checkRemember = (CheckBox) findViewById(R.id.checkRemember);

    savedPassphrase = null;
    NFCResult = null;
    prefs.edit().remove(CONST.PREFS_PASSPHRASE).apply();
    checkRemember.setChecked(false);
    checkRemember.setEnabled(true);
    editTextPassphrase.setText(null);
    editTextPassphrase.setEnabled(true);
    editTextPin.setText(null);
    editTextPassphrase.setTransformationMethod(new PasswordTransformationMethod());
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
    editTextPin.clearFocus();
    editTextPassphrase.clearFocus();
    enableGUI();
}
项目:material-components-android    文件:TextInputLayout.java   
/**
 * Returns whether the password visibility toggle functionality is enabled or not.
 *
 * <p>When enabled, a button is placed at the end of the EditText which enables the user to switch
 * between the field's input being visibly disguised or not.
 *
 * @param enabled true to enable the functionality
 * @attr ref android.support.design.R.styleable#TextInputLayout_passwordToggleEnabled
 */
public void setPasswordVisibilityToggleEnabled(final boolean enabled) {
  if (passwordToggleEnabled != enabled) {
    passwordToggleEnabled = enabled;

    if (!enabled && passwordToggledVisible && editText != null) {
      // If the toggle is no longer enabled, but we remove the PasswordTransformation
      // to make the password visible, add it back
      editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }

    // Reset the visibility tracking flag
    passwordToggledVisible = false;

    updatePasswordToggleView();
  }
}
项目:material-components-android    文件:TextInputLayout.java   
private void passwordVisibilityToggleRequested(boolean shouldSkipAnimations) {
  if (passwordToggleEnabled) {
    // Store the current cursor position
    final int selection = editText.getSelectionEnd();

    if (hasPasswordTransformation()) {
      editText.setTransformationMethod(null);
      passwordToggledVisible = true;
    } else {
      editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
      passwordToggledVisible = false;
    }

    passwordToggleView.setChecked(passwordToggledVisible);
    if (shouldSkipAnimations) {
      passwordToggleView.jumpDrawablesToCurrentState();
    }

    // And restore the cursor position
    editText.setSelection(selection);
  }
}
项目:LoginRegisterFramework    文件:LoginActivity.java   
/**
 * 初始化视图
 */
private void initViews() {
    accountEdit = (CleanEditText) this.findViewById(R.id.et_email_phone);
    accountEdit.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    accountEdit.setTransformationMethod(HideReturnsTransformationMethod
            .getInstance());
    passwordEdit = (CleanEditText) this.findViewById(R.id.et_password);
    passwordEdit.setImeOptions(EditorInfo.IME_ACTION_DONE);
    passwordEdit.setImeOptions(EditorInfo.IME_ACTION_GO);
    passwordEdit.setTransformationMethod(PasswordTransformationMethod
            .getInstance());
    passwordEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId,
                                      KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE
                    || actionId == EditorInfo.IME_ACTION_GO) {
                clickLogin();
            }
            return false;
        }
    });
}
项目:MartialStudySelf    文件:RegisterActivity.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
        case R.id.register_see:
            if (!isChecked) {
                password.setTransformationMethod(new PasswordTransformationMethod());
            }else {
                password.setTransformationMethod(null);
            }
            break;
        case R.id.register_see_see:
            if (!isChecked) {
                passwordConfirm.setTransformationMethod(new PasswordTransformationMethod());
            }else {
                passwordConfirm.setTransformationMethod(null);
            }
            break;
    }
}
项目:Android-Shortify    文件:Views.java   
public static $ pwd(boolean option){
    try{
        if(mView instanceof TextView){
            TextView textView = (TextView) mView;
            if(option)
                textView.setTransformationMethod(new PasswordTransformationMethod());
            else
                textView.setTransformationMethod(null);
        }
        else if(mView instanceof EditText){
            EditText editText = (EditText) mView;
            if(option)
                editText.setTransformationMethod(new PasswordTransformationMethod());
            else
                editText.setTransformationMethod(null);
        }
    }catch (Exception e){
        Log.d(TAG, e.getMessage());
    }
    return  $.getInstance();
}
项目:A-week-to-develop-android-app-plan    文件:LoginActivity.java   
/**
 * 初始化视图
 */
private void initViews() {
    accountEdit = (CleanEditText) this.findViewById(R.id.et_email_phone);
    accountEdit.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    accountEdit.setTransformationMethod(HideReturnsTransformationMethod
            .getInstance());
    passwordEdit = (CleanEditText) this.findViewById(R.id.et_password);
    passwordEdit.setImeOptions(EditorInfo.IME_ACTION_DONE);
    passwordEdit.setImeOptions(EditorInfo.IME_ACTION_GO);
    passwordEdit.setTransformationMethod(PasswordTransformationMethod
            .getInstance());
    passwordEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId,
                                      KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE
                    || actionId == EditorInfo.IME_ACTION_GO) {
                clickLogin();
            }
            return false;
        }
    });
}
项目:A-week-to-develop-android-app-plan    文件:LoginActivity.java   
/**
 * 初始化视图
 */
private void initViews() {
    accountEdit = (CleanEditText) this.findViewById(R.id.et_email_phone);
    accountEdit.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    accountEdit.setTransformationMethod(HideReturnsTransformationMethod
            .getInstance());
    passwordEdit = (CleanEditText) this.findViewById(R.id.et_password);
    passwordEdit.setImeOptions(EditorInfo.IME_ACTION_DONE);
    passwordEdit.setImeOptions(EditorInfo.IME_ACTION_GO);
    passwordEdit.setTransformationMethod(PasswordTransformationMethod
            .getInstance());
    passwordEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId,
                                      KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE
                    || actionId == EditorInfo.IME_ACTION_GO) {
                clickLogin();
            }
            return false;
        }
    });
}
项目:wordpress_app_android    文件:AbstractFragment.java   
protected void initPasswordVisibilityButton(View rootView, final EditText passwordEditText) {
    final ImageView passwordVisibility = (ImageView) rootView.findViewById(R.id.password_visibility);
    if (passwordVisibility == null) {
        return;
    }
    passwordVisibility.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mPasswordVisible = !mPasswordVisible;
            if (mPasswordVisible) {
                passwordVisibility.setImageResource(R.drawable.dashicon_eye_open);
                passwordVisibility.setColorFilter(v.getContext().getResources().getColor(R.color.nux_eye_icon_color_open));
                passwordEditText.setTransformationMethod(null);
            } else {
                passwordVisibility.setImageResource(R.drawable.dashicon_eye_closed);
                passwordVisibility.setColorFilter(v.getContext().getResources().getColor(R.color.nux_eye_icon_color_closed));
                passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            }
            passwordEditText.setSelection(passwordEditText.length());
        }
    });
}
项目:AndroidUI    文件:PasswordEditText.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_UP) {
        boolean touchable = ( getWidth() - mWidth - Interval < event.getX() ) && (event.getX() < getWidth() - Interval);
        if (touchable) {
            isVisible = !isVisible;
            if (isVisible){
                //设置EditText文本为可见的
                setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }else{
                //设置EditText文本为隐藏的
                setTransformationMethod(PasswordTransformationMethod.getInstance());
            }
        }
    }
    return super.onTouchEvent(event);
}
项目:AMPASIDE    文件:AndroidTextFieldUI.java   
public void setConstraints(final int constraints) {
    activity.post(new Runnable() {
        public void run() {
               if ((constraints & TextField.CONSTRAINT_MASK) == TextField.URL) {
                   editView.setSingleLine(true);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.NUMERIC) {
                   editView.setSingleLine(true);
                   editView.setInputType(InputType.TYPE_CLASS_NUMBER);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.DECIMAL) {
                   editView.setSingleLine(true);
                   editView.setInputType(
                           InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL);
               } else if ((constraints & TextField.CONSTRAINT_MASK) == TextField.PHONENUMBER) {
                   editView.setSingleLine(true);
                   editView.setInputType(InputType.TYPE_CLASS_PHONE);
               }
               if ((constraints & TextField.PASSWORD) != 0) {
                   editView.setTransformationMethod(PasswordTransformationMethod.getInstance());
                   editView.setTypeface(Typeface.MONOSPACE);
               }
        }
    });
}
项目:mc_backup    文件:FxAccountAbstractSetupActivity.java   
@SuppressWarnings("deprecation")
protected void setPasswordButtonShown(boolean shouldShow) {
  // Changing input type loses position in edit text; let's try to maintain it.
  int start = passwordEdit.getSelectionStart();
  int stop = passwordEdit.getSelectionEnd();

  if (!shouldShow) {
    passwordEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
    showPasswordButton.setText(R.string.fxaccount_password_show);
    showPasswordButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.fxaccount_password_button_show_background));
    showPasswordButton.setTextColor(ColorUtils.getColor(this, R.color.fxaccount_password_show_textcolor));
  } else {
    passwordEdit.setTransformationMethod(SingleLineTransformationMethod.getInstance());
    showPasswordButton.setText(R.string.fxaccount_password_hide);
    showPasswordButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.fxaccount_password_button_hide_background));
    showPasswordButton.setTextColor(ColorUtils.getColor(this, R.color.fxaccount_password_hide_textcolor));
  }
  passwordEdit.setSelection(start, stop);
}
项目:TimberdoodleApp    文件:PasswordDialog.java   
private void showPasswordDialog(@StringRes int title,
                                final OnPasswordEnteredListener okListener,
                                final DialogInterface.OnClickListener cancelListener) {
    // Create EditText for entering the password
    final EditText input = new EditText(context);
    input.setSingleLine();
    input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    input.setTransformationMethod(PasswordTransformationMethod.getInstance());

    // Create and show dialog
    showDialog(new AlertDialog.Builder(context)
            .setTitle(title)
            .setView(input)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    okListener.onPasswordEntered(dialog, which, input.getText().toString());
                }
            })
            .setNegativeButton(android.R.string.cancel, cancelListener));
}
项目:Passbook    文件:DetailFragment.java   
void changeDisplay(View view, int pos) {
    if(mShowPwd) {
        return;
    }
    Account.Entry entry = mItems.get(pos);
    if(entry.mType == AccountManager.EntryType.PASSWORD ||
            entry.mType == AccountManager.EntryType.PIN) {
        boolean showed = mPwdShowed.get(pos);
        ViewHolder holder = (ViewHolder)view.getTag();
        if(showed) {
            holder.mValue.setTransformationMethod(
                    PasswordTransformationMethod.getInstance());
        } else {
            holder.mValue.setTransformationMethod(
                    SingleLineTransformationMethod.getInstance());
        }
        mPwdShowed.set(pos, !showed);
    }
}
项目:iosched    文件:TextInputLayout.java   
/**
 * Returns whether the password visibility toggle functionality is enabled or not.
 *
 * <p>When enabled, a button is placed at the end of the EditText which enables the user to switch
 * between the field's input being visibly disguised or not.
 *
 * @param enabled true to enable the functionality
 * @attr ref android.support.design.R.styleable#TextInputLayout_passwordToggleEnabled
 */
public void setPasswordVisibilityToggleEnabled(final boolean enabled) {
  if (mPasswordToggleEnabled != enabled) {
    mPasswordToggleEnabled = enabled;

    if (!enabled && mPasswordToggledVisible && mEditText != null) {
      // If the toggle is no longer enabled, but we remove the PasswordTransformation
      // to make the password visible, add it back
      mEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }

    // Reset the visibility tracking flag
    mPasswordToggledVisible = false;

    updatePasswordToggleView();
  }
}
项目:iosched    文件:TextInputLayout.java   
void passwordVisibilityToggleRequested() {
  if (mPasswordToggleEnabled) {
    // Store the current cursor position
    final int selection = mEditText.getSelectionEnd();

    if (hasPasswordTransformation()) {
      mEditText.setTransformationMethod(null);
      mPasswordToggledVisible = true;
    } else {
      mEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
      mPasswordToggledVisible = false;
    }

    mPasswordToggleView.setChecked(mPasswordToggledVisible);

    // And restore the cursor position
    mEditText.setSelection(selection);
  }
}
项目:Nepenthes-Android    文件:PasswordEdt.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    final int lens = this.getText().toString().length();
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN: {
            boolean isClean = (event.getX() > (getWidth() - getTotalPaddingRight())) && (event.getX() < (getWidth() - getPaddingRight()));
            if (isClean) {
                this.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                setSelection(lens);
            }
        }
        break;
        case MotionEvent.ACTION_UP: {
            this.setTransformationMethod(PasswordTransformationMethod.getInstance());
            setSelection(lens);
        }
        break;
        default:
            break;
    }
    return super.onTouchEvent(event);
}
项目:AutoAP    文件:MainActivity.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
        case R.id.ap_button:
            if (isChecked) {
                //Turn on AP
                enableAP();
            } else {
                //Turn off AP
                disableAP();
            }
            break;
        case R.id.checkBox:
            if (!isChecked) {
                passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                passwordEditText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
    }
}
项目:GomeOnline    文件:Regist3Activity.java   
@AfterViews
    protected void init() {
        setTitle(R.string.regist3);
//      phone="11112345685";
        passwdCheck.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
//                  mEditTextPw.setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL);
                    mEditTextPw.setTransformationMethod(HideReturnsTransformationMethod.getInstance());  
                    mEditTextPw.setSelection(mEditTextPw.getText().length());
                }else{
                    mEditTextPw.setTransformationMethod(PasswordTransformationMethod.getInstance());  
                    mEditTextPw.setSelection(mEditTextPw.getText().length());
//                  mEditTextPw.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
                }
            }
        });
    }
项目:prey-android-client-master    文件:PasswordActivity.java   
protected void bindPasswordControls() {
    Button checkPasswordOkButton = (Button) findViewById(R.id.password_btn_login);
    final EditText pass1 = ((EditText) findViewById(R.id.password_pass_txt));
    checkPasswordOkButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            final String passwordtyped = pass1.getText().toString();
            if (passwordtyped.equals(""))
                Toast.makeText(PasswordActivity.this, R.string.preferences_password_length_error, Toast.LENGTH_LONG).show();
            else
                new CheckPassword().execute(passwordtyped);

        }
    });

    //Hack to fix hint's typeface: http://stackoverflow.com/questions/3406534/password-hint-font-in-android
    EditText password = (EditText) findViewById(R.id.password_pass_txt);
    password.setTypeface(Typeface.DEFAULT);
    password.setTransformationMethod(new PasswordTransformationMethod());
}