List of usage examples for android.text InputType TYPE_CLASS_TEXT
int TYPE_CLASS_TEXT
To view the source code for android.text InputType TYPE_CLASS_TEXT.
Click Source Link
From source file:com.activiti.android.ui.fragments.form.EditTextDialogFragment.java
@Override public void onStart() { String value = null;/* w w w . j a v a 2 s. c o m*/ if (getArguments() != null) { value = getArguments().getString(ARGUMENT_VALUE); hintId = getArguments().getInt(ARGUMENT_HINT_ID); notNull = getArguments().getBoolean(ARGUMENT_EMPTY); singleLine = getArguments().getBoolean(ARGUMENT_SINGLE_LINE); } super.onStart(); if (getDialog() != null) { et = ((EditText) getDialog().getWindow().findViewById(R.id.text_value)); if (singleLine) { et.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_CLASS_TEXT); et.setSingleLine(true); et.setMinLines(1); et.setMaxLines(1); et.setLines(1); } et.setText(value); if (hintId != 0) { et.setHint(hintId); } et.setSelection(et.getText().length()); if (notNull) { et.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() == 0) { ((MaterialDialog) getDialog()).getActionButton(DialogAction.POSITIVE).setEnabled(false); // ((MaterialDialog)getDialog()).getActionButton(DialogAction.POSITIVE).setBackgroundColor(getResources().getColor(R.color.primary_background)); } else { ((MaterialDialog) getDialog()).getActionButton(DialogAction.POSITIVE).setEnabled(true); // ((MaterialDialog)getDialog()).getActionButton(DialogAction.POSITIVE).setBackgroundColor(getResources().getColor(R.color.primary)); // backField.setBackgroundColor(getResources().getColor(R.color.primary)); } } }); } UIUtils.showKeyboard(getActivity(), et); } }
From source file:com.normalexception.app.rx8club.dialog.MoveThreadDialog.java
/** * Constructor for method that is used to move a thread from one * forum to another /*ww w.j a v a 2s .c o m*/ * @param ctx The source context/activity * @param securitytoken The security token for the session * @param src_thread The source thread * @param tTitle The new thread title * @param options The options from the move dialog */ public MoveThreadDialog(final Fragment ctx, final String securitytoken, final String src_thread, String tTitle, final Map<String, Integer> options) { builder = new AlertDialog.Builder(ctx.getActivity()); // Set up the input final TextView lbl_title = new TextView(ctx.getActivity()); final EditText title = new EditText(ctx.getActivity()); final TextView lbl_dest = new TextView(ctx.getActivity()); final Spinner destination = new Spinner(ctx.getActivity()); // Lets make sure the user didn't accidentally click this DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: newTitle = title.getText().toString(); String selectText = destination.getSelectedItem().toString(); selection = options.get(selectText); AsyncTask<Void, String, Void> updaterTask = new AsyncTask<Void, String, Void>() { @Override protected Void doInBackground(Void... params) { try { HtmlFormUtils.adminMoveThread(securitytoken, src_thread, newTitle, Integer.toString(selection)); } catch (Exception e) { Log.e(TAG, "Error Submitting Form For Move", e); } return null; } @Override protected void onPostExecute(Void result) { ctx.getFragmentManager().popBackStack(); CategoryFragment cFrag = (CategoryFragment) ((ThreadFragment) ctx).getParentCategory(); cFrag.refreshView(); } }; updaterTask.execute(); break; case DialogInterface.BUTTON_NEGATIVE: break; } } }; // Specify the type of input expected lbl_title.setText("Thread Title"); lbl_title.setTextColor(Color.WHITE); lbl_dest.setText("Desination"); lbl_dest.setTextColor(Color.WHITE); title.setInputType(InputType.TYPE_CLASS_TEXT); title.setText(tTitle); List<String> values = new ArrayList<String>(); values.addAll(options.keySet()); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(ctx.getActivity(), android.R.layout.simple_spinner_item, values); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); destination.setAdapter(dataAdapter); LinearLayout ll = new LinearLayout(ctx.getActivity()); ll.setOrientation(LinearLayout.VERTICAL); ll.addView(lbl_title); ll.addView(title); ll.addView(lbl_dest); ll.addView(destination); builder.setView(ll); builder.setTitle(R.string.dialogMoveThread).setPositiveButton(R.string.Move, dialogClickListener) .setNegativeButton(R.string.cancel, dialogClickListener); }
From source file:org.kontalk.ui.ConversationList.java
private void askForPersonalName() { DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // no key pair found, generate a new one if (BuildConfig.DEBUG) { Toast.makeText(ConversationList.this, R.string.msg_generating_keypair, Toast.LENGTH_LONG) .show();//from www . j av a 2s . com } String name = InputDialog.getInputText((Dialog) dialog).toString(); // upgrade account proceedXmppUpgrade(name); } }; DialogInterface.OnCancelListener cancelListener = new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { new AlertDialog.Builder(ConversationList.this).setTitle(R.string.title_no_personal_key) .setMessage(R.string.msg_no_personal_key).setPositiveButton(android.R.string.ok, null) .show(); } }; new InputDialog.Builder(this, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME) .setTitle(R.string.title_no_name).setMessage(R.string.msg_no_name) .setPositiveButton(android.R.string.ok, okListener) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).setOnCancelListener(cancelListener).show(); }
From source file:org.orange.querysystem.ScoresActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case PASSWORD_PROMPT: final TextView textView = new TextView(this); textView.setText("?"); textView.setTextSize(14);// w ww . ja v a 2s . c o m textView.setId(1); final EditText editText = new EditText(this); editText.setId(2); editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); editText.setEnabled(true); editText.setCursorVisible(true); editText.setLongClickable(true); editText.setFocusable(true); editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); RelativeLayout.LayoutParams tvlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams etlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); RelativeLayout relativeLayout = new RelativeLayout(this); tvlp.addRule(RelativeLayout.ALIGN_BASELINE, 2); etlp.addRule(RelativeLayout.RIGHT_OF, 1); relativeLayout.addView(textView, tvlp); relativeLayout.addView(editText, etlp); return new AlertDialog.Builder(this).setView(relativeLayout) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked OK so do some stuff */ if (editText.getText().toString() .equals(SettingsActivity.getAccountPassword(ScoresActivity.this))) { authenticated = true; enterActivity(); } else { editText.setText(""); Toast.makeText(ScoresActivity.this, "????", Toast.LENGTH_LONG).show(); finish(); } } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked cancel so do some stuff */ finish(); } }).setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { finish(); return true; } return false; } }).create(); default: return null; } }
From source file:com.ntsync.android.sync.activities.KeyPasswordActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); SystemHelper.initSystem(this); Log.i(TAG, "loading data from Intent"); final Intent intent = getIntent(); mUsername = intent.getStringExtra(PARAM_USERNAME); pwdSalt = intent.getByteArrayExtra(PARAM_SALT); pwdCheck = intent.getByteArrayExtra(PARAM_CHECK); requestWindowFeature(Window.FEATURE_LEFT_ICON); setContentView(R.layout.keypassword_activity); getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.key); mMessage = (TextView) findViewById(R.id.message_bottom); mPasswordEdit = new AutoCompleteTextView[5]; mPasswordEdit[0] = (AutoCompleteTextView) findViewById(R.id.pwd1_edit); mPasswordEdit[1] = (AutoCompleteTextView) findViewById(R.id.pwd2_edit); mPasswordEdit[2] = (AutoCompleteTextView) findViewById(R.id.pwd3_edit); mPasswordEdit[3] = (AutoCompleteTextView) findViewById(R.id.pwd4_edit); mPasswordEdit[4] = (AutoCompleteTextView) findViewById(R.id.pwd5_edit); for (AutoCompleteTextView textView : mPasswordEdit) { textView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_PASSWORD); }/*w ww. java 2s .c o m*/ if (pwdSalt == null || pwdSalt.length != ClientKeyHelper.SALT_LENGHT || pwdCheck == null) { // disable password input for (AutoCompleteTextView textView : mPasswordEdit) { if (textView != null) { textView.setEnabled(false); } } } msgNewKey = (TextView) findViewById(R.id.message_newkey); SpannableString newKeyText = SpannableString.valueOf(getText(R.string.keypwd_activity_newkey_label)); newKeyText.setSpan(new InternalURLSpan(this), 0, newKeyText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); msgNewKey.setText(newKeyText, BufferType.SPANNABLE); msgNewKey.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.xirvik.transdroid.preferences.PreferencesXirvikServer.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // For which server? serverPostfix = getIntent().getStringExtra(PREFERENCES_XSERVER_KEY); // Create the preferences screen here: this takes care of saving/loading, but also contains the // ListView adapter, etc. setPreferenceScreen(getPreferenceManager().createPreferenceScreen(this)); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); nameValue = prefs.getString(Preferences.KEY_PREF_XNAME + serverPostfix, null); typeValue = prefs.getString(Preferences.KEY_PREF_XTYPE + serverPostfix, null); serverValue = prefs.getString(Preferences.KEY_PREF_XSERVER + serverPostfix, null); folderValue = prefs.getString(Preferences.KEY_PREF_XFOLDER + serverPostfix, null); userValue = prefs.getString(Preferences.KEY_PREF_XUSER + serverPostfix, null); passValue = prefs.getString(Preferences.KEY_PREF_XPASS + serverPostfix, null); // Create preference objects getPreferenceScreen().setTitle(R.string.xirvik_pref_title); // Name//from www. ja va 2 s .com name = new TransdroidEditTextPreference(this); name.setTitle(R.string.pref_name); name.setKey(Preferences.KEY_PREF_XNAME + serverPostfix); name.getEditText().setSingleLine(); name.setDialogTitle(R.string.pref_name); name.setOnPreferenceChangeListener(updateHandler); getPreferenceScreen().addItemFromInflater(name); // Type type = new TransdroidListPreference(this); type.setTitle(R.string.xirvik_pref_type); type.setKey(Preferences.KEY_PREF_XTYPE + serverPostfix); type.setEntries(R.array.pref_xirvik_types); type.setEntryValues(R.array.pref_xirvik_values); type.setDialogTitle(R.string.xirvik_pref_type); type.setOnPreferenceChangeListener(updateHandler); getPreferenceScreen().addItemFromInflater(type); // Server server = new TransdroidEditTextPreference(this); server.setTitle(R.string.xirvik_pref_server); server.setKey(Preferences.KEY_PREF_XSERVER + serverPostfix); server.getEditText().setSingleLine(); server.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); server.setDialogTitle(R.string.xirvik_pref_server); server.setOnPreferenceChangeListener(updateHandler); getPreferenceScreen().addItemFromInflater(server); // Folder folder = new TransdroidEditTextPreference(this); folder.setTitle(R.string.xirvik_pref_folder); folder.setKey(Preferences.KEY_PREF_XFOLDER + serverPostfix); folder.setEnabled(false); folder.setSummary(R.string.xirvik_pref_setautomatically); getPreferenceScreen().addItemFromInflater(folder); // User user = new TransdroidEditTextPreference(this); user.setTitle(R.string.pref_user); user.setKey(Preferences.KEY_PREF_XUSER + serverPostfix); user.getEditText().setSingleLine(); user.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_FILTER); user.setDialogTitle(R.string.pref_user); user.setOnPreferenceChangeListener(updateHandler); getPreferenceScreen().addItemFromInflater(user); // Pass pass = new TransdroidEditTextPreference(this); pass.setTitle(R.string.pref_pass); pass.setKey(Preferences.KEY_PREF_XPASS + serverPostfix); pass.getEditText().setSingleLine(); pass.getEditText().setInputType(EditorInfo.TYPE_TEXT_VARIATION_PASSWORD); pass.getEditText().setTransformationMethod(new PasswordTransformationMethod()); pass.setDialogTitle(R.string.pref_pass); pass.setOnPreferenceChangeListener(updateHandler); getPreferenceScreen().addItemFromInflater(pass); // AlertFinished alarmFinished = new TransdroidCheckBoxPreference(this); alarmFinished.setDefaultValue(true); alarmFinished.setTitle(R.string.pref_alarmfinished); alarmFinished.setSummary(R.string.pref_alarmfinished_info); alarmFinished.setKey(Preferences.KEY_PREF_XALARMFINISHED + serverPostfix); alarmFinished.setOnPreferenceChangeListener(updateHandler); getPreferenceScreen().addItemFromInflater(alarmFinished); // AlertNew alarmNew = new TransdroidCheckBoxPreference(this); alarmNew.setTitle(R.string.pref_alarmnew); alarmNew.setSummary(R.string.pref_alarmnew_info); alarmNew.setKey(Preferences.KEY_PREF_XALARMNEW + serverPostfix); alarmNew.setOnPreferenceChangeListener(updateHandler); getPreferenceScreen().addItemFromInflater(alarmNew); updateDescriptionTexts(); }
From source file:com.wikaba.ogapp.NoAccountFragment.java
@Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.login: String username = usernameField.getText().toString(); String passwd = passwdField.getText().toString(); View selectedView = uniSpinner.getSelectedView(); if (selectedView == null) { Toast.makeText(act, "Please select a valid universe.", Toast.LENGTH_SHORT).show(); return; }/* w ww . ja v a 2 s. c om*/ TextView selectedText = (TextView) selectedView; String universe = selectedText.getText().toString(); act.addAccount(universe, username, passwd); break; case R.id.pw_checkbox: int inputType = (pwCheckBox.isChecked()) ? (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) : (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); passwdField.setInputType(inputType); break; } }
From source file:me.ziccard.secureit.MonitorActivity.java
/** * Shows a dialog prompting the unlock code *//*w ww .java 2 s.co m*/ private void createUnlockDialog() { final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Stop monitoring?"); final EditText input = new EditText(this); input.setHint("Unlock code"); input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); builder.setView(input); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { if (input.getText().toString().equals(preferences.getUnlockCode())) { Log.i("MonitorActivity", "INPUT " + input.getText().toString()); Log.i("MonitorActivity", "STORED " + preferences.getUnlockCode()); dialog.dismiss(); close(); } else { dialog.dismiss(); Toast.makeText(getApplicationContext(), "Wrong unlock code", Toast.LENGTH_SHORT).show(); } } }); builder.show(); }
From source file:org.lol.reddit.activities.PostSubmitActivity.java
private void setHint() { if (typeSpinner.getSelectedItem().equals("Link")) { textEdit.setHint("URL"); // TODO string textEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); textEdit.setSingleLine(true);/*from w w w . j a va 2 s . c o m*/ } else { textEdit.setHint("Self Text"); // TODO string textEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE | InputType.TYPE_TEXT_FLAG_MULTI_LINE); textEdit.setSingleLine(false); } }
From source file:nl.hnogames.domoticz.QRCodeSettingsActivity.java
private void showEditDialog(final QRCodeInfo mQRCodeInfo) { new MaterialDialog.Builder(this).title(R.string.qrcode_edit).content(R.string.qrcode_name) .inputType(InputType.TYPE_CLASS_TEXT).negativeText(R.string.cancel) .input(this.getString(R.string.category_QRCode), mQRCodeInfo.getName(), new MaterialDialog.InputCallback() { @Override public void onInput(@NonNull MaterialDialog dialog, CharSequence input) { if (!UsefulBits.isEmpty(String.valueOf(input))) { mQRCodeInfo.setName(String.valueOf(input)); updateQRCode(mQRCodeInfo); }// w w w . ja v a 2 s. co m } }) .show(); }