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:de.nico.ha_manager.activities.Preferences.java
@SuppressWarnings("deprecation") private void checkPreferences() { Preference language = findPreference("pref_app_language"); language.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override// ww w . jav a 2 s. c om public boolean onPreferenceClick(Preference preference) { Utils.langSpinner(c); return true; } }); Preference subjects_add = findPreference("subjects_add"); subjects_add.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { final EditText input = new EditText(c); input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); AlertDialog.Builder alertDialog = new AlertDialog.Builder(c); alertDialog.setTitle(getString(R.string.dialog_addSubject)) .setMessage(getString(R.string.dialog_addSubject_message)).setView(input) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface d, int i) { Subject.add(c, input.getText().toString()); } }).setNegativeButton((getString(android.R.string.no)), null).show(); return true; } }); Preference subjects_reset = findPreference("subjects_reset"); subjects_reset.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(c); alertDialog.setTitle(getString(R.string.dialog_delete)) .setMessage(getString(R.string.dialog_really_delete_subs)) .setPositiveButton((getString(android.R.string.yes)), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface d, int i) { Subject.setDefault(c); } }) .setNegativeButton((getString(android.R.string.no)), null).show(); return true; } }); Preference feedback_share = findPreference("feedback_share"); feedback_share.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { return Utils.shareApp(c); } }); Preference importexport_export = findPreference("pref_importexport_export"); importexport_export.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(c); alertDialog.setTitle(getString(R.string.pref_homework_export)) .setMessage(getString(R.string.dialog_export_message)) .setPositiveButton((getString(android.R.string.yes)), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface d, int i) { Homework.exportIt(c); } }) .setNegativeButton((getString(android.R.string.no)), null).show(); return true; } }); Preference importexport_import = findPreference("pref_importexport_import"); importexport_import.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(c); alertDialog.setTitle(getString(R.string.pref_homework_import)) .setMessage(getString(R.string.dialog_import_message)) .setPositiveButton((getString(android.R.string.yes)), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface d, int i) { Homework.importIt(c); } }) .setNegativeButton((getString(android.R.string.no)), null).show(); return true; } }); }
From source file:com.seedform.dfatester.viewer.AlphabetListFragment.java
private void openAddSymbolDialog() { final EditText input = new EditText(getActivity()); input.setHint(R.string.hint_symbol_entry); input.setGravity(Gravity.CENTER);/*from w w w. j av a2 s . c o m*/ input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); new AlertDialog.Builder(getActivity()).setTitle(R.string.title_symbol_entry).setView(input) .setPositiveButton(R.string.action_add_symbol, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String inputText = input.getText().toString(); if (inputText.length() != 0) { for (char c : inputText.toCharArray()) { mDFA.addSymbol(c); } mAdapter.notifyDataSetChanged(); Tool.createToast(getActivity(), R.string.msg_symbols_added, Toast.LENGTH_SHORT); } } }).show(); }
From source file:pl.bcichecki.rms.client.android.dialogs.RegisterDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { context = getActivity();/*from w w w .j av a 2s . c om*/ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.dialog_register_title)); builder.setMessage(getString(R.string.dialog_register_message)); final EditText usernameEditText = new EditText(getActivity()); usernameEditText.setHint(getString(R.string.dialog_register_enter_username_hint)); usernameEditText.setMaxLines(1); usernameEditText.setSingleLine(); usernameEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT); usernameEditText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { usernameEditText.setError(null); } }); final EditText passwordEditText = new EditText(getActivity()); passwordEditText.setHint(getString(R.string.dialog_register_enter_password_hint)); passwordEditText.setMaxLines(1); passwordEditText.setSingleLine(); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); passwordEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT); passwordEditText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { passwordEditText.setError(null); } }); final EditText emailEditText = new EditText(getActivity()); emailEditText.setHint(getString(R.string.dialog_register_enter_email_hint)); emailEditText.setMaxLines(1); emailEditText.setSingleLine(); emailEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); emailEditText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { emailEditText.setError(null); } }); final LinearLayout layout = new LinearLayout(getActivity()); layout.setOrientation(LinearLayout.VERTICAL); layout.setGravity(Gravity.CENTER_HORIZONTAL); int space = (int) AppUtils.convertDpToPixel(getActivity(), 16); layout.setPadding(space, 0, space, 0); layout.addView(usernameEditText); layout.addView(passwordEditText); layout.addView(emailEditText); builder.setView(layout); builder.setPositiveButton(getString(R.string.dialog_register_ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { return; } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { return; } }); final AlertDialog dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) { utilitiesRestClient = new UtilitiesRestClient(getActivity(), SharedPreferencesWrapper.getServerAddress(), SharedPreferencesWrapper.getServerPort(), SharedPreferencesWrapper.getWebserviceContextPath()); final Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE); positiveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!AppUtils.checkInternetConnection(getActivity())) { Log.d(TAG, "There is NO network connected!"); return; } usernameEditText.setError(null); passwordEditText.setError(null); emailEditText.setError(null); if (StringUtils.isBlank(usernameEditText.getText().toString())) { usernameEditText.setError(getString(R.string.dialog_register_field_required)); return; } if (StringUtils.isBlank(passwordEditText.getText().toString())) { passwordEditText.setError(getString(R.string.dialog_register_field_required)); return; } if (StringUtils.isBlank(emailEditText.getText().toString())) { emailEditText.setError(getString(R.string.dialog_register_field_required)); return; } if (!AppUtils.validateEmail(emailEditText.getText().toString())) { emailEditText.setError(getString(R.string.dialog_register_email_not_valid)); return; } final User user = new User(); user.setUsername(usernameEditText.getText().toString()); user.setPassword(SecurityUtils.hashSHA512Base64(passwordEditText.getText().toString())); user.setEmail(StringUtils.lowerCase(emailEditText.getText().toString())); user.setAddress(new AddressData()); utilitiesRestClient.registerUser(user, new AsyncHttpResponseHandler() { @Override public void onFailure(Throwable error, String content) { Log.d(TAG, "Registering user failed. [error= " + error + ", content=" + content + "]"); AppUtils.showCenteredToast(context, getString(R.string.dialog_register_failed), Toast.LENGTH_LONG); } @Override public void onFinish() { positiveButton.setEnabled(true); } @Override public void onStart() { Log.d(TAG, "Registering user: " + user.toString()); AppUtils.showCenteredToast(context, getString(R.string.dialog_register_in_progress), Toast.LENGTH_SHORT); positiveButton.setEnabled(false); } @Override public void onSuccess(int statusCode, String content) { Log.d(TAG, "Registered user successfully."); AppUtils.showCenteredToast(context, getString(R.string.dialog_register_successful), Toast.LENGTH_SHORT); SharedPreferencesWrapper.setUsername(user.getUsername()); SharedPreferencesWrapper.setPasswordHash(user.getPassword()); SharedPreferencesWrapper.setRememberUser(true); dialog.dismiss(); } }); } }); final Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE); negativeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { cancelRequests(); dialog.dismiss(); } }); } }); return dialog; }
From source file:com.mobshep.mobileshepherd.UDataLeakage1.java
public void onCheckboxClicked(View view) { // Is the view now checked? boolean checked = ((CheckBox) view).isChecked(); // Check which checkbox was clicked if (((CheckBox) view).isChecked()) { secret.setInputType(InputType.TYPE_CLASS_TEXT); // secret.setTransformationMethod(PasswordTransformationMethod.getInstance()); } else {//from w w w . j ava 2 s . c om secret.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); secret.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } }
From source file:nya.miku.wishmaster.chans.endchan.EndChanModule.java
private void addDomainPreferences(PreferenceGroup group) { Context context = group.getContext(); Preference.OnPreferenceChangeListener updateDomainListener = new Preference.OnPreferenceChangeListener() { @Override//from ww w. ja v a2 s .c o m public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals(getSharedKey(PREF_KEY_DOMAIN))) { updateDomain((String) newValue); return true; } return false; } }; PreferenceCategory domainCat = new PreferenceCategory(context); domainCat.setTitle(R.string.makaba_prefs_domain_category); group.addPreference(domainCat); EditTextPreference domainPref = new EditTextPreference(context); domainPref.setTitle(R.string.pref_domain); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT)); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.getEditText().setHint(DEFAULT_DOMAIN); domainPref.getEditText().setSingleLine(); domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); domainPref.setOnPreferenceChangeListener(updateDomainListener); domainCat.addPreference(domainPref); }
From source file:com.upmoon.alexanderbean.barcrawlr.fragments.PlanSelectorFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_plan_selector, container, false); /**//w w w . j a v a2s . c om * Widgets here */ mLeftFAB = (FloatingActionButton) v.findViewById(R.id.connect_fab); mLeftFAB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder buildo = new AlertDialog.Builder(getActivity()); final EditText inp1 = new EditText(getActivity()); inp1.setInputType(InputType.TYPE_CLASS_TEXT); buildo.setTitle("Join Active Plan"); buildo.setView(inp1); buildo.setPositiveButton("Join", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface diag, int which) { AlertDialog.Builder buildo = new AlertDialog.Builder(getActivity()); final EditText inp2 = new EditText(getActivity()); inp2.setInputType(InputType.TYPE_CLASS_TEXT); buildo.setTitle("Choose a username"); buildo.setView(inp2); buildo.setPositiveButton("Join", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface diag, int which) { if (!inp2.getText().toString().equals("")) { GetPlan gp = new GetPlan(); gp.execute(inp1.getText().toString(), inp2.getText().toString()); } } }); buildo.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface diag, int which) { diag.cancel(); } }); buildo.show(); } }); buildo.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface diag, int which) { diag.cancel(); } }); buildo.show(); } }); mRightFAB = (FloatingActionButton) v.findViewById(R.id.new_plan_fab); mRightFAB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder buildo = new AlertDialog.Builder(getActivity()); final EditText inp = new EditText(getActivity()); inp.setInputType(InputType.TYPE_CLASS_TEXT); buildo.setTitle("Create New Plan"); buildo.setView(inp); buildo.setPositiveButton("Create", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface diag, int which) { PlanLoader pl = new PlanLoader(getActivity()); String planName = inp.getText().toString(); if (!planName.equals("") && pl.planNameExists(planName)) { Toast.makeText(getActivity(), "Invalid Name or name exists", Toast.LENGTH_SHORT).show(); } else { Plan plan = new Plan(); plan.setName(inp.getText().toString()); CurrentPlan.getInstance().setPlan(plan); Intent intent = new Intent(getActivity(), PlanCreator.class); startActivity(intent); } } }); buildo.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface diag, int which) { } }); buildo.show(); } }); //RecyclerView mAdapter = new PlanAdapter(); mRecyclerView = (RecyclerView) v.findViewById(R.id.gol_recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false)); mRecyclerView.setAdapter(mAdapter); /** * Load in plan data */ PlanListChanged(); /** * location */ locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); locationListener = new LocationListener() { public void onLocationChanged(Location location) { // Called when a new location is found by the network location provider. updateLocation(location.getLongitude(), location.getLatitude()); } public void onStatusChanged(String provider, int status, Bundle extras) { } public void onProviderEnabled(String provider) { } public void onProviderDisabled(String provider) { } }; return v; }
From source file:de.nico.asura.activities.WebView1.java
private void checkLogin() { // Layout for Dialog final LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); final EditText edit_name = new EditText(this); edit_name.setHint(getString(R.string.menu_Web_1_auth_fiFi)); layout.addView(edit_name);//from w ww . jav a 2 s . c o m final EditText edit_pass = new EditText(this); edit_pass.setHint(getString(R.string.menu_Web_1_auth_seFi)); edit_pass.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); layout.addView(edit_pass); final Builder builder = new Builder(this); builder.setTitle(getString(R.string.menu_Web_1_name)).setCancelable(false).setView(layout) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { firstField = edit_name.getText().toString(); secondField = edit_pass.getText().toString(); // Nothing? if (firstField.length() == 0 || secondField.length() == 0) { Utils.makeShortToast(WebView1.this, getString(R.string.wrong)); checkLogin(); return; } final Editor editor = prefs.edit(); editor.putString(sharedPrefFiFi, firstField); editor.putString(sharedPrefSeFi, secondField); editor.apply(); openWebView(); } }).setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { WebView1.this.finish(); } }).show(); }
From source file:de.nico.asura.activities.WebView2.java
private void checkLogin() { // Layout for Dialog final LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); final EditText edit_name = new EditText(this); edit_name.setHint(getString(R.string.menu_Web_2_auth_fiFi)); layout.addView(edit_name);/*from w w w. ja v a 2 s .c o m*/ final EditText edit_pass = new EditText(this); edit_pass.setHint(getString(R.string.menu_Web_2_auth_seFi)); edit_pass.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); layout.addView(edit_pass); final Builder builder = new Builder(this); builder.setTitle(getString(R.string.menu_Web_2_name)).setCancelable(false).setView(layout) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { firstField = edit_name.getText().toString(); secondField = edit_pass.getText().toString(); // Nothing? if (firstField.length() == 0 || secondField.length() == 0) { Utils.makeShortToast(WebView2.this, getString(R.string.wrong)); checkLogin(); return; } final Editor editor = prefs.edit(); editor.putString(sharedPrefFiFi, firstField); editor.putString(sharedPrefSeFi, secondField); editor.apply(); openWebView(); } }).setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { WebView2.this.finish(); } }).show(); }
From source file:de.nico.asura.activities.WebView3.java
private void checkLogin() { // Layout for Dialog final LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); final EditText edit_name = new EditText(this); edit_name.setHint(getString(R.string.menu_Web_3_auth_fiFi)); layout.addView(edit_name);//from ww w . ja va 2 s .c om final EditText edit_pass = new EditText(this); edit_pass.setHint(getString(R.string.menu_Web_3_auth_seFi)); edit_pass.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); layout.addView(edit_pass); final Builder builder = new Builder(this); builder.setTitle(getString(R.string.menu_Web_3_name)).setCancelable(false).setView(layout) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { firstField = edit_name.getText().toString(); secondField = edit_pass.getText().toString(); // Nothing? if (firstField.length() == 0 || secondField.length() == 0) { Utils.makeShortToast(WebView3.this, getString(R.string.wrong)); checkLogin(); return; } final Editor editor = prefs.edit(); editor.putString(sharedPrefFiFi, firstField); editor.putString(sharedPrefSeFi, secondField); editor.apply(); openWebView(); } }).setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { WebView3.this.finish(); } }).show(); }
From source file:com.luorrak.ouroboros.catalog.BoardListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_add_board: { final EditText edittext = new EditText(getActivity()); edittext.setInputType(InputType.TYPE_CLASS_TEXT); AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).setMessage("New Board") .setTitle("Please enter a board name.").setView(edittext) .setPositiveButton("Add Board", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //Add board to database, should consider doing some error checking as well. final String boardName = edittext.getText().toString(); Ion.with(getActivity()).load(ChanUrls.getCatalogUrl(boardName)).asString() .withResponse().setCallback(new FutureCallback<Response<String>>() { @Override public void onCompleted(Exception e, Response<String> stringResponse) { if (getActivity() != null) { if (e != null || stringResponse.getHeaders().code() == 404) { Snackbar.make(getView(), "Server Error! Does board exist?", Snackbar.LENGTH_LONG).show(); return; } InfiniteDbHelper infiniteDbHelper = new InfiniteDbHelper( getActivity()); infiniteDbHelper.insertBoardEntry(boardName, boardListAdapter.getCursor().getCount()); boardListAdapter.changeCursor(infiniteDbHelper.getBoardCursor()); } }//from ww w . j av a 2 s. c o m }); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // what ever you want to do with No option. } }).create(); alertDialog.show(); break; } } return super.onOptionsItemSelected(item); }