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.xalops.spotifystreamer.fragments.SearchListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a ListView whose id * is {@link android.R.id#list android.R.id.list} and can optionally * have a sibling view id {@link android.R.id#empty android.R.id.empty} * that is to be shown when the list is empty. * * <p>If you are overriding this method with your own custom content, * consider including the standard layout {@link android.R.layout#list_content} * in your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only * way to have the built-in indeterminant progress state be shown. *///from w w w .j a va 2s. co m @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); //QUICK Inflate from XML file //inflater.inflate(R.layout.search_list_detail, root); // ------------------------------------------------------------------ LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ RelativeLayout rlayout = new RelativeLayout(context); EditText et = new EditText(getActivity()); et.setId(INTERNAL_SEARCH_FIELD_ID); et.setSingleLine(true); et.setInputType(InputType.TYPE_CLASS_TEXT); et.setImeOptions(EditorInfo.IME_ACTION_DONE); RelativeLayout.LayoutParams etRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); RelativeLayout.LayoutParams lframeRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); lframeRLayoutParams.addRule(RelativeLayout.BELOW, INTERNAL_SEARCH_FIELD_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); rlayout.addView(et, etRLayoutParams); rlayout.addView(lframe, lframeRLayoutParams); root.addView(rlayout, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:nu.firetech.android.pactrack.frontend.ParcelIdDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.setContentView(R.layout.parcel_id_dialog); dialog.setTitle(R.string.menu_add_parcel); mErrorDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.id_error_title) .setIconAttribute(android.R.attr.alertDialogIcon).setMessage(R.string.id_error_message) .setNeutralButton(R.string.ok, new OnClickListener() { @Override//from w ww . ja v a 2 s . c o m public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); mDbAdapter = new ParcelDbAdapter(getActivity()).open(); mParcelText = (EditText) dialog.findViewById(R.id.parcelid); mParcelText.setKeyListener(new NumberKeyListener() { private char[] acceptedChars = null; @Override protected char[] getAcceptedChars() { if (acceptedChars == null) { acceptedChars = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; } return acceptedChars; } @Override public int getInputType() { return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; } }); mNameText = (EditText) dialog.findViewById(R.id.parcelname); ImageButton scanButton = (ImageButton) dialog.findViewById(R.id.barcode); scanButton.setOnClickListener(new ScanButtonListener()); Button cancelButton = (Button) dialog.findViewById(R.id.cancel); cancelButton.setOnClickListener(new ClosingButtonListener()); Button okButton = (Button) dialog.findViewById(R.id.ok); okButton.setOnClickListener(new OkListener()); if (savedInstanceState != null && savedInstanceState.containsKey(ParcelDbAdapter.KEY_ROWID)) { mRowId = savedInstanceState.getLong(ParcelDbAdapter.KEY_ROWID); } boolean loadParcel = false; mParcelInitialText = ""; if (savedInstanceState != null && savedInstanceState.containsKey(ParcelDbAdapter.KEY_PARCEL)) { mParcelInitialText = savedInstanceState.getString(ParcelDbAdapter.KEY_PARCEL); } else if (mRowId != null) { loadParcel = true; mParcelInitialText = getString(R.string.loading); mParcelText.setEnabled(false); } mParcelText.setText(mParcelInitialText); mNameInitialText = ""; if (savedInstanceState != null && savedInstanceState.containsKey(ParcelDbAdapter.KEY_NAME)) { mNameInitialText = savedInstanceState.getString(ParcelDbAdapter.KEY_NAME); } else if (mRowId != null) { loadParcel = true; mNameInitialText = getString(R.string.loading); mNameText.setEnabled(false); } mNameText.setText(mNameInitialText); mFocusedView = null; if (savedInstanceState != null && savedInstanceState.containsKey(KEY_FOCUSED_FIELD)) { mFocusedView = dialog.findViewById(savedInstanceState.getInt(KEY_FOCUSED_FIELD)); mInitialSelectionStart = mInitialSelectionEnd = 0; if (mFocusedView instanceof EditText && savedInstanceState.containsKey(KEY_SELECTION_START) && savedInstanceState.containsKey(KEY_SELECTION_END)) { mInitialSelectionStart = savedInstanceState.getInt(KEY_SELECTION_START); mInitialSelectionEnd = savedInstanceState.getInt(KEY_SELECTION_END); Selection.setSelection(((EditText) mFocusedView).getText(), mInitialSelectionStart, mInitialSelectionEnd); } mFocusedView.requestFocus(); } if (loadParcel) { getLoaderManager().initLoader(INITIAL_LOADER_ID, null, this); } return dialog; }
From source file:com.tingtingapps.securesms.ContactSelectionActivity.java
private void initializeResources() { this.action = (ImageView) findViewById(R.id.action_icon); this.searchText = (EditText) findViewById(R.id.search_view); this.toggle = (AnimatingToggle) findViewById(R.id.button_toggle); this.keyboardToggle = (ImageView) findViewById(R.id.search_keyboard); this.dialpadToggle = (ImageView) findViewById(R.id.search_dialpad); this.clearToggle = (ImageView) findViewById(R.id.search_clear); this.toggleContainer = (LinearLayout) findViewById(R.id.toggle_container); contactsFragment = (ContactSelectionListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_selection_list_fragment); contactsFragment.setOnContactSelectedListener(this); contactsFragment.setOnRefreshListener(this); this.keyboardToggle.setOnClickListener(new View.OnClickListener() { @Override//from w w w .ja va 2 s . c om public void onClick(View v) { searchText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME); ServiceUtil.getInputMethodManager(ContactSelectionActivity.this).showSoftInput(searchText, 0); displayTogglingView(dialpadToggle); } }); this.dialpadToggle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { searchText.setInputType(InputType.TYPE_CLASS_PHONE); ServiceUtil.getInputMethodManager(ContactSelectionActivity.this).showSoftInput(searchText, 0); displayTogglingView(keyboardToggle); } }); this.clearToggle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { searchText.setText(""); if (SearchUtil.isTextInput(searchText)) displayTogglingView(dialpadToggle); else displayTogglingView(keyboardToggle); } }); expandTapArea(toolbar, action, 500); expandTapArea(toggleContainer, dialpadToggle, 500); }
From source file:com.ruesga.rview.fragments.EditDialogFragment.java
@Override public void buildDialog(AlertDialog.Builder builder, Bundle savedInstanceState) { String title = getArguments().getString(EXTRA_TITLE); String action = getArguments().getString(EXTRA_ACTION); if (TextUtils.isEmpty(action)) { action = getString(R.string.action_change); }//from w w w . ja v a2s . c om boolean allowSuggestions = getArguments().getBoolean(EXTRA_ALLOW_SUGGESTIONS, false); int inputType = InputType.TYPE_CLASS_TEXT | (mModel.isMultiLine ? InputType.TYPE_TEXT_FLAG_MULTI_LINE : 0) | (allowSuggestions ? 0 : InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); LayoutInflater inflater = LayoutInflater.from(builder.getContext()); mBinding = DataBindingUtil.inflate(inflater, R.layout.edit_dialog, null, true); mBinding.edit.setInputType(inputType); mBinding.edit.addTextChangedListener(mTextWatcher); mBinding.setModel(mModel); builder.setTitle(title).setView(mBinding.getRoot()).setNegativeButton(R.string.action_cancel, null) .setPositiveButton(action, (dialog, which) -> performEditChanged()); }
From source file:com.scigames.slidegame.Registration2RFIDActivity.java
/** Called with the activity is first created. */ @Override/*from w ww . j a v a 2 s . com*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "super.OnCreate"); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); Intent i = getIntent(); Log.d(TAG, "getIntent"); visitIdIn = i.getStringExtra("visitId"); studentIdIn = i.getStringExtra("studentId"); firstNameIn = i.getStringExtra("fName"); lastNameIn = i.getStringExtra("lName"); //classIdIn = i.getStringExtra("mClass"); //passwordIn = i.getStringExtra("mPass"); Log.d(TAG, "...getStringExtra:"); //Log.d(TAG,firstNameIn+lastNameIn); // Inflate our UI from its XML layout description. setContentView(R.layout.registration2_rfid); Log.d(TAG, "...setContentView: registration2_rfid"); // Find the text editor view inside the layout, because we // want to do various programmatic things with it. braceletId = (EditText) findViewById(R.id.bracelet_id); /* to hide the keyboard on launch, then open when tap in firstname field */ Log.d(TAG, "...braceletId EditText set"); braceletId.setInputType(InputType.TYPE_NULL); Log.d(TAG, "...setInputType"); braceletId.setOnTouchListener(new View.OnTouchListener() { //@Override public boolean onTouch(View v, MotionEvent event) { braceletId.setInputType(InputType.TYPE_CLASS_TEXT); braceletId.onTouchEvent(event); // call native handler return true; // consume touch even } }); //firstName = (EditText) findViewById(R.id.first_name); //lastName = (EditText) findViewById(R.id.last_name); //password = (EditText) findViewById(R.id.password); Log.d(TAG, "...instantiateEditTexts"); // Log.d(TAG,"firstNameIn:"); // Log.d(TAG,firstNameIn); // Log.d(TAG,"lastNameIn:"); // Log.d(TAG,lastNameIn); //set info to what we know already //lastName.setText(lastNameIn); // Log.d(TAG,"...lastName.setText"); //firstName.setText(firstNameIn); // Log.d(TAG,"...firstName.setText"); //display name in greeting sentence Resources res = getResources(); TextView greets = (TextView) findViewById(R.id.greeting); Log.d(TAG, "...TextView greets find greeting"); greets.setText(String.format(res.getString(R.string.greeting), firstNameIn, lastNameIn)); Log.d(TAG, greets.toString()); Log.d(TAG, "...Greetings"); // Hook up button presses to the appropriate event handler. ((Button) findViewById(R.id.back)).setOnClickListener(mBackListener); ((Button) findViewById(R.id.continue_button)).setOnClickListener(mContinueButtonListener); ((Button) findViewById(R.id.scan)).setOnClickListener(mScanButtonListener); Log.d(TAG, "...instantiateButtons"); task.setOnResultsListener(this); }
From source file:id.zelory.tanipedia.activity.JawabActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_jawab); Toolbar toolbar = (Toolbar) findViewById(R.id.anim_toolbar); setSupportActionBar(toolbar);/* w w w .ja v a2 s.c o m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); collapsingToolbar.setTitle("Tanya Tani"); soal = getIntent().getParcelableExtra("soal"); try { idSoal = URLEncoder.encode(soal.getId(), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } Animation animation = AnimationUtils.loadAnimation(this, R.anim.simple_grow); fabMargin = getResources().getDimensionPixelSize(R.dimen.fab_margin); recyclerView = (RecyclerView) findViewById(R.id.scrollableview); recyclerView.setHasFixedSize(true); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.addOnScrollListener(new MyRecyclerScroll() { @Override public void show() { fab.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start(); } @Override public void hide() { fab.animate().translationY(fab.getHeight() + fabMargin) .setInterpolator(new AccelerateInterpolator(2)).start(); } }); fab = (FrameLayout) findViewById(R.id.myfab_main); fabBtn = (ImageButton) findViewById(R.id.myfab_main_btn); View fabShadow = findViewById(R.id.myfab_shadow); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { fabShadow.setVisibility(View.GONE); fabBtn.setBackground(getDrawable(R.drawable.ripple_accent)); } fab.startAnimation(animation); fabBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new MaterialDialog.Builder(JawabActivity.this).title("TaniPedia").content("Kirim Jawaban") .inputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_CLASS_TEXT) .input("Ketik jawaban anda disini!", null, false, new MaterialDialog.InputCallback() { @Override public void onInput(MaterialDialog dialog, CharSequence input) { try { jawaban = URLEncoder.encode(input.toString(), "UTF-8"); new KirimJawaban().execute(); } catch (UnsupportedEncodingException e) { Snackbar.make(fabBtn, "Terjadi kesalahan, silahkan coba lagi!", Snackbar.LENGTH_LONG).show(); e.printStackTrace(); } } }).positiveColorRes(R.color.primary_dark).positiveText("Kirim") .cancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { } }).negativeColorRes(R.color.primary_dark).negativeText("Batal").show(); } }); fabButton = (FabButton) findViewById(R.id.determinate); fabButton.showProgress(true); new DownloadData().execute(); fabButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fabButton.showProgress(true); new DownloadData().execute(); } }); }
From source file:id.satusatudua.sigap.ui.fragment.SettingFragment.java
@OnClick(R.id.feedback) public void onFeedbackClick() { EditText editText = new EditText(getActivity()); editText.setHint("Feedback"); editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE); AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).setIcon(R.mipmap.ic_launcher) .setTitle("Kirim Feedback").setView(editText).setPositiveButton("Kirim", (dialog, which) -> { if (!editText.getText().toString().isEmpty()) { sendFeedBack(editText.getText().toString()); KeyboardUtil.hideKeyboard(getActivity(), editText); dialog.dismiss();/*from ww w . ja v a2s. c om*/ } }).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.ryan.ryanreader.activities.PostSubmitActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { PrefsUtility.applyTheme(this); super.onCreate(savedInstanceState); final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.post_submit); typeSpinner = (Spinner) layout.findViewById(R.id.post_submit_type); usernameSpinner = (Spinner) layout.findViewById(R.id.post_submit_username); subredditEdit = (EditText) layout.findViewById(R.id.post_submit_subreddit); titleEdit = (EditText) layout.findViewById(R.id.post_submit_title); textEdit = (EditText) layout.findViewById(R.id.post_submit_body); if (getIntent() != null && getIntent().hasExtra("subreddit")) { final String subreddit = getIntent().getStringExtra("subreddit"); if (subreddit != null && subreddit.length() > 0 && !subreddit.equals("all") && subreddit.matches("\\w+")) { subredditEdit.setText(subreddit); }// w w w.j a v a 2 s. c o m } else if (savedInstanceState != null && savedInstanceState.containsKey("post_title")) { titleEdit.setText(savedInstanceState.getString("post_title")); textEdit.setText(savedInstanceState.getString("post_body")); subredditEdit.setText(savedInstanceState.getString("subreddit")); typeSpinner.setSelection(savedInstanceState.getInt("post_type")); } final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts(); final ArrayList<String> usernames = new ArrayList<String>(); for (RedditAccount account : accounts) { if (!account.isAnonymous()) { usernames.add(account.username); } } if (usernames.size() == 0) { General.quickToast(this, R.string.error_toast_notloggedin); finish(); } usernameSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usernames)); typeSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, postTypes)); // TODO remove the duplicate code here if (typeSpinner.getSelectedItem().equals("Link")) { textEdit.setHint("URL"); // TODO string textEdit.setInputType(android.text.InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); textEdit.setSingleLine(true); } else { textEdit.setHint("Self Text"); // TODO string textEdit.setInputType(android.text.InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE | InputType.TYPE_TEXT_FLAG_MULTI_LINE); textEdit.setSingleLine(false); } typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (typeSpinner.getSelectedItem().equals("Link")) { textEdit.setHint("URL"); // TODO string textEdit.setInputType( android.text.InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); textEdit.setSingleLine(true); } else { textEdit.setHint("Self Text"); // TODO string textEdit.setInputType(android.text.InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE | InputType.TYPE_TEXT_FLAG_MULTI_LINE); textEdit.setSingleLine(false); } } public void onNothingSelected(AdapterView<?> parent) { } }); final ScrollView sv = new ScrollView(this); sv.addView(layout); setContentView(sv); }
From source file:cz.maresmar.sfm.app.SfmApp.java
/** * Opens email app with log file// w ww . ja va 2s .c o m */ public void sendFeedback(Context context) { // Shows subjects dialog AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.feedback_subject_title); builder.setMessage(R.string.feedback_subject_msg); // Set up the input final EditText input = new EditText(context); // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); builder.setView(input); // Set up the buttons builder.setPositiveButton(android.R.string.ok, (dialog, which) -> sendFeedback(context, input.getText().toString())); builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel()); builder.show(); }
From source file:com.seedform.dfatester.viewer.AlphabetListFragment.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final Character oldChar = mDFA.getAlphabet().get(position); final EditText input = new EditText(getActivity()); input.setHint(getResources().getString(R.string.hint_concat_symbol_replacement) + "\"" + oldChar.toString() + "\""); input.setGravity(Gravity.CENTER);//from w ww . j a v a 2s. com input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); input.setFilters(new InputFilter[] { new InputFilter.LengthFilter(1) }); new AlertDialog.Builder(getActivity()).setTitle(R.string.title_symbol_replacement).setView(input) .setPositiveButton(R.string.action_replace_symbol, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String inputText = input.getText().toString(); String message; if (inputText.length() != 0) { if (mDFA.replaceSymbol(oldChar, inputText.charAt(0))) { message = "\"" + oldChar + "\"" + getResources().getString(R.string.msg_concat_symbol_replaced); mAdapter.notifyDataSetChanged(); } else { message = "\"" + inputText + "\"" + getResources().getString(R.string.msg_concat_symbol_exists); } Tool.createToast(getActivity(), message, Toast.LENGTH_SHORT); } } }).show(); }