Example usage for android.text InputType TYPE_TEXT_VARIATION_VISIBLE_PASSWORD

List of usage examples for android.text InputType TYPE_TEXT_VARIATION_VISIBLE_PASSWORD

Introduction

In this page you can find the example usage for android.text InputType TYPE_TEXT_VARIATION_VISIBLE_PASSWORD.

Prototype

int TYPE_TEXT_VARIATION_VISIBLE_PASSWORD

To view the source code for android.text InputType TYPE_TEXT_VARIATION_VISIBLE_PASSWORD.

Click Source Link

Document

Variation of #TYPE_CLASS_TEXT : entering a password, which should be visible to the user.

Usage

From source file:Main.java

public static void showPassword(EditText editText) {
    editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    setSeletionEnd(editText);
}

From source file:Main.java

@SuppressLint("InlinedApi")
public static boolean isPasswordField(int inputType) {
    int inputClass = inputType & InputType.TYPE_MASK_CLASS;
    int inputVariation = inputType & InputType.TYPE_MASK_VARIATION;
    return inputClass == InputType.TYPE_CLASS_TEXT
            && (inputVariation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
                    || inputVariation == InputType.TYPE_TEXT_VARIATION_PASSWORD
                    || inputVariation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD);
}

From source file:Main.java

/**
 * Configures an EditText that will be used to let the user enter a key alias.
 *
 * @param editText  The EditText to configure.
 * @param maxLength The maximum number of characters the user can write in the EditText.
 *///from   w  w  w  .ja va2  s. com
public static void setUpAliasEditText(EditText editText, int maxLength) {
    editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxLength) });
    editText.setSingleLine();
    editText.setInputType(
            InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
}

From source file:Main.java

public static List<String> mapTextViewInputTypes(int inputType) {
    List<String> inputTypes = new ArrayList<String>();
    if (inputTypeHasTrait(inputType, InputType.TYPE_TEXT_VARIATION_PASSWORD)
            || inputTypeHasTrait(inputType, InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD)) {
        inputTypes.add("password");
    }//from  w  w  w .j  a  va  2s .  c  o m
    if (inputTypeHasTrait(inputType, InputType.TYPE_CLASS_NUMBER)) {
        inputTypes.add("numeric");
    }
    inputTypes.add(String.valueOf(inputType));

    return inputTypes;
}

From source file:Main.java

public static NumberKeyListener getCurrencyNumberKeyListener() {
    if (_currencyNumberKeyListener == null) {
        _currencyNumberKeyListener = new NumberKeyListener() {

            @Override/*w w w  .  j ava  2s .c  o m*/
            public int getInputType() {
                return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
            }

            @Override
            protected char[] getAcceptedChars() {
                return new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',' };
            }
        };
    }

    return _currencyNumberKeyListener;
}

From source file:com.github.andrewlord1990.materialandroid.component.textfield.AbstractPasswordEditTextAssert.java

public AbstractPasswordEditTextAssert hasVisiblePassword() {
    isNotNull();//from  www . jav  a 2  s .c  o  m
    assertThat(actual).overridingErrorMessage("Expected password visible but was hidden.")
            .hasInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    Assertions.assertThat(actual.isPasswordVisible()).isTrue();
    return myself;
}

From source file:ca.uqac.florentinth.speakerauthentication.CreateActivity.java

private void initGUI() {
    view = findViewById(R.id.create_layout);
    usernameInput = (EditText) findViewById(R.id.username_input);
    passwordInput = (EditText) findViewById(R.id.password_input);
    visibilityImage = (ImageView) findViewById(R.id.visibility);
    femaleRadio = (RadioButton) findViewById(R.id.radio_female);
    maleRadio = (RadioButton) findViewById(R.id.radio_male);
    createBtn = (Button) findViewById(R.id.btn_create);

    usernameInput.setText("user" + StringUtils.getCurrentDateTime());

    visibilityImage.setOnTouchListener(new View.OnTouchListener() {
        @Override/*from ww  w  .j av  a2s. c  o  m*/
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                passwordInput.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            } else {
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    passwordInput
                            .setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
                }
            }
            return true;
        }
    });

    createBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            submit();
        }
    });
}

From source file:ca.uqac.florentinth.speakerauthentication.MainActivity.java

private void initGUI() {
    view = findViewById(R.id.main_layout);
    usernameInput = (EditText) findViewById(R.id.username_input);
    passwordInput = (EditText) findViewById(R.id.password_input);
    visibiltyImage = (ImageView) findViewById(R.id.visibility);
    loginBtn = (Button) findViewById(R.id.btn_login);
    newAccountBtn = (Button) findViewById(R.id.btn_new_account);

    visibiltyImage.setOnTouchListener(new View.OnTouchListener() {
        @Override//  w  w w.  j  a va 2 s  . c  om
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                passwordInput.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            } else {
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    passwordInput
                            .setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
                }
            }
            return true;
        }
    });

    loginBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            checkExternalStoragePermissions();
        }
    });

    newAccountBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(getApplicationContext(), CreateActivity.class));
        }
    });
}

From source file:org.thoughtcrime.securesms.scribbles.widget.MotionView.java

private void init(@NonNull Context context, @Nullable AttributeSet attrs) {
    // I fucking love Android
    setWillNotDraw(false);/*from  w  ww  .jav a  2 s  . c  om*/

    selectedLayerPaint = new Paint();
    selectedLayerPaint.setAlpha((int) (255 * Constants.SELECTED_LAYER_ALPHA));
    selectedLayerPaint.setAntiAlias(true);

    this.editText = new EditText(context, attrs);
    ViewCompat.setAlpha(this.editText, 0);
    this.editText.setLayoutParams(new LayoutParams(1, 1, Gravity.TOP | Gravity.LEFT));
    this.editText.setClickable(false);
    this.editText.setBackgroundColor(Color.TRANSPARENT);
    this.editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 1);
    this.editText.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    this.addView(editText);
    this.editText.clearFocus();
    this.editText.addTextChangedListener(this);

    // init listeners
    this.scaleGestureDetector = new ScaleGestureDetector(context, new ScaleListener());
    this.rotateGestureDetector = new RotateGestureDetector(context, new RotateListener());
    this.moveGestureDetector = new MoveGestureDetector(context, new MoveListener());
    this.gestureDetectorCompat = new GestureDetectorCompat(context, new TapsListener());

    setOnTouchListener(onTouchListener);

    updateUI();
}

From source file:com.brq.wallet.activity.export.DecryptBip38PrivateKeyActivity.java

private void setPasswordHideShow(boolean show) {
    if (show) {/*from  w ww  . j av a  2 s  . c o m*/
        // Show password in plaintext
        passwordEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    } else {
        // Hide password
        passwordEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    }
    // Set cursor to last position
    passwordEdit.setSelection(passwordEdit.getText().length());
}