本文整理汇总了Java中android.text.method.PasswordTransformationMethod类的典型用法代码示例。如果您正苦于以下问题:Java PasswordTransformationMethod类的具体用法?Java PasswordTransformationMethod怎么用?Java PasswordTransformationMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PasswordTransformationMethod类属于android.text.method包,在下文中一共展示了PasswordTransformationMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeViewComponents
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
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);
}
示例2: onCreate
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
@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());
}
示例3: passwordVisibilityToggleRequested
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
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);
}
示例4: updateDropDownTextView
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
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());
}
示例5: beautyView
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
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();
}
示例6: init
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
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);
}
}
示例7: setPasswordVisibilityToggleEnabled
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
/**
* 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();
}
}
示例8: passwordVisibilityToggleRequested
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
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);
}
}
示例9: findView
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
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);
}
示例10: onCheckedChanged
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
@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);
}
示例11: PasswordTextBox
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
/**
* 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);
}
示例12: updatePasswordVisibility
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
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);
}
示例13: onCreate
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
@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);
}
示例14: pwdVisible
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
@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());
}
示例15: onCreateView
import android.text.method.PasswordTransformationMethod; //导入依赖的package包/类
@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;
}