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:examples.baku.io.permissions.examples.ComposeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_compose);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Compose");
    setSupportActionBar(toolbar);//from www  . j  a v a  2 s  . c om
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    toolbar.setTitle("Compose");

    mFab = (FloatingActionButton) findViewById(R.id.fab);

    mTo = (PermissionedTextLayout) findViewById(R.id.composeTo);

    mFrom = (PermissionedTextLayout) findViewById(R.id.composeFrom);

    mSubject = (PermissionedTextLayout) findViewById(R.id.composeSubject);

    mMessage = (PermissionedTextLayout) findViewById(R.id.composeMessage);
    mMessage.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);

    mAttachmentView = (RelativeLayout) findViewById(R.id.composeAttachment);
    mAttachmentText = (TextView) findViewById(R.id.composeAttachmentText);
    mAttachmentIcon = (ImageView) findViewById(R.id.composeAttachmentIcon);
    mAttachmentIcon.setImageDrawable(new IconDrawable(this, MaterialIcons.md_attach_file).actionBarSize());
    mAttachmentCast = (ImageView) findViewById(R.id.composeAttachmentCast);
    mAttachmentCast.setImageDrawable(new IconDrawable(this, MaterialIcons.md_cast).actionBarSize());
    mAttachmentCast.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mPublicBlessing != null) {
                int current = mPublicBlessing.getPermissions(mPath + "/attachment");
                if ((current & PermissionManager.FLAG_READ) == PermissionManager.FLAG_READ) {
                    mPublicBlessing.setPermissions(mPath + "/attachment",
                            current & ~PermissionManager.FLAG_READ);
                    mAttachmentCast.setImageDrawable(
                            new IconDrawable(ComposeActivity.this, MaterialIcons.md_cast).actionBarSize());
                } else {
                    mPublicBlessing.setPermissions(mPath + "/attachment",
                            current | PermissionManager.FLAG_READ);
                    mAttachmentCast
                            .setImageDrawable(new IconDrawable(ComposeActivity.this, MaterialIcons.md_cancel)
                                    .color(Color.RED).actionBarSize());
                }
            }
        }
    });
    mAttachmentCast.setVisibility(View.GONE);

    setGroup("Inbox"); //default
    setAttachment(null, mAttachmentPermission);

    getContactsPermission();

    bindService(new Intent(this, PermissionService.class), this, Service.BIND_AUTO_CREATE);
}

From source file:com.amazonaws.mobile.auth.userpools.SignUpView.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    this.signUpForm = (FormView) findViewById(R.id.signup_form);
    userNameEditText = signUpForm.addFormField(getContext(),
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME,
            getContext().getString(R.string.username_text));

    passwordEditText = signUpForm.addFormField(getContext(),
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD,
            getContext().getString(R.string.sign_in_password));

    givenNameEditText = signUpForm.addFormField(getContext(),
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME,
            getContext().getString(R.string.given_name_text));

    emailEditText = signUpForm.addFormField(getContext(),
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS,
            getContext().getString(R.string.email_address_text));

    phoneEditText = signUpForm.addFormField(getContext(), InputType.TYPE_CLASS_PHONE,
            getContext().getString(R.string.phone_number_text));

    this.signUpMessage = (TextView) findViewById(R.id.signup_message);
    this.signUpButton = (Button) findViewById(R.id.signup_button);

    setupSignUpButtonBackground();/*w w w . ja  v  a2  s  .c o m*/
    setupFontFamily();
}

From source file:org.hawkular.client.android.fragment.ConfirmOperationFragment.java

private void createTable(OperationProperties operationProperties) {
    TableRow row = null;//from  w  ww  . j  a v  a2  s.  co  m
    Map<String, OperationParameter> operationParameters = operationProperties.getOperationParameters();

    if (operationParameters != null) {
        for (Map.Entry<String, OperationParameter> entry : operationParameters.entrySet()) {
            switch (entry.getValue().getType()) {
            case "string": {
                row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null);
                EditText data = (EditText) row.findViewById(R.id.data);
                data.setText(entry.getValue().getDefaultValue());
                data.setInputType(InputType.TYPE_CLASS_TEXT);
                break;
            }

            case "int": {
                row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null);
                EditText data = (EditText) row.findViewById(R.id.data);
                data.setText(entry.getValue().getDefaultValue());
                data.setInputType(InputType.TYPE_CLASS_NUMBER);
                break;
            }

            case "float": {
                row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null);
                EditText data = (EditText) row.findViewById(R.id.data);
                data.setText(entry.getValue().getDefaultValue());
                data.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
                break;
            }

            case "bool": {
                row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_toggle, null);
                SwitchCompat data = (SwitchCompat) row.findViewById(R.id.data);
                data.setChecked(entry.getValue().getDefaultValue().equals("true"));
                break;
            }
            }
            if (row != null) {
                TextView name = (TextView) row.findViewById(R.id.name);
                name.setText(entry.getKey());
                table.addView(row);
            }
        }
        table.requestLayout();
    }
}

From source file:support.plus.reportit.rv.AllReportsRV.java

public void add_items_setup() {
    com.github.clans.fab.FloatingActionButton fbAddReport = (com.github.clans.fab.FloatingActionButton) findViewById(
            R.id.fbAddReport);/*from  w w  w . j av  a 2 s.c o m*/

    fbAddReport.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new MaterialDialog.Builder(AllReportsRV.this).title(R.string.add_report)
                    .content(R.string.add_reportdesc)
                    .inputType(InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_CLASS_TEXT
                            | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)
                    .inputRange(1, 15).backgroundColor(getResources().getColor(R.color.cardColor))
                    .input(getString(R.string.example_work), "", new MaterialDialog.InputCallback() {
                        @Override
                        public void onInput(MaterialDialog dialog, CharSequence input) {
                            String name = String.valueOf(input);
                            File myFile2 = new File(Environment.getExternalStorageDirectory() + File.separator
                                    + "/ReportIt/Reports/" + name);
                            if (myFile2.exists()) {
                                Toast toast = Toast.makeText(AllReportsRV.this, R.string.error_file_exists,
                                        Toast.LENGTH_SHORT);
                                toast.show();
                                return;
                            } else {
                                Calendar c = Calendar.getInstance();
                                int weekNo = c.get(Calendar.WEEK_OF_YEAR);
                                itemTexte.add(name);
                                rvadapter1.notifyDataSetChanged();
                                recyclerView1.smoothScrollToPosition(itemTexte.size());
                                try {
                                    File mydirectory = new File(Environment.getExternalStorageDirectory()
                                            + File.separator + "ReportIt");
                                    boolean success = true;
                                    if (!mydirectory.exists()) {
                                        success = mydirectory.mkdir();
                                    }
                                    if (success) {
                                        File reportsdirectory = new File(
                                                Environment.getExternalStorageDirectory() + File.separator
                                                        + "/ReportIt/Reports");
                                        boolean success2 = true;
                                        if (!reportsdirectory.exists()) {
                                            success2 = reportsdirectory.mkdir();
                                        }
                                        if (success2) {
                                            File myFile = new File(Environment.getExternalStorageDirectory()
                                                    + File.separator + "/ReportIt/Reports/" + name);
                                            if (!myFile.exists()) {
                                                myFile.createNewFile();
                                            }

                                        }

                                    } else {

                                    }

                                } catch (Exception e) {
                                }
                            }
                            return;
                        }
                    }).cancelable(false).positiveText(R.string.add).negativeText(R.string.cancel).show();
        }
    });

}

From source file:id.satusatudua.sigap.ui.fragment.TrustedsFragment.java

@OnClick(R.id.fab)
public void addNewContact() {
    EditText editText = new EditText(getActivity());
    editText.setHint("Email");
    editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
    AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).setIcon(R.mipmap.ic_launcher)
            .setTitle("Masukan alamat email kontak").setView(editText)
            .setPositiveButton("Kirim", (dialog, which) -> {
                String email = editText.getText().toString();

                if (!Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
                    showError("Mohon masukan alamat email yang valid!");
                } else if (email.equalsIgnoreCase(CacheManager.pluck().getCurrentUser().getEmail())) {
                    showError("Mohon masukan alamat email selain email anda sendiri!");
                } else {
                    trustedUserPresenter.searchUser(email);
                    KeyboardUtil.hideKeyboard(getActivity(), editText);
                    dialog.dismiss();/*  w  ww  .ja  va  2  s.co m*/
                }
            }).setNegativeButton("Batal", (dialog, which1) -> {
                dialog.dismiss();
            }).show();

    alertDialog.getButton(DialogInterface.BUTTON_POSITIVE)
            .setTextColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary));
    alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE)
            .setTextColor(ContextCompat.getColor(getActivity(), R.color.primary_text));
    alertDialog.show();
}

From source file:com.velli.passwordmanager.filepicker.FragmentFileList.java

private void showCreateFolderDialog() {
    new MaterialDialog.Builder(getActivity()).title(R.string.file_picker_title_create_folder)
            .inputType(InputType.TYPE_CLASS_TEXT).negativeText(android.R.string.cancel).theme(mTheme)
            .input(null, null, new MaterialDialog.InputCallback() {

                @Override//from  ww  w .  j a v a  2  s . c o  m
                public void onInput(MaterialDialog dialog, CharSequence input) {
                    createDirctory(mPath + "/" + input);
                }
            }).show();
}

From source file:bander.notepad.NoteEditAppCompat.java

@Override
protected void onResume() {
    super.onResume();
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    // Font size/* w w  w.j a v a  2 s.c  o m*/
    float textSize = Float.valueOf(preferences.getString("textSize", "16"));
    mBodyText.setTextSize(textSize);
    // Monospace font
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    boolean typeface = settings.getBoolean("typeface", true);
    if (typeface) {
        Typeface font = Typeface.MONOSPACE;
        mBodyText.setTypeface(font);
    } else {
        mBodyText.setTypeface(Typeface.SANS_SERIF);
    }
    // Auto-correct
    boolean input = preferences.getBoolean("inputType", true);
    if (input) {
        // AutoCorrect on
        mBodyText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
                | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE);
    } else {
        // AutoCorrect off
        mBodyText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
                | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    }

    Cursor cursor = getContentResolver().query(mUri, PROJECTION, null, null, null);
    Note note = Note.fromCursor(cursor);
    cursor.close();

    if (note != null) {
        if (mOriginalNote == null)
            mOriginalNote = note;
        mBodyText.setTextKeepState(note.getBody());

        Boolean rememberPosition = preferences.getBoolean("rememberPosition", true);
        if (rememberPosition) {
            mBodyText.setSelection(note.getCursor());
            mBodyText.scrollTo(0, note.getScrollY());
        }
    }
}

From source file:com.tinfoil.sms.sms.KeyExchangeManager.java

/**
 * Set the shared secrets for the contacts.
 * @param context The context of the setting.
 * @param number The Number of the contact.
 * @param name The name of the contact/*from w  ww.  j  a v a 2  s  . c o m*/
 * @param entry The key exchange message.
 */
private static void setAndSend(final Context context, final Number number, String name, final Entry entry) {
    final DBAccessor dba = new DBAccessor(context);
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);

    final EditText sharedSecret1 = new EditText(context);
    sharedSecret1.setHint(context.getString(R.string.shared_secret_hint_1));
    sharedSecret1.setMaxLines(EditNumber.SHARED_INFO_MAX);
    sharedSecret1.setInputType(InputType.TYPE_CLASS_TEXT);
    linearLayout.addView(sharedSecret1);

    final EditText sharedSecret2 = new EditText(context);
    sharedSecret2.setHint(context.getString(R.string.shared_secret_hint_2));
    sharedSecret2.setMaxLines(EditNumber.SHARED_INFO_MAX);
    sharedSecret2.setInputType(InputType.TYPE_CLASS_TEXT);
    linearLayout.addView(sharedSecret2);

    builder.setMessage(context.getString(R.string.set_shared_secrets) + " " + name + ", " + number.getNumber())
            .setTitle(R.string.set_shared_secrets_title).setCancelable(true)
            .setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    //Save the shared secrets
                    String s1 = sharedSecret1.getText().toString();
                    String s2 = sharedSecret2.getText().toString();
                    if (SMSUtility.checksharedSecret(s1) && SMSUtility.checksharedSecret(s2)) {
                        number.setSharedInfo1(s1);
                        number.setSharedInfo2(s2);
                        dba.updateNumberRow(number, number.getNumber(), number.getId());

                        respondKeyExchangeMessage(context, number, entry);
                    } else {
                        Toast.makeText(context, R.string.invalid_secrets, Toast.LENGTH_LONG).show();
                    }
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                    //Cancel the key exchange
                    Toast.makeText(context, R.string.key_exchange_cancelled, Toast.LENGTH_LONG).show();
                }
            });
    AlertDialog alert = builder.create();

    alert.setView(linearLayout);
    alert.show();
}

From source file:edu.berkeley.boinc.attach.IndividualCredentialInputFragment.java

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

    TextView title = (TextView) v.findViewById(R.id.title);
    title.setText(projectName);//from w w w.  j  av  a  2  s  . co m
    TextView message = (TextView) v.findViewById(R.id.message);
    message.setText(errorMessage);

    ArrayList<String> defaultValues = mListener.getDefaultInput();
    emailET = (EditText) v.findViewById(R.id.email_input);
    emailET.setText(defaultValues.get(0));
    nameET = (EditText) v.findViewById(R.id.name_input);
    nameET.setText(defaultValues.get(1));
    pwdET = (EditText) v.findViewById(R.id.pwd_input);

    Button loginButton = (Button) v.findViewById(R.id.login_button);
    loginButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Logging.DEBUG)
                Log.d(Logging.TAG, "IndividualCredentialInputFragment: login clicked");
            mListener.onFinish(project, true, emailET.getText().toString(), nameET.getText().toString(),
                    pwdET.getText().toString());
            dismiss();
        }
    });

    Button registerButton = (Button) v.findViewById(R.id.register_button);
    registerButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Logging.DEBUG)
                Log.d(Logging.TAG,
                        "IndividualCredentialInputFragment: register clicked, client account creation disabled: "
                                + project.config.clientAccountCreationDisabled);
            if (project.config.clientAccountCreationDisabled) {
                // cannot register in client, open website
                Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(project.config.masterUrl));
                startActivity(i);
            } else {
                mListener.onFinish(project, false, emailET.getText().toString(), nameET.getText().toString(),
                        pwdET.getText().toString());
                dismiss();
            }
        }
    });

    TextView forgotPwdButton = (TextView) v.findViewById(R.id.forgotpwd_text);
    forgotPwdButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Logging.DEBUG)
                Log.d(Logging.TAG, "IndividualCredentialInputFragment: forgot pwd clicked");
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(forgotPwdLink));
            startActivity(i);
        }
    });

    CheckBox showPwdCb = (CheckBox) v.findViewById(R.id.show_pwd_cb);
    showPwdCb.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (((CheckBox) v).isChecked()) {
                pwdET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
            } else {
                pwdET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
                pwdET.setTransformationMethod(PasswordTransformationMethod.getInstance());
            }
        }
    });

    return v;
}

From source file:com.tinfoil.sms.settings.UserKeySettings.java

public void exportKey(View view) {
    if (SMSUtility.isMediaWritable()) {
        phoneBook = new AutoCompleteTextView(this);
        List<String> contact = null;
        if (tc == null) {
            //Do in thread.
            tc = dba.getAllRows(DBAccessor.ALL);
        }/*  w  w w  . j a va2s.c o m*/

        if (tc != null) {
            if (contact == null) {
                contact = SMSUtility.contactDisplayMaker(tc);
            }
        } else {
            contact = null;
        }
        final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this.getBaseContext(),
                R.layout.auto_complete_list_item, contact);

        phoneBook.setAdapter(adapter);

        final AlertDialog.Builder popup_builder = new AlertDialog.Builder(this);
        popup_builder.setTitle(R.string.import_contacts_title).setCancelable(true).setView(phoneBook)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

                    public void onClick(final DialogInterface dialog, final int which) {

                        String[] contactInfo = SMSUtility.parseAutoComplete(phoneBook.getText().toString());
                        //String number = null;

                        boolean invalid = false;
                        if (contactInfo != null) {
                            if (contactInfo[0] == null) {
                                contactInfo[0] = contactInfo[1];
                            }

                            final Number number = dba.getNumber(contactInfo[1]);

                            if (number != null) {
                                AlertDialog.Builder builder = new AlertDialog.Builder(UserKeySettings.this);
                                LinearLayout linearLayout = new LinearLayout(UserKeySettings.this);
                                linearLayout.setOrientation(LinearLayout.VERTICAL);

                                final EditText sharedSecret1 = new EditText(UserKeySettings.this);
                                sharedSecret1
                                        .setHint(UserKeySettings.this.getString(R.string.shared_secret_hint_1));
                                sharedSecret1.setMaxLines(EditNumber.SHARED_INFO_MAX);
                                sharedSecret1.setInputType(InputType.TYPE_CLASS_TEXT);
                                linearLayout.addView(sharedSecret1);

                                final EditText sharedSecret2 = new EditText(UserKeySettings.this);
                                sharedSecret2
                                        .setHint(UserKeySettings.this.getString(R.string.shared_secret_hint_2));
                                sharedSecret2.setMaxLines(EditNumber.SHARED_INFO_MAX);
                                sharedSecret2.setInputType(InputType.TYPE_CLASS_TEXT);
                                linearLayout.addView(sharedSecret2);

                                builder.setMessage(UserKeySettings.this.getString(R.string.set_shared_secrets)
                                        + " " + contactInfo[0] + ", " + number.getNumber())
                                        .setTitle(R.string.set_shared_secrets_title).setCancelable(true)
                                        .setPositiveButton(R.string.save,
                                                new DialogInterface.OnClickListener() {
                                                    @Override
                                                    public void onClick(DialogInterface dialog, int id) {
                                                        //Save the shared secrets

                                                        String s1 = sharedSecret1.getText().toString();
                                                        String s2 = sharedSecret2.getText().toString();
                                                        if (SMSUtility.checksharedSecret(s1)
                                                                && SMSUtility.checksharedSecret(s2)) {
                                                            number.setSharedInfo1(s1);
                                                            number.setSharedInfo2(s2);
                                                            dba.updateNumberRow(number, number.getNumber(),
                                                                    number.getId());

                                                            number.setInitiator(true);
                                                            dba.updateInitiator(number);

                                                            //TODO add check for shared secrets
                                                            String keyExchangeMessage = KeyExchange.sign(number,
                                                                    dba, SMSUtility.user);

                                                            writeToFile(number.getNumber(), keyExchangeMessage);

                                                            Toast.makeText(UserKeySettings.this,
                                                                    UserKeySettings.this
                                                                            .getString(R.string.written_path)
                                                                            + " " + path + "/"
                                                                            + number.getNumber() + "_" + file,
                                                                    Toast.LENGTH_SHORT).show();

                                                        } else {
                                                            Toast.makeText(UserKeySettings.this,
                                                                    R.string.invalid_secrets, Toast.LENGTH_LONG)
                                                                    .show();
                                                        }
                                                    }
                                                })
                                        .setNegativeButton(android.R.string.cancel,
                                                new DialogInterface.OnClickListener() {
                                                    @Override
                                                    public void onClick(DialogInterface arg0, int arg1) {
                                                        //Cancel the key exchange
                                                        Toast.makeText(UserKeySettings.this,
                                                                R.string.key_exchange_cancelled,
                                                                Toast.LENGTH_LONG).show();
                                                    }
                                                });
                                AlertDialog alert = builder.create();

                                alert.setView(linearLayout);
                                alert.show();
                            } else {
                                invalid = true;
                            }
                        } else {
                            invalid = true;
                        }

                        if (invalid) {
                            Toast.makeText(UserKeySettings.this, R.string.invalid_number_message,
                                    Toast.LENGTH_LONG).show();
                        }
                    }
                });

        popup_alert = popup_builder.create();
        popup_alert.show();

        //getExternalFilesDir(null);
    }
}