Example usage for android.text.method HideReturnsTransformationMethod getInstance

List of usage examples for android.text.method HideReturnsTransformationMethod getInstance

Introduction

In this page you can find the example usage for android.text.method HideReturnsTransformationMethod getInstance.

Prototype

public static HideReturnsTransformationMethod getInstance() 

Source Link

Usage

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  ww. j  av a 2  s. c om
 */
public static void visible(TextView textView, boolean show) {

    textView.setTransformationMethod(
            show ? HideReturnsTransformationMethod.getInstance() : PasswordTransformationMethod.getInstance());

}

From source file:com.mobshep.mobileshepherd.UDataLeakage1.java

public void onCheckboxClicked(View view) {
    // Is the view now checked?
    boolean checked = ((CheckBox) view).isChecked();

    // Check which checkbox was clicked
    if (((CheckBox) view).isChecked()) {
        secret.setInputType(InputType.TYPE_CLASS_TEXT);
        // secret.setTransformationMethod(PasswordTransformationMethod.getInstance());
    } else {/*w  w w  .  j  a  va  2s  .  co m*/
        secret.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
        secret.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
    }
}

From source file:com.hellofyc.base.util.ViewUtils.java

/**
 * ???/*from   w ww  . j  a v a 2s.  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:org.sufficientlysecure.keychain.ui.CreateKeyPassphraseFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.create_key_passphrase_fragment, container, false);

    mPassphraseEdit = (PassphraseEditText) view.findViewById(R.id.create_key_passphrase);
    mPassphraseEditAgain = (EditText) view.findViewById(R.id.create_key_passphrase_again);
    mShowPassphrase = (CheckBox) view.findViewById(R.id.create_key_show_passphrase);
    mBackButton = view.findViewById(R.id.create_key_back_button);
    mNextButton = view.findViewById(R.id.create_key_next_button);

    // initial values
    // TODO: using String here is unsafe...
    if (mCreateKeyActivity.mPassphrase != null) {
        mPassphraseEdit.setText(mCreateKeyActivity.mPassphrase.toStringUnsafe());
        mPassphraseEditAgain.setText(mCreateKeyActivity.mPassphrase.toStringUnsafe());
    }/*from   ww  w.  j  a  v a  2  s  .  co  m*/

    mPassphraseEdit.requestFocus();
    mBackButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            back();
        }
    });
    mNextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            nextClicked();
        }
    });
    mShowPassphrase.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                mPassphraseEdit.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                mPassphraseEditAgain.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            } else {
                mPassphraseEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
                mPassphraseEditAgain.setTransformationMethod(PasswordTransformationMethod.getInstance());
            }
        }
    });

    TextWatcher textWatcher = new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (!isEditTextNotEmpty(getActivity(), mPassphraseEdit)) {
                mPassphraseEditAgain.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
                return;
            }

            if (areEditTextsEqual(mPassphraseEdit, mPassphraseEditAgain)) {
                mPassphraseEditAgain.setCompoundDrawablesWithIntrinsicBounds(0, 0,
                        R.drawable.ic_stat_retyped_ok, 0);
            } else {
                mPassphraseEditAgain.setCompoundDrawablesWithIntrinsicBounds(0, 0,
                        R.drawable.ic_stat_retyped_bad, 0);
            }

        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    };

    mPassphraseEdit.addTextChangedListener(textWatcher);
    mPassphraseEditAgain.addTextChangedListener(textWatcher);

    return view;
}

From source file:com.txusballesteros.PasswordEditText.java

private void changeVisibilityMode() {
    requestFocus();/*w ww  . j a  v  a 2 s.  co m*/
    if (!passwordIsVisible) {
        setCompoundDrawablesWithIntrinsicBounds(null, null, hidePasswordDrawable, null);
        setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        passwordIsVisible = true;
    } else {
        setCompoundDrawablesWithIntrinsicBounds(null, null, showPasswordDrawable, null);
        setTransformationMethod(PasswordTransformationMethod.getInstance());
        passwordIsVisible = false;
    }
}

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;//  w  w  w .  ja  v a 2  s.  co  m
    }
    pwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
}

From source file:nl.hnogames.domoticz.UI.FingerprintPasswordDialog.java

public void show() {
    mdb.title(mContext.getString(R.string.welcome_remote_server_password));
    md = mdb.build();//from w w  w .j  a  va 2 s.co m
    View view = md.getCustomView();

    editPassword = (FloatingLabelEditText) view.findViewById(R.id.password);
    showPassword = (CheckBox) view.findViewById(R.id.showpassword);

    if (mSharedPrefs.darkThemeEnabled()) {
        showPassword.setTextColor(ContextCompat.getColor(mContext, R.color.white));
        editPassword.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 };
        editPassword.setLabelTextColor(new ColorStateList(states, colors));
    }

    showPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // checkbox status is changed from uncheck to checked.
            if (!isChecked) {
                // show password
                editPassword.getInputWidget()
                        .setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                // hide password
                editPassword.getInputWidget()
                        .setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
        }
    });

    md.show();
}

From source file:org.developfreedom.logmein.ui.DialogAlert.java

public void show_password() {
    if (cb_show_pwd.isChecked()) {
        textbox_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        return;/*  w  w w .  j ava2 s. c  o  m*/
    }
    textbox_password.setTransformationMethod(PasswordTransformationMethod.getInstance());
}

From source file:de.gebatzens.sia.dialog.LoginDialog.java

@Override
public void onStart() {
    super.onStart();

    boolean hideSid = getArguments().getBoolean("hideSid");
    String sid = getArguments().getString("sid");
    boolean auth = getArguments().getBoolean("auth");
    String user = getArguments().getString("user");
    final AlertDialog dialog = (AlertDialog) getDialog();

    ((SetupActivity) getActivity()).currentLoginDialog = dialog;

    if (auth) {// w  w w .  j a va  2  s. c o  m
        final EditText passwordInput = (EditText) dialog.findViewById(R.id.passwordInput);
        final CheckBox passwordToggle = (CheckBox) dialog.findViewById(R.id.passwordToggle);
        passwordToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (!isChecked) {
                    passwordInput.setTransformationMethod(PasswordTransformationMethod.getInstance());
                    passwordInput.setSelection(passwordInput.getText().length());
                } else {
                    passwordInput.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                    passwordInput.setSelection(passwordInput.getText().length());
                }
            }
        });

        ((EditText) dialog.findViewById(R.id.usernameInput)).setText(user);
    } else {
        dialog.findViewById(R.id.passwordInput).setVisibility(View.GONE);
        dialog.findViewById(R.id.passwordToggle).setVisibility(View.GONE);
        dialog.findViewById(R.id.usernameInput).setVisibility(View.GONE);
    }

    if (hideSid) {
        dialog.findViewById(R.id.sidInput).setVisibility(View.GONE);
    } else {
        ((EditText) dialog.findViewById(R.id.sidInput)).setText(sid);
    }

    TextView acceptTermsLink = (TextView) dialog.findViewById(R.id.acceptTermsLink);
    acceptTermsLink.setPaintFlags(acceptTermsLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

    acceptTermsLink.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View widget) {
            Intent i = new Intent(activity, TextActivity.class);
            i.putExtra("title", R.string.terms_title);
            i.putExtra("text", R.array.terms);
            activity.startActivity(i);
        }
    });

    final CheckBox acceptTerms = (CheckBox) dialog.findViewById(R.id.acceptTerms);

    acceptTerms.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(isChecked);
        }
    });

    dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(acceptTerms.isChecked());

}