Example usage for android.text InputType TYPE_TEXT_VARIATION_PASSWORD

List of usage examples for android.text InputType TYPE_TEXT_VARIATION_PASSWORD

Introduction

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

Prototype

int TYPE_TEXT_VARIATION_PASSWORD

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

Click Source Link

Document

Variation of #TYPE_CLASS_TEXT : entering a password.

Usage

From source file:com.velli.passwordmanager.FragmentPasswordDetails.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

    case R.id.menu_starred:
        mEntry.setStarred(!mEntry.isStarred());
        PasswordDatabaseHandler.getInstance().updatePassword(mEntry);
        getActivity().invalidateOptionsMenu();
        return true;
    case R.id.menu_edit:
        edit();/*  w w  w .  j  a va 2 s  .c  o m*/
        return true;
    case android.R.id.home:
        getActivity().getSupportFragmentManager().popBackStack();
        return true;
    case R.id.menu_delete:
        new MaterialDialog.Builder(getActivity()).title(R.string.title_delete_password)
                .content(R.string.dialog_message_delete_password).positiveText(R.string.action_ok)
                .negativeText(R.string.action_cancel).onPositive(new MaterialDialog.SingleButtonCallback() {
                    @Override
                    public void onClick(@NonNull MaterialDialog materialDialog,
                            @NonNull DialogAction dialogAction) {
                        PasswordDatabaseHandler.getInstance().deletePassword(mEntryId);
                        getActivity().getSupportFragmentManager().popBackStack();
                    }
                }).show();
        return true;
    case R.id.menu_show_as_toolbar:
        showFloatingCard();
        return true;
    case R.id.menu_open_web_page:
        showFloatingCard();
        if (mEntry.getLoginIcon() == NavigationDrawerConstants.LABEL_APP) {
            openApp(getActivity(), mEntry.getAppPackageName());
        } else {
            openWebPage(getActivity(), mEntry.getUrl());
        }
        return true;
    case R.id.menu_share_email:
        sharePasswordEmail();
        return true;
    case R.id.menu_view_hide_password:
        if (mPassword != null) {
            mPassword.setInputType(mShowingPassword ? InputType.TYPE_TEXT_VARIATION_PASSWORD
                    : InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
        } else if (mCardCSV != null) {
            mCardCSV.setInputType(mShowingPassword ? InputType.TYPE_TEXT_VARIATION_PASSWORD
                    : InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
        }
        mShowingPassword = !mShowingPassword;

        updateToolbarItems();
        return true;
    case R.id.menu_share_screenshot:
        createScreenshot();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.doplgangr.secrecy.views.FilesListFragment.java

void deleteVault() {
    final EditText passwordView = new EditText(context);
    passwordView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    passwordView.setHint(R.string.Vault__confirm_password_hint);
    new AlertDialog.Builder(context).setTitle(getString(R.string.Vault__confirm_delete)).setView(passwordView)
            .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    String input = passwordView.getText().toString();
                    if (password.equals(input)) {
                        secret.delete();
                        context.finish();
                    } else {
                        Util.alert(context,
                                CustomApp.context.getString(R.string.Error__delete_password_incorrect),
                                CustomApp.context.getString(R.string.Error__delete_password_incorrect_message),
                                Util.emptyClickListener, null);
                    }//from ww w . j  a  v  a 2 s  .c  om
                }
            }).setNegativeButton(R.string.CANCEL, Util.emptyClickListener).show();
}

From source file:com.citrus.sdk.CitrusActivity.java

private void showPrompt() {
    final AlertDialog.Builder alert = new AlertDialog.Builder(mContext);
    String message = null;/*www. j a v  a2 s .co  m*/
    String title = null;

    if (passwordPromptShown) {
        message = "Incorrect Password.";
        title = "Please Enter Password Again.";
    } else {
        message = "Please Enter Your Password For Citrus Account.";
        title = "Enter Password";
    }

    String positiveButtonText = "Pay";

    alert.setTitle(title);
    alert.setMessage(message);
    // Set an EditText view to get user input
    final EditText input = new EditText(mContext);
    alert.setView(input);
    alert.setPositiveButton(positiveButtonText, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton) {
            String password = input.getText().toString();
            input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);

            if (!TextUtils.isEmpty(password)) {
                mPaymentWebview
                        .loadUrl("javascript:(function() { " + "document.getElementById('password').value='"
                                + password + "';" + "document.getElementById(\"verify\").submit();" + "}) ()");
                input.clearFocus();
                // Hide the keyboard.
                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(input.getWindowToken(), 0);

                String emailId = mCitrusClient.getUserEmailId();

                getCookie(emailId, password);

                dialog.dismiss();
            }
        }
    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            onBackPressed();
        }
    });

    input.requestFocus();
    alert.show();
}

From source file:com.facebook.react.views.textinput.ReactTextInputManager.java

private static void checkPasswordType(ReactEditText view) {
    if ((view.getStagedInputType() & INPUT_TYPE_KEYBOARD_NUMBERED) != 0
            && (view.getStagedInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD) != 0) {
        // Text input type is numbered password, remove text password variation, add numeric one
        updateStagedInputTypeFlag(view, InputType.TYPE_TEXT_VARIATION_PASSWORD,
                InputType.TYPE_NUMBER_VARIATION_PASSWORD);
    }//www .  j a v a2 s .  c o  m
}

From source file:com.googlecode.android_scripting.facade.AndroidFacade.java

private String getInputFromAlertDialog(final String title, final String message, final boolean password) {
    final FutureActivityTask<String> task = new FutureActivityTask<String>() {
        @Override/* w  w  w.  j a  v a2s  .  c  o m*/
        public void onCreate() {
            super.onCreate();
            final EditText input = new EditText(getActivity());
            if (password) {
                input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
                input.setTransformationMethod(new PasswordTransformationMethod());
            }
            AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
            alert.setTitle(title);
            alert.setMessage(message);
            alert.setView(input);
            alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.dismiss();
                    setResult(input.getText().toString());
                    finish();
                }
            });
            alert.setOnCancelListener(new DialogInterface.OnCancelListener() {
                public void onCancel(DialogInterface dialog) {
                    dialog.dismiss();
                    setResult(null);
                    finish();
                }
            });
            alert.show();
        }
    };
    mTaskQueue.execute(task);

    try {
        return task.getResult();
    } catch (Exception e) {
        Log.e("Failed to display dialog.", e);
        throw new RuntimeException(e);
    }
}

From source file:com.goftagram.telegram.ui.PasscodeActivity.java

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));
        }/*from w  w w. j  a v a  2s . c om*/
    }
    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());
}

From source file:kr.wdream.ui.PasscodeActivity.java

private void updateDropDownTextView() {
    if (dropDown != null) {
        if (currentPasswordType == 0) {
            dropDown.setText(//  www . ja va  2 s.c o  m
                    LocaleController.getString("PasscodePIN", kr.wdream.storyshop.R.string.PasscodePIN));
        } else if (currentPasswordType == 1) {
            dropDown.setText(LocaleController.getString("PasscodePassword",
                    kr.wdream.storyshop.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());
}

From source file:com.b44t.ui.PasscodeActivity.java

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));
        }/*from  ww w.ja v  a 2 s .c om*/
    }
    if (screen == SCREEN1_ENTER_CODE1 && currentPasswordType == 0
            || screen == SCREEN2_ENTER_CODE2 && 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 (screen == SCREEN1_ENTER_CODE1 && currentPasswordType == 1
            || screen == SCREEN2_ENTER_CODE2 && 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());
}

From source file:ir.besteveryeverapp.ui.PasscodeActivity.java

private void updateDropDownTextView() {
    if (dropDown != null) {
        if (currentPasswordType == 0) {
            dropDown.setText(LocaleController.getString("PasscodePIN",
                    ir.besteveryeverapp.telegram.R.string.PasscodePIN));
        } else if (currentPasswordType == 1) {
            dropDown.setText(LocaleController.getString("PasscodePassword",
                    ir.besteveryeverapp.telegram.R.string.PasscodePassword));
        }// w  ww  .  j a  v a  2s  . com
    }
    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());
}

From source file:org.kontalk.ui.NumberValidation.java

private void importAskPassphrase(final ZipInputStream zip) {
    new MaterialDialog.Builder(this).title(R.string.title_passphrase)
            .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)
            .input(null, null, new MaterialDialog.InputCallback() {
                @Override/*  w w  w.  j  av a2 s  .co m*/
                public void onInput(MaterialDialog dialog, CharSequence input) {
                    startImport(zip, dialog.getInputEditText().getText().toString());
                }
            }).onNegative(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog materialDialog,
                        @NonNull DialogAction dialogAction) {
                    try {
                        zip.close();
                    } catch (IOException e) {
                        // ignored
                    }
                }
            }).negativeText(android.R.string.cancel).positiveText(android.R.string.ok).show();
}