List of usage examples for android.text.method PasswordTransformationMethod getInstance
public static PasswordTransformationMethod getInstance()
From source file:Main.java
public static void showPswd(TextView tv, boolean showOrNot) { tv.setTransformationMethod(!showOrNot ? PasswordTransformationMethod.getInstance() : HideReturnsTransformationMethod.getInstance()); }
From source file:com.bobomee.android.common.util.EditUtil.java
/** * ???/*from w w w . ja v a 2 s . c o m*/ */ public static void visible(TextView textView, boolean show) { textView.setTransformationMethod( show ? HideReturnsTransformationMethod.getInstance() : PasswordTransformationMethod.getInstance()); }
From source file:com.commonsware.android.assist.no.EditorFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { int position = getArguments().getInt(KEY_POSITION, -1); View result;/*from w w w . ja va2s. c om*/ if (position == 2) { ViewGroup doctorNo = new NoAssistFrameLayout(getActivity()); inflater.inflate(R.layout.editor, doctorNo); result = doctorNo; } else { result = inflater.inflate(R.layout.editor, container, false); } EditText editor = result.findViewById(R.id.editor); editor.setHint(getTitle(getActivity(), position)); if (position == 1) { editor.setTransformationMethod(PasswordTransformationMethod.getInstance()); } return (result); }
From source file:com.txusballesteros.PasswordEditText.java
private void initializeView(AttributeSet attrs) { setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); setTransformationMethod(PasswordTransformationMethod.getInstance()); if (attrs != null) { TypedArray attributes = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.PasswordEditText, 0, 0); int drawableTint = attributes.getColor(R.styleable.PasswordEditText_drawableTintCompat, WITHOUT_TINT); showPasswordDrawable = getDrawable(attributes, R.styleable.PasswordEditText_showDrawable, drawableTint); hidePasswordDrawable = getDrawable(attributes, R.styleable.PasswordEditText_hideDrawable, drawableTint); if (showPasswordDrawable == null) { showPasswordDrawable = getDrawable(getResources().getDrawable(R.drawable.ic_password_visible_24dp), drawableTint);//from w w w .ja v a 2 s . c om } if (hidePasswordDrawable == null) { hidePasswordDrawable = getDrawable(getResources().getDrawable(R.drawable.ic_password_hidden_24dp), drawableTint); } if (showPasswordDrawable != null && hidePasswordDrawable != null) { setCompoundDrawablesWithIntrinsicBounds(null, null, showPasswordDrawable, null); setCompoundDrawablePadding(dp2px(DRAWABLE_PADDING_IN_DP)); } attributes.recycle(); } }
From source file:com.wolkabout.hexiwear.view.Input.java
@AfterViews void init() {//from ww w. ja va 2 s . co m setHint(hint); text.setCompoundDrawablesWithIntrinsicBounds(drawable, 0, 0, 0); text.setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxLength) }); text.setInputType(type.flag); text.setTextColor(textColor); if (!TextUtils.isEmpty(defaultText)) { text.setText(defaultText); } if (type == Type.PASSWORD) { text.setTransformationMethod(PasswordTransformationMethod.getInstance()); } if (!TextUtils.isEmpty(actionLabel)) { text.setImeActionLabel(actionLabel, EditorInfo.IME_ACTION_UNSPECIFIED); } }
From source file:nl.hnogames.domoticz.Widgets.SecurityWidgetConfigurationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mSharedPrefs = new SharedPrefUtil(this); if (mSharedPrefs.darkThemeEnabled()) setTheme(R.style.AppThemeDark);/* ww w .j a v a 2 s . c om*/ else setTheme(R.style.AppTheme); super.onCreate(savedInstanceState); setContentView(R.layout.widget_security_configuration); setResult(RESULT_CANCELED); if (domoticz == null) domoticz = new Domoticz(this, AppController.getInstance().getRequestQueue()); txtStatus = (TextView) this.findViewById(R.id.status); txtTitle = (TextView) this.findViewById(R.id.title); btnConfig = (Button) this.findViewById(R.id.checkpin); editPin = (FloatingLabelEditText) this.findViewById(R.id.securitypin); editPin.getInputWidget().setTransformationMethod(PasswordTransformationMethod.getInstance()); if (mSharedPrefs.darkThemeEnabled()) { btnConfig.setBackground(ContextCompat.getDrawable(this, R.drawable.button_status_dark)); editPin.setInputWidgetTextColor(ContextCompat.getColor(this, R.color.white)); txtStatus.setTextColor(ContextCompat.getColor(this, R.color.white)); txtTitle.setTextColor(ContextCompat.getColor(this, R.color.white)); } btnConfig.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { InputMethodManager imm = (InputMethodManager) getApplicationContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editPin.getWindowToken(), 0); final String password = UsefulBits.getMd5String(editPin.getInputWidgetText().toString()); if (UsefulBits.isEmpty(password)) { Toast.makeText(getApplicationContext(), getString(R.string.security_wrong_code), Toast.LENGTH_LONG).show(); return; } if (mSettings == null) { domoticz.getSettings(new SettingsReceiver() { @Override public void onReceiveSettings(SettingsInfo settings) { mSettings = settings; if (validatePassword(password)) { if (sSecurityPanel != null) { getBackground(sSecurityPanel, password, getApplicationContext().getString(R.string.status) + ": " + String.valueOf(sSecurityPanel.getData())); } } else Toast.makeText(getApplicationContext(), getString(R.string.security_wrong_code), Toast.LENGTH_LONG).show(); } @Override public void onError(Exception error) { Log.e(TAG, domoticz.getErrorMessage(error)); } }); } else { if (validatePassword(password)) { if (sSecurityPanel != null) { getBackground(sSecurityPanel, password, getApplicationContext().getString(R.string.status) + ": " + String.valueOf(sSecurityPanel.getData())); } } else Toast.makeText(getApplicationContext(), getString(R.string.security_wrong_code), Toast.LENGTH_LONG).show(); } } }); if (BuildConfig.LITE_VERSION || !mSharedPrefs.isAPKValidated()) { Toast.makeText(this, getString(R.string.wizard_widgets) + " " + getString(R.string.premium_feature), Toast.LENGTH_LONG).show(); this.finish(); } if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setHomeButtonEnabled(false); } //1) Is domoticz connected? if (mSharedPrefs.isFirstStart()) { mSharedPrefs.setNavigationDefaults(); Intent welcomeWizard = new Intent(this, WelcomeViewActivity.class); startActivityForResult(welcomeWizard, iWelcomeResultCode); mSharedPrefs.setFirstStart(false); } else { initListViews(); } }
From source file:com.hellofyc.base.util.ViewUtils.java
/** * ???// w w w.j a v a2s. c o m */ public static void setPasswordVisibility(@NonNull EditText input, boolean visibility) { if (visibility) { input.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); input.setSelection(input.length()); } else { input.setTransformationMethod(PasswordTransformationMethod.getInstance()); input.setSelection(input.length()); } }
From source file:com.wolkabout.hexiwear.view.Input.java
public void setPasswordVisibility(boolean visible) { text.setTransformationMethod(visible ? null : PasswordTransformationMethod.getInstance()); }
From source file:nl.hnogames.domoticz.UI.SecurityPanelDialog.java
public void show() { mdb.title(panelInfo.getName());/*from w ww.j a va 2 s .com*/ md = mdb.build(); View view = md.getCustomView(); if (view != null) { editPinCode = (FloatingLabelEditText) view.findViewById(R.id.securitypin); editPinCode.getInputWidget().setTransformationMethod(PasswordTransformationMethod.getInstance()); btnDisarm = (Button) view.findViewById(R.id.disarm); btnArmHome = (Button) view.findViewById(R.id.armhome); btnArmAway = (Button) view.findViewById(R.id.armaway); txtCountDown = (TextView) view.findViewById(R.id.countdown); if (mSharedPrefs.darkThemeEnabled()) { btnDisarm.setBackground(ContextCompat.getDrawable(mContext, R.drawable.button_status_dark)); btnArmHome.setBackground(ContextCompat.getDrawable(mContext, R.drawable.button_status_dark)); btnArmAway.setBackground(ContextCompat.getDrawable(mContext, R.drawable.button_status_dark)); editPinCode.setInputWidgetTextColor(ContextCompat.getColor(mContext, R.color.white)); int[][] states = new int[][] { new int[] { android.R.attr.state_activated }, new int[] { -android.R.attr.state_activated } }; int[] colors = new int[] { Color.WHITE, Color.WHITE }; editPinCode.setLabelTextColor(new ColorStateList(states, colors)); } } domoticz.getSettings(new SettingsReceiver() { @Override public void onReceiveSettings(SettingsInfo settings) { mSettings = settings; md.show(); } @Override public void onError(Exception error) { Log.e(TAG, domoticz.getErrorMessage(error)); md.dismiss(); } }); btnDisarm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { processRequest(DomoticzValues.Security.Status.DISARM); } }); btnArmAway.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { processRequest(DomoticzValues.Security.Status.ARMAWAY); } }); btnArmHome.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { processRequest(DomoticzValues.Security.Status.ARMHOME); } }); }
From source file:in.shubhamchaudhary.logmein.ui.UserDatabase.java
public void show_password(View v) { // FragmentEdit fe = new FragmentEdit(); // fe.show_password_edit_fragment(); CheckBox cb_show_pwd = (CheckBox) FragmentEdit.v.findViewById(R.id.cb_show_password); EditText pwd = (EditText) FragmentEdit.v.findViewById(R.id.edit_password); if (cb_show_pwd.isChecked()) { pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); return;// ww w . j a v a2 s . c o m } pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); }