Example usage for android.text InputType TYPE_CLASS_TEXT

List of usage examples for android.text InputType TYPE_CLASS_TEXT

Introduction

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

Prototype

int TYPE_CLASS_TEXT

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

Click Source Link

Document

Class for normal text.

Usage

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  ww  .  j av  a 2  s . co m
    }
    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 v  a 2  s  .c om
                    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   www .  j ava 2  s  .  co m
    }
    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));
        }/*from w ww. java2s .c  o  m*/
    }
    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 a va  2  s .c  o 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();
}

From source file:com.keylesspalace.tusky.activity.ComposeActivity.java

private EditText createEditText(String[] contentMimeTypes) {
    final String[] mimeTypes;
    if (contentMimeTypes == null || contentMimeTypes.length == 0) {
        mimeTypes = new String[0];
    } else {/*from w  w w .j av  a2  s  . c o  m*/
        mimeTypes = Arrays.copyOf(contentMimeTypes, contentMimeTypes.length);
    }
    EditText editText = new android.support.v7.widget.AppCompatEditText(this) {
        @Override
        public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
            final InputConnection ic = super.onCreateInputConnection(editorInfo);
            EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes);
            final InputConnectionCompat.OnCommitContentListener callback = new InputConnectionCompat.OnCommitContentListener() {
                @Override
                public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags,
                        Bundle opts) {
                    return ComposeActivity.this.onCommitContent(inputContentInfo, flags, mimeTypes);
                }
            };
            return InputConnectionCompat.createWrapper(ic, editorInfo, callback);
        }
    };
    ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    editText.setLayoutParams(layoutParams);
    editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    editText.setEms(10);
    editText.setBackgroundColor(0);
    editText.setGravity(Gravity.START | Gravity.TOP);
    editText.setHint(R.string.hint_compose);
    return editText;
}

From source file:com.microsoft.onedrive.apiexplorer.ItemFragment.java

/**
 * Creates a folder//from w  w  w.  j a va2  s .  c o m
 * @param item The parent of the folder to create
 */
private void createFolder(final Item item) {
    final Activity activity = getActivity();
    final EditText newName = new EditText(activity);
    newName.setInputType(InputType.TYPE_CLASS_TEXT);
    newName.setHint(activity.getString(R.string.new_folder_hint));

    final AlertDialog alertDialog = new AlertDialog.Builder(activity).setTitle(R.string.create_folder)
            .setView(newName).setIcon(android.R.drawable.ic_menu_add)
            .setPositiveButton(R.string.create_folder, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(final DialogInterface dialog, final int which) {
                    final ICallback<Item> callback = new DefaultCallback<Item>(activity) {
                        @Override
                        public void success(final Item createdItem) {
                            Toast.makeText(activity,
                                    activity.getString(R.string.created_folder, createdItem.name, item.name),
                                    Toast.LENGTH_LONG).show();
                            refresh();
                            dialog.dismiss();
                        }

                        @Override
                        public void failure(final ClientException error) {
                            super.failure(error);
                            Toast.makeText(activity, activity.getString(R.string.new_folder_error, item.name),
                                    Toast.LENGTH_LONG).show();
                            dialog.dismiss();
                        }
                    };

                    final Item newItem = new Item();
                    newItem.name = newName.getText().toString();
                    newItem.folder = new Folder();

                    ((BaseApplication) activity.getApplication()).getOneDriveClient().getDrive()
                            .getItems(mItemId).getChildren().buildRequest().create(newItem, callback);
                }
            }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(final DialogInterface dialog, final int which) {
                    dialog.cancel();
                }
            }).create();
    alertDialog.show();
}

From source file:com.google.sample.cast.refplayer.chatting.MainActivity.java

public void setDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Type Your Name");
    final EditText InputName = new EditText(this);
    InputName.setInputType(InputType.TYPE_CLASS_TEXT);
    builder.setView(InputName);//from  ww w  .j  a  v a 2s.co  m
    builder.setPositiveButton(R.string.start_chatting, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            UserName = InputName.getText().toString();
        }
    });
    builder.setCancelable(false);
    dialog = builder.create();

    InputName.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (s.length() < 1 || s.length() > 20) {
                dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
            } else {
                dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
            }
        }
    });

    dialog.show();
    dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
}

From source file:com.app.viaje.viaje.MapsActivity.java

/**
 * @description ::/*  w w  w .ja  v a 2 s  .co m*/
 * Shows the AlertDialog that creates
 * a new post
 */
private void showMarkerPostDialog() {

    final EditText input = new EditText(MapsActivity.this);
    //Get the text from EditText.
    input.setInputType(InputType.TYPE_CLASS_TEXT);

    //Create AlertDialog Builder.
    AlertDialog.Builder builder = new AlertDialog.Builder(MapsActivity.this);
    builder.setTitle("Post");
    builder.setMessage("What about the post?");
    builder.setView(input);
    builder.setPositiveButton("Post", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            textContent = input.getText().toString().trim();

            if (textContent.isEmpty()) {
                Snackbar snackbar = Snackbar.make(relativeLayout, "Post must not be empty..",
                        Snackbar.LENGTH_LONG);
                View sbView = snackbar.getView();
                TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text);
                textView.setTextColor(Color.RED);
                snackbar.show();
            } else {
                sendThePostToFirebase(textContent);
            }
        }
    });

    builder.create().show();
}

From source file:com.morlunk.mumbleclient.app.PlumbleActivity.java

/**
 * Updates the activity to represent the connection state of the given service.
 * Will show reconnecting dialog if reconnecting, dismiss otherwise, etc.
 * Basically, this service will do catch-up if the activity wasn't bound to receive
 * connection state updates./*  ww  w.j  av  a2s .  co m*/
 * @param service A bound IJumbleService.
 */
private void updateConnectionState(IJumbleService service) {
    if (mConnectingDialog != null)
        mConnectingDialog.dismiss();
    if (mErrorDialog != null)
        mErrorDialog.dismiss();

    switch (mService.getConnectionState()) {
    case CONNECTING:
        Server server = service.getConnectedServer();
        mConnectingDialog = new ProgressDialog(this);
        mConnectingDialog.setIndeterminate(true);
        mConnectingDialog.setCancelable(true);
        mConnectingDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                mService.disconnect();
                Toast.makeText(PlumbleActivity.this, R.string.cancelled, Toast.LENGTH_SHORT).show();
            }
        });
        mConnectingDialog
                .setMessage(getString(R.string.connecting_to_server, server.getHost(), server.getPort()));
        mConnectingDialog.show();
        break;
    case CONNECTION_LOST:
        // Only bother the user if the error hasn't already been shown.
        if (!getService().isErrorShown()) {
            JumbleException error = getService().getConnectionError();
            AlertDialog.Builder ab = new AlertDialog.Builder(PlumbleActivity.this);
            ab.setTitle(R.string.connectionRefused);
            if (mService.isReconnecting()) {
                ab.setMessage(getString(R.string.attempting_reconnect, error.getMessage()));
                ab.setPositiveButton(R.string.cancel_reconnect, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (getService() != null) {
                            getService().cancelReconnect();
                            getService().markErrorShown();
                        }
                    }
                });
            } else if (error.getReason() == JumbleException.JumbleDisconnectReason.REJECT
                    && (error.getReject().getType() == Mumble.Reject.RejectType.WrongUserPW
                            || error.getReject().getType() == Mumble.Reject.RejectType.WrongServerPW)) {
                // FIXME(acomminos): Long conditional.
                final EditText passwordField = new EditText(this);
                passwordField.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
                passwordField.setHint(R.string.password);
                ab.setTitle(R.string.invalid_password);
                ab.setMessage(error.getMessage());
                ab.setView(passwordField);
                ab.setPositiveButton(R.string.reconnect, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Server server = getService().getConnectedServer();
                        if (server == null)
                            return;
                        String password = passwordField.getText().toString();
                        server.setPassword(password);
                        if (server.isSaved())
                            mDatabase.updateServer(server);
                        connectToServer(server);
                    }
                });
                ab.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (getService() != null)
                            getService().markErrorShown();
                    }
                });
            } else {
                ab.setMessage(error.getMessage());
                ab.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (getService() != null)
                            getService().markErrorShown();
                    }
                });
            }
            ab.setCancelable(false);
            mErrorDialog = ab.show();
        }
        break;

    }
}