android.text.method.HideReturnsTransformationMethod Java Examples
The following examples show how to use
android.text.method.HideReturnsTransformationMethod.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java From AutoAP with Apache License 2.0 | 6 votes |
@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()); } } }
Example #2
Source File: EditTextUtils.java From DevUtils with Apache License 2.0 | 6 votes |
/** * 设置密码文本视图显示转换 * @param editText {@link EditText} * @param isDisplayPassword 是否显示密码 * @param isSelectBottom 是否设置光标到最后 * @param <T> 泛型 * @return {@link EditText} */ public static <T extends EditText> T setTransformationMethod(final T editText, final boolean isDisplayPassword, final boolean isSelectBottom) { if (editText != null) { // 获取光标位置 int curSelect = 0; if (!isSelectBottom) { curSelect = getSelectionStart(editText); } editText.setTransformationMethod(isDisplayPassword ? HideReturnsTransformationMethod.getInstance() : PasswordTransformationMethod.getInstance()); if (isSelectBottom) { // 设置光标到最后 setSelectionToBottom(editText); } else { // 设置光标到之前的位置 setSelection(editText, curSelect); } } return editText; }
Example #3
Source File: PasswordEditText.java From AndroidUI with MIT License | 6 votes |
@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); }
Example #4
Source File: LoginActivity.java From A-week-to-develop-android-app-plan with Apache License 2.0 | 6 votes |
/** * 初始化视图 */ 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; } }); }
Example #5
Source File: LoginActivity.java From A-week-to-develop-android-app-plan with Apache License 2.0 | 6 votes |
/** * 初始化视图 */ 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; } }); }
Example #6
Source File: InputView.java From alpha-wallet-android with MIT License | 6 votes |
private void bindViews() { inflate(context, R.layout.layout_input_view, this); label = findViewById(R.id.label); label.setText(labelResId); error = findViewById(R.id.error); editText = findViewById(R.id.edit_text); togglePassword = findViewById(R.id.toggle_password); togglePassword.setOnCheckedChangeListener((buttonView, isChecked) -> { if (isChecked) { editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } else { editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); } editText.setSelection(editText.getText().length()); }); }
Example #7
Source File: LoginActivity.java From letv with Apache License 2.0 | 6 votes |
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(); }
Example #8
Source File: PayPwdEditText.java From PayPwdEditText with Apache License 2.0 | 5 votes |
/** * 是否显示明文 * @param showPwd */ public void setShowPwd(boolean showPwd) { int length = textViews.length; for(int i = 0; i < length; i++) { if (showPwd) { textViews[i].setTransformationMethod(PasswordTransformationMethod.getInstance()); } else { textViews[i].setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } } }
Example #9
Source File: ManagerUserServices.java From logmein-android with GNU General Public License v3.0 | 5 votes |
/** * Takes care if checked/unchecked box for showing/not showing password */ private void show_password() { if (mChbShowPwd.isChecked()) { mTextboxPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); return; } mTextboxPassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); }
Example #10
Source File: PasswordShow.java From commcare-android with Apache License 2.0 | 5 votes |
private void passwordShownState() { isPasswordVisible = true; showPasswordButton.setVisibility(View.VISIBLE); showPasswordButton.setText(hideText); passwordField.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); passwordField.setSelection(passwordField.getText().length()); }
Example #11
Source File: PinViewBaseHelper.java From PinView with Apache License 2.0 | 5 votes |
/** * Set a PinBox with all attributes * * @param editText to set attributes */ private void setStylePinBox(EditText editText) { editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mNumberCharacters)}); if (mMaskPassword) { editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else{ editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } if (mNativePinBox) { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { //noinspection deprecation editText.setBackgroundDrawable(new EditText(getContext()).getBackground()); } else { editText.setBackground(new EditText(getContext()).getBackground()); } } else { editText.setBackgroundResource(mCustomDrawablePinBox); } if (mColorTextPinBoxes != PinViewSettings.DEFAULT_TEXT_COLOR_PIN_BOX) { editText.setTextColor(mColorTextPinBoxes); } editText.setTextSize(PinViewUtils.convertPixelToDp(getContext(), mTextSizePinBoxes)); }
Example #12
Source File: MdInputHolder.java From DialogUtil with Apache License 2.0 | 5 votes |
private void setInputStyle(Context context, ConfigBean bean) { if (TextUtils.isEmpty(bean.hint1)) { et1.setVisibility(View.GONE); } else { bean.setNeedSoftKeyboard(true); et1.setVisibility(View.VISIBLE); et1.setHint(bean.hint1); et1.setTextColor(Tool.getColor(et1.getContext(), bean.inputTxtColor)); et1.setTextSize(bean.inputTxtSize); if(!TextUtils.isEmpty(bean.inputText1)){ et1.setText(bean.inputText1); et1.setSelection(bean.inputText1.length()); } } if (TextUtils.isEmpty(bean.hint2)) { et2.setVisibility(View.GONE); } else { bean.setNeedSoftKeyboard(true); et2.setVisibility(View.VISIBLE); et2.setHint(bean.hint2); et2.setTextColor(Tool.getColor(et2.getContext(), bean.inputTxtColor)); et2.setTextSize(bean.inputTxtSize); if (bean.isInput2HideAsPassword) { //设置EditText文本为可见的 et2.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else { //设置EditText文本为隐藏的 et2.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } if(!TextUtils.isEmpty(bean.inputText2)){ et2.setText(bean.inputText2); et2.setSelection(bean.inputText2.length()); } } }
Example #13
Source File: PinViewBaseHelper.java From nono-android with GNU General Public License v3.0 | 5 votes |
/** * Set a PinBox with all attributes * * @param editText to set attributes */ private void setStylePinBox(EditText editText) { editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mNumberCharacters)}); if (mMaskPassword) { editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else{ editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } if (mNativePinBox) { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { //noinspection deprecation editText.setBackgroundDrawable(new EditText(getContext()).getBackground()); } else { editText.setBackground(new EditText(getContext()).getBackground()); } } else { editText.setBackgroundResource(mCustomDrawablePinBox); } if (mColorTextPinBoxes != PinViewSettings.DEFAULT_TEXT_COLOR_PIN_BOX) { editText.setTextColor(mColorTextPinBoxes); } editText.setTextSize(PinViewUtils.convertPixelToDp(getContext(), mTextSizePinBoxes)); }
Example #14
Source File: ForgetActivity.java From tysq-android with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.tv_send_code: sendCode(); break; case R.id.tv_next_step: nextStep(); break; case R.id.iv_back: onBackPressed(); break; case R.id.iv_pwd_state: isHidePwd = !isHidePwd; int startNew = etPwdNew.getSelectionStart(); int startConfirm = etPwdConfirm.getSelectionStart(); if (isHidePwd) { ivPwdState.setImageDrawable( ContextCompat.getDrawable(this, R.drawable.ic_pwd_show)); etPwdNew.setTransformationMethod(PasswordTransformationMethod.getInstance()); etPwdConfirm.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else { ivPwdState.setImageDrawable( ContextCompat.getDrawable(this, R.drawable.ic_pwd_hide)); etPwdNew.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); etPwdConfirm.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } etPwdNew.setSelection(startNew); etPwdConfirm.setSelection(startConfirm); break; case R.id.tv_confirm: resetPwd(); break; } }
Example #15
Source File: RegisterActivity.java From Huochexing12306 with Apache License 2.0 | 5 votes |
private void setPwdVisible(boolean b) { if (!b){ ivEye.setBackgroundResource(R.drawable.eye_close); ivEye.setTag(false); etPwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); }else{ ivEye.setBackgroundResource(R.drawable.eye_open); ivEye.setTag(true); etPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } etPwd.invalidate(); }
Example #16
Source File: PasswordInputView.java From alpha-wallet-android with MIT License | 5 votes |
private void setViews() { label.setText(labelResId); if (labelResId != R.string.empty) label.setVisibility(View.VISIBLE); togglePassword.setOnCheckedChangeListener((buttonView, isChecked) -> { if (isChecked) { editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } else { editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); } editText.setSelection(editText.getText().length()); }); }
Example #17
Source File: PwdClearableLayout.java From AndroidFrame with Apache License 2.0 | 5 votes |
/** * 显示密码 */ private void showPassword() { et_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); et_password.postInvalidate(); // et_password.setInputType(InputType.TYPE_CLASS_TEXT // | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); }
Example #18
Source File: TextViewUtils.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 设置密码文本视图显示转换 * @param textView {@link TextView} * @param isDisplayPassword 是否显示密码 * @param <T> 泛型 * @return {@link TextView} */ public static <T extends TextView> T setTransformationMethod(final T textView, final boolean isDisplayPassword) { if (textView != null) { textView.setTransformationMethod(isDisplayPassword ? HideReturnsTransformationMethod.getInstance() : PasswordTransformationMethod.getInstance()); } return textView; }
Example #19
Source File: RegisterActivity.java From tysq-android with GNU General Public License v3.0 | 5 votes |
/** * 设置是否要显示密码 * * @param isHidePwd true:隐藏密码 * false: 显示密码 */ private void setPwdState(boolean isHidePwd) { int start = etPwd.getSelectionStart(); if (isHidePwd) { ivPwdState.setImageDrawable( ContextCompat.getDrawable(this, R.drawable.ic_pwd_show)); etPwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else { ivPwdState.setImageDrawable( ContextCompat.getDrawable(this, R.drawable.ic_pwd_hide)); etPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } etPwd.setSelection(start); }
Example #20
Source File: ResetPwdFragment.java From tysq-android with GNU General Public License v3.0 | 5 votes |
private void setPwdState(ImageView imageView, EditText editText, boolean isHidePwd) { int start = editText.getSelectionStart(); if (isHidePwd) { imageView.setImageDrawable(hidePwdDrawable); editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else { imageView.setImageDrawable(showPwdDrawable); editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } editText.setSelection(start); }
Example #21
Source File: LoginActivity.java From tysq-android with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.iv_back: finishPage(false); break; case R.id.iv_refresh: loadCode(); break; case R.id.iv_pwd_state: isHidePwd = !isHidePwd; int start = etPwd.getSelectionStart(); if (isHidePwd) { ivPwdState.setImageDrawable( ContextCompat.getDrawable(this, R.drawable.ic_pwd_show)); etPwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else { ivPwdState.setImageDrawable( ContextCompat.getDrawable(this, R.drawable.ic_pwd_hide)); etPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } etPwd.setSelection(start); break; case R.id.tv_login: login(); break; case R.id.tv_register: RegisterActivity.startActivity(this, getEmailInfo()); break; case R.id.tv_forget_pwd: ForgetActivity.startActivity(this, getEmailInfo()); break; } }
Example #22
Source File: PasswordEditText.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
public PasswordEditText(Context context, AttributeSet attrs) { super(context, attrs); // 方式1获取属性 TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PasswordEditText); hintString = a .getString(R.styleable.PasswordEditText_PasswordEditText_hint); passwordEditTextToggle = a .getDrawable(R.styleable.PasswordEditText_PasswordEditText_toggle); hintColor = a.getColor(R.styleable.PasswordEditText_PasswordEditText_hint_color,getContext().getResources().getColor(R.color.gray_half_5)); passwordEditTextIcon = a .getDrawable(R.styleable.PasswordEditText_PasswordEditText_icon); passwordEditTextBackground = a .getDrawable(R.styleable.PasswordEditText_PasswordEditText_background); a.recycle(); View view = LayoutInflater.from(context).inflate( R.layout.password_edittext, null); tbPasswordEditTextToggle = (ToggleButton) view .findViewById(R.id.tb_password_eidttext_toggle); if (passwordEditTextToggle != null) tbPasswordEditTextToggle .setBackgroundDrawable(passwordEditTextToggle); et = (EditText) view.findViewById(R.id.et_password_eidttext_edittext); if (!TextUtils.isEmpty(hintString)) et.setHint(hintString); et.setHintTextColor(hintColor); rl = (RelativeLayout) view .findViewById(R.id.rl); if(passwordEditTextBackground !=null) rl.setBackgroundDrawable(passwordEditTextBackground); ivPasswordEditTextIcon = (ImageView) view.findViewById(R.id.iv_with_del_eidttext_icon); if (passwordEditTextIcon != null) ivPasswordEditTextIcon .setImageDrawable(passwordEditTextIcon); tbPasswordEditTextToggle.setChecked(true); tbPasswordEditTextToggle .setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (!isChecked) { et.setTransformationMethod(HideReturnsTransformationMethod .getInstance()); } else { et.setTransformationMethod(PasswordTransformationMethod .getInstance()); } et.postInvalidate(); Editable editable = et.getText(); et.setSelection(editable.length()); } }); // ivPasswordEditTextToggle.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // // if (tbPasswordEditTextToggle.isChecked()) { // et.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); // } else { // et.setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL); // } // } // }); // 给编辑框添加文本改变事件 // et.addTextChangedListener(new MyTextWatcher()); // 把获得的view加载到这个控件中 addView(view); }
Example #23
Source File: BackgroundDetectService.java From GrabQQPWD with Apache License 2.0 | 4 votes |
private void showWindow(){ windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); WindowManager.LayoutParams params = new WindowManager.LayoutParams(); params.width = WindowManager.LayoutParams.MATCH_PARENT; params.height = WindowManager.LayoutParams.MATCH_PARENT; params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; params.format = PixelFormat.TRANSPARENT; params.gravity = Gravity.CENTER; params.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN; LayoutInflater inflater = LayoutInflater.from(this); v = (RelativeLayoutWithKeyDetect) inflater.inflate(R.layout.window, null); v.setCallback(new RelativeLayoutWithKeyDetect.IKeyCodeBackCallback() { @Override public void backCallback() { if (v!=null && v.isAttachedToWindow()) L.e("remove view "); windowManager.removeViewImmediate(v); } }); btn_sure = (Button) v.findViewById(R.id.btn_sure); btn_cancel = (Button) v.findViewById(R.id.btn_cancel); et_account = (EditText) v.findViewById(R.id.et_account); et_pwd = (EditText) v.findViewById(R.id.et_pwd); cb_showpwd = (CheckBox) v.findViewById(R.id.cb_showpwd); cb_showpwd.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { et_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } else { et_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); } et_pwd.setSelection(TextUtils.isEmpty(et_pwd.getText()) ? 0 : et_pwd.getText().length()); } }); //useless // v.setOnKeyListener(new View.OnKeyListener() { // @Override // public boolean onKey(View v, int keyCode, KeyEvent event) { // Log.e("zhao", keyCode+""); // if (keyCode == KeyEvent.KEYCODE_BACK) { // windowManager.removeViewImmediate(v); // return true; // } // return false; // } // }); //点击外部消失 v.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { Rect temp = new Rect(); view.getGlobalVisibleRect(temp); L.e("remove view "); if (temp.contains((int)(event.getX()), (int)(event.getY()))){ windowManager.removeViewImmediate(v); return true; } return false; } }); btn_sure.setOnClickListener(this); btn_cancel.setOnClickListener(this); L.e("add view "); windowManager.addView(v, params); }
Example #24
Source File: RegisterActivity.java From LQRWeChat with MIT License | 4 votes |
@Override public void initListener() { mEtNick.addTextChangedListener(watcher); mEtPwd.addTextChangedListener(watcher); mEtPhone.addTextChangedListener(watcher); mEtVerifyCode.addTextChangedListener(watcher); mEtNick.setOnFocusChangeListener((v, hasFocus) -> { if (hasFocus) { mVLineNick.setBackgroundColor(UIUtils.getColor(R.color.green0)); } else { mVLineNick.setBackgroundColor(UIUtils.getColor(R.color.line)); } }); mEtPwd.setOnFocusChangeListener((v, hasFocus) -> { if (hasFocus) { mVLinePwd.setBackgroundColor(UIUtils.getColor(R.color.green0)); } else { mVLinePwd.setBackgroundColor(UIUtils.getColor(R.color.line)); } }); mEtPhone.setOnFocusChangeListener((v, hasFocus) -> { if (hasFocus) { mVLinePhone.setBackgroundColor(UIUtils.getColor(R.color.green0)); } else { mVLinePhone.setBackgroundColor(UIUtils.getColor(R.color.line)); } }); mEtVerifyCode.setOnFocusChangeListener((v, hasFocus) -> { if (hasFocus) { mVLineVertifyCode.setBackgroundColor(UIUtils.getColor(R.color.green0)); } else { mVLineVertifyCode.setBackgroundColor(UIUtils.getColor(R.color.line)); } }); mIvSeePwd.setOnClickListener(v -> { if (mEtPwd.getTransformationMethod() == HideReturnsTransformationMethod.getInstance()) { mEtPwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else { mEtPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } mEtPwd.setSelection(mEtPwd.getText().toString().trim().length()); }); mBtnSendCode.setOnClickListener(v -> { if (mBtnSendCode.isEnabled()) { mPresenter.sendCode(); } }); mBtnRegister.setOnClickListener(v -> { mPresenter.register(); }); }
Example #25
Source File: IosAlertDialogHolder.java From DialogUtil with Apache License 2.0 | 4 votes |
private void setInputStyle(Context context, ConfigBean bean) { if (TextUtils.isEmpty(bean.hint1)) { et1.setVisibility(View.GONE); } else { bean.setNeedSoftKeyboard(true); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) sv.getLayoutParams(); params.height = LinearLayout.LayoutParams.WRAP_CONTENT; params.weight = 0; sv.setLayoutParams(params); et1.setVisibility(View.VISIBLE); et1.setHint(bean.hint1); et1.setTextColor(Tool.getColor(et1.getContext(),bean.inputTxtColor)); et1.setTextSize(bean.inputTxtSize); if(!TextUtils.isEmpty(bean.inputText1)){ et1.setText(bean.inputText1); et1.setSelection(bean.inputText1.length()); } } if (TextUtils.isEmpty(bean.hint2)) { et2.setVisibility(View.GONE); } else { bean.setNeedSoftKeyboard(true); et2.setVisibility(View.VISIBLE); et2.setHint(bean.hint2); et2.setTextColor(Tool.getColor(et2.getContext(),bean.inputTxtColor)); et2.setTextSize(bean.inputTxtSize); if (bean.isInput2HideAsPassword) { //设置EditText文本为可见的 et2.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else { //设置EditText文本为隐藏的 et2.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } if(!TextUtils.isEmpty(bean.inputText2)){ et2.setText(bean.inputText2); et2.setSelection(bean.inputText2.length()); } } }