java类android.text.method.PasswordTransformationMethod的实例源码

LogInActivity.java 文件源码 项目:wirtualnaApteczka 阅读 31 收藏 0 点赞 0 评论 0
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);
}
RegistrationActivity.java 文件源码 项目:wirtualnaApteczka 阅读 28 收藏 0 点赞 0 评论 0
@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());
}
PinTextInputLayout.java 文件源码 项目:africastalking-android 阅读 24 收藏 0 点赞 0 评论 0
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);

}
PasscodeActivity.java 文件源码 项目:airgram 阅读 30 收藏 0 点赞 0 评论 0
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());
}
LoginActivity.java 文件源码 项目:letv 阅读 25 收藏 0 点赞 0 评论 0
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();
}
CustomTextView.java 文件源码 项目:CustomFormViews 阅读 31 收藏 0 点赞 0 评论 0
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);
    }
}
TextInputLayout.java 文件源码 项目:cwac-crossport 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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();
  }
}
TextInputLayout.java 文件源码 项目:cwac-crossport 阅读 19 收藏 0 点赞 0 评论 0
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);
  }
}
PinTextInputLayout.java 文件源码 项目:Luhn 阅读 31 收藏 0 点赞 0 评论 0
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);

}
PasscodeActivity.java 文件源码 项目:PlusGram 阅读 26 收藏 0 点赞 0 评论 0
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());
}
PasscodeView.java 文件源码 项目:boohee_v5.6 阅读 19 收藏 0 点赞 0 评论 0
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);
}
ShowPasswordCheckListener.java 文件源码 项目:okwallet 阅读 20 收藏 0 点赞 0 评论 0
@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);
}
PasswordTextBox.java 文件源码 项目:appinventor-extensions 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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);

}
EditTextPasswordWithVisibilityToggle.java 文件源码 项目:oversec_crypto 阅读 27 收藏 0 点赞 0 评论 0
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);
    }
LoginActivity.java 文件源码 项目:EncuentraloFacil-Android 阅读 41 收藏 0 点赞 0 评论 0
@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);
}
RegisterActivity.java 文件源码 项目:LeanoteAndroid 阅读 28 收藏 0 点赞 0 评论 0
@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());
}
IntroActivity.java 文件源码 项目:RenewPass 阅读 32 收藏 0 点赞 0 评论 0
@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;
}
PasswordPreference.java 文件源码 项目:RenewPass 阅读 20 收藏 0 点赞 0 评论 0
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;
}
Cocos2dxEditBox.java 文件源码 项目:cocos2dx-explode-animation 阅读 20 收藏 0 点赞 0 评论 0
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.java 文件源码 项目:BufferTextInputLayout 阅读 25 收藏 0 点赞 0 评论 0
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);
    }
}
login.java 文件源码 项目:Eulen 阅读 39 收藏 0 点赞 0 评论 0
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();
}
TextInputLayout.java 文件源码 项目:material-components-android 阅读 30 收藏 0 点赞 0 评论 0
/**
 * 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();
  }
}
TextInputLayout.java 文件源码 项目:material-components-android 阅读 28 收藏 0 点赞 0 评论 0
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);
  }
}
LoginActivity.java 文件源码 项目:LoginRegisterFramework 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 初始化视图
 */
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;
        }
    });
}
RegisterActivity.java 文件源码 项目:MartialStudySelf 阅读 17 收藏 0 点赞 0 评论 0
@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;
    }
}
Views.java 文件源码 项目:Android-Shortify 阅读 19 收藏 0 点赞 0 评论 0
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();
}
LoginActivity.java 文件源码 项目:A-week-to-develop-android-app-plan 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 初始化视图
 */
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;
        }
    });
}
LoginActivity.java 文件源码 项目:A-week-to-develop-android-app-plan 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 初始化视图
 */
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;
        }
    });
}
AbstractFragment.java 文件源码 项目:wordpress_app_android 阅读 27 收藏 0 点赞 0 评论 0
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());
        }
    });
}
PasswordEditText.java 文件源码 项目:AndroidUI 阅读 25 收藏 0 点赞 0 评论 0
@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);
}


问题


面经


文章

微信
公众号

扫码关注公众号