List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:com.fastbootmobile.encore.app.fragments.NewPlaylistFragment.java
@NonNull @Override/*from w w w . j av a 2 s . c om*/ public Dialog onCreateDialog(Bundle savedInstance) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View root = inflater.inflate(R.layout.dialog_new_playlist, null); final TextView playlistName = (TextView) root.findViewById(R.id.et_playlist_name); final CheckBox multiProviderPlaylist = (CheckBox) root.findViewById(R.id.cb_provider_specific); builder.setView(root).setPositiveButton(getString(R.string.create), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String playlistNameStr = playlistName.getText().toString().trim(); if (!playlistNameStr.isEmpty()) { Log.d(TAG, "Adding new playlist named '" + playlistNameStr + "'"); try { ProviderConnection connection; if (multiProviderPlaylist.isChecked()) { connection = PluginsLookup.getDefault().getMultiProviderPlaylistProvider(); } else { ProviderIdentifier identifier; if (mSong != null) { identifier = mSong.getProvider(); } else if (mAlbum != null) { identifier = mAlbum.getProvider(); } else if (mPlaylist != null) { identifier = mPlaylist.getProvider(); } else { throw new IllegalStateException( "Song, Album and Playlist are all null, cannot determine provider!"); } connection = PluginsLookup.getDefault().getProvider(identifier); } IMusicProvider binder = connection.getBinder(); String playlistRef = binder.addPlaylist(playlistName.getText().toString()); if (playlistRef != null) { if (mSong != null) { binder.addSongToPlaylist(mSong.getRef(), playlistRef, mSong.getProvider()); } else if (mAlbum != null) { Iterator<String> songs = mAlbum.songs(); while (songs.hasNext()) { binder.addSongToPlaylist(songs.next(), playlistRef, mAlbum.getProvider()); } } else if (mPlaylist != null) { Iterator<String> songs = mPlaylist.songs(); while (songs.hasNext()) { // TODO: This might cause issues if we add a playlist // from a multi-provider playlist to another one binder.addSongToPlaylist(songs.next(), playlistRef, mPlaylist.getProvider()); } } } else { throw new IllegalStateException("Playlist reference returned by the provider is null!"); } } catch (Exception e) { Log.e(TAG, "Unable to add playlist", e); Toast.makeText(getActivity(), getString(R.string.toast_playlist_track_add_error, playlistNameStr), Toast.LENGTH_SHORT).show(); } } else { Utils.shortToast(getActivity(), R.string.enter_name); } } }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).setTitle(getString(R.string.new_playlist)); return builder.create(); }
From source file:com.example.mysteryhunt.UserActivity.java
private void showAttributes() { final UserAttributesAdapter attributesAdapter = new UserAttributesAdapter(getApplicationContext()); final ListView attributesListView; attributesListView = (ListView) findViewById(R.id.listViewUserAttributes); attributesListView.setAdapter(attributesAdapter); attributesList = attributesListView; attributesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override//from w w w . j a v a2 s . co m public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TextView data = (TextView) view.findViewById(R.id.editTextUserDetailInput); String attributeType = data.getHint().toString(); String attributeValue = data.getText().toString(); showUserDetail(attributeType, attributeValue); } }); }
From source file:ablgroup.daily2.authentification.AuthentificationFragment.java
@Override public void onClick(View v) { RelativeLayout r = (RelativeLayout) findViewById(R.id.login_first); RelativeLayout r2 = (RelativeLayout) findViewById(R.id.email_password_fields); RelativeLayout r3 = (RelativeLayout) findViewById(R.id.login_retrieve); switch (v.getId()) { case R.id.sign_up: createAccount(mEmailField.getText().toString(), mPasswordField.getText().toString()); break;/*from w w w . j a v a 2 s . c o m*/ case R.id.sign_in: signIn(mEmailField.getText().toString(), mPasswordField.getText().toString()); break; case R.id.log_out: signOut(); case R.id.sign_in_button_google: signIn(); break; case R.id.login_email_btn: r.setVisibility(View.INVISIBLE); r2.setVisibility(View.VISIBLE); r3.setVisibility(View.INVISIBLE); break; case R.id.login_comeback_btn: r.setVisibility(View.VISIBLE); r2.setVisibility(View.INVISIBLE); r3.setVisibility(View.INVISIBLE); break; case R.id.login_retrieve_comeback_btn: r.setVisibility(View.VISIBLE); r2.setVisibility(View.INVISIBLE); r3.setVisibility(View.INVISIBLE); break; case R.id.login_retrieve_btn: final TextView t = (TextView) findViewById(R.id.login_retrieve_email); final TextView t2 = (TextView) findViewById(R.id.login_retrieve_confirmation); final TextView btn = (Button) findViewById(R.id.login_retrieve_btn); String emailAddress = t.getText().toString(); mAuth.sendPasswordResetEmail(emailAddress).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "Email sent."); t.setVisibility(View.INVISIBLE); t2.setVisibility(View.VISIBLE); btn.setVisibility(View.INVISIBLE); } } }); break; case R.id.login_retrieve_view: r.setVisibility(View.INVISIBLE); r2.setVisibility(View.INVISIBLE); r3.setVisibility(View.VISIBLE); break; } }
From source file:cc.mintcoin.wallet.ui.EditAddressBookEntryFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bundle args = getArguments(); final String address = args.getString(KEY_ADDRESS); final String suggestedAddressLabel = args.getString(KEY_SUGGESTED_ADDRESS_LABEL); final LayoutInflater inflater = LayoutInflater.from(activity); final Uri uri = AddressBookProvider.contentUri(activity.getPackageName()).buildUpon().appendPath(address) .build();/*from w w w . j a va 2 s. co m*/ final String label = AddressBookProvider.resolveLabel(activity, address); final boolean isAdd = label == null; final DialogBuilder dialog = new DialogBuilder(activity); dialog.setTitle(isAdd ? R.string.edit_address_book_entry_dialog_title_add : R.string.edit_address_book_entry_dialog_title_edit); final View view = inflater.inflate(R.layout.edit_address_book_entry_dialog, null); final TextView viewAddress = (TextView) view.findViewById(R.id.edit_address_book_entry_address); viewAddress.setText(WalletUtils.formatHash(address, Constants.ADDRESS_FORMAT_GROUP_SIZE, Constants.ADDRESS_FORMAT_LINE_SIZE)); final TextView viewLabel = (TextView) view.findViewById(R.id.edit_address_book_entry_label); viewLabel.setText(label != null ? label : suggestedAddressLabel); dialog.setView(view); final DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { if (which == DialogInterface.BUTTON_POSITIVE) { final String newLabel = viewLabel.getText().toString().trim(); if (!newLabel.isEmpty()) { final ContentValues values = new ContentValues(); values.put(AddressBookProvider.KEY_LABEL, newLabel); if (isAdd) contentResolver.insert(uri, values); else contentResolver.update(uri, values, null, null); } else if (!isAdd) { contentResolver.delete(uri, null, null); } } else if (which == DialogInterface.BUTTON_NEUTRAL) { contentResolver.delete(uri, null, null); } dismiss(); } }; dialog.setPositiveButton(isAdd ? R.string.button_add : R.string.edit_address_book_entry_dialog_button_edit, onClickListener); if (!isAdd) dialog.setNeutralButton(R.string.button_delete, onClickListener); dialog.setNegativeButton(R.string.button_cancel, onClickListener); return dialog.create(); }
From source file:com.coinomi.wallet.ui.EditAddressBookEntryFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bundle args = getArguments(); final CoinType type = CoinID.typeFromId(args.getString(KEY_COIN_ID)); final AbstractAddress address = (AbstractAddress) args.getSerializable(KEY_ADDRESS); final String suggestedAddressLabel = args.getString(KEY_SUGGESTED_ADDRESS_LABEL); final LayoutInflater inflater = LayoutInflater.from(context); final Uri uri = AddressBookProvider.contentUri(context.getPackageName(), type).buildUpon() .appendPath(address.toString()).build(); final String label = AddressBookProvider.resolveLabel(context, address); final boolean isAdd = label == null; final DialogBuilder dialog = new DialogBuilder(context); final View view = inflater.inflate(R.layout.edit_address_book_entry_dialog, null); final TextView viewAddress = (TextView) view.findViewById(R.id.edit_address_book_entry_address); viewAddress.setText(GenericUtils.addressSplitToGroups(address)); final TextView viewLabel = (TextView) view.findViewById(R.id.edit_address_book_entry_label); viewLabel.setText(label != null ? label : suggestedAddressLabel); dialog.setView(view);/*from w w w. j ava2s . co m*/ final DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { if (which == DialogInterface.BUTTON_POSITIVE) { final String newLabel = viewLabel.getText().toString().trim(); if (!newLabel.isEmpty()) { final ContentValues values = new ContentValues(); values.put(AddressBookProvider.KEY_LABEL, newLabel); if (isAdd) contentResolver.insert(uri, values); else contentResolver.update(uri, values, null, null); } else if (!isAdd) { contentResolver.delete(uri, null, null); } } else if (which == DialogInterface.BUTTON_NEUTRAL) { contentResolver.delete(uri, null, null); } dismiss(); } }; dialog.setPositiveButton(R.string.button_save, onClickListener); if (!isAdd) dialog.setNeutralButton(R.string.button_delete, onClickListener); dialog.setNegativeButton(R.string.button_cancel, onClickListener); return dialog.create(); }
From source file:com.fastbootmobile.encore.app.fragments.ListenNowFragment.java
private void setupHeader(ParallaxScrollListView listView) { LayoutInflater inflater = LayoutInflater.from(listView.getContext()); mHeaderView = inflater.inflate(R.layout.header_listen_now, listView, false); mCardSearchBox = (CardView) mHeaderView.findViewById(R.id.cardSearchBox); mSearchBox = (EditText) mHeaderView.findViewById(R.id.ebSearch); mSearchBox.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override//from ww w . j a v a 2s . c om public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { final String query = v.getText().toString(); Intent intent = new Intent(getActivity(), SearchActivity.class); intent.setAction(Intent.ACTION_SEARCH); intent.putExtra(SearchManager.QUERY, query); v.getContext().startActivity(intent); // Clear the box once searched v.setText(null); return true; } }); listView.addParallaxedHeaderView(mHeaderView); }
From source file:com.aikidonord.Accueil.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_aikido_nord); ActionBar actionBar = this.getSupportActionBar(); actionBar.setTitle(getResources().getString(R.string.app_name)); // on complte le label TextView label_saison = (TextView) findViewById(R.id.tv_label_saison); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); // on prend arbitrairement le 30 juillet comme date de fin de saison String intitule = ""; if (cal.get(Calendar.MONTH) > 7) { intitule += cal.get(Calendar.YEAR) + " - " + String.valueOf(cal.get(Calendar.YEAR) + 1); } else {//from w w w.ja v a 2s . c om intitule += String.valueOf(cal.get(Calendar.YEAR) - 1) + " - " + cal.get(Calendar.YEAR); } label_saison.setText(label_saison.getText() + " " + intitule); }
From source file:com.nbos.phonebook.sync.authenticator.AuthenticatorActivity.java
public void loggedIntoExistingFbAccount(View v) { TextView fbUsername = (TextView) textEntryView.findViewById(R.id.facebookLogin_email); TextView fbPassword = (TextView) textEntryView.findViewById(R.id.facebookLogin_password); String userName = fbUsername.getText().toString(), password = fbPassword.getText().toString(); mUsername = userName;/* w ww . j a v a 2s .c o m*/ mPassword = password; showProgress(); // Start authenticating... mAuthThread = Net.attemptAuth(mUsername, mPassword, countryCode + mPhone, mHandler, AuthenticatorActivity.this); }
From source file:br.com.bioscada.apps.biotracks.fragments.ChooseActivityTypeDialogFragment.java
public static Dialog getDialog(final Activity activity, final String category, final ChooseActivityTypeCaller caller) { View view = activity.getLayoutInflater().inflate(R.layout.choose_activity_type, null); GridView gridView = (GridView) view.findViewById(R.id.choose_activity_type_grid_view); final View weightContainer = view.findViewById(R.id.choose_activity_type_weight_container); TextView weightLabel = (TextView) view.findViewById(R.id.choose_activity_type_weight_label); weightLabel.setText(PreferencesUtils.isMetricUnits(activity) ? R.string.description_weight_metric : R.string.description_weight_imperial); final TextView weight = (TextView) view.findViewById(R.id.choose_activity_type_weight); List<Integer> imageIds = new ArrayList<Integer>(); for (String iconValue : TrackIconUtils.getAllIconValues()) { imageIds.add(TrackIconUtils.getIconDrawable(iconValue)); }/*from w w w. jav a 2 s . co m*/ Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(activity.getResources(), R.drawable.ic_track_airplane, options); int padding = 32; int width = options.outWidth + 2 * padding; int height = options.outHeight + 2 * padding; gridView.setColumnWidth(width); final ChooseActivityTypeImageAdapter imageAdapter = new ChooseActivityTypeImageAdapter(activity, imageIds, width, height, padding); gridView.setAdapter(imageAdapter); final String weightValue = StringUtils.formatWeight(PreferencesUtils.getWeightDisplayValue(activity)); final AlertDialog alertDialog = new AlertDialog.Builder(activity) .setNegativeButton(R.string.generic_cancel, null) .setPositiveButton(R.string.generic_ok, new Dialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { boolean newWeight = false; if (weightContainer.getVisibility() == View.VISIBLE) { String newValue = weight.getText().toString(); if (!newValue.equals(weightValue)) { newWeight = true; PreferencesUtils.storeWeightValue(activity, newValue); } } int selected = imageAdapter.getSelected(); caller.onChooseActivityTypeDone(TrackIconUtils.getAllIconValues().get(selected), newWeight); } }).setTitle(R.string.track_edit_activity_type_hint).setView(view).create(); alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { int position = getPosition(activity, category); alertDialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(position != -1); if (position != -1) { imageAdapter.setSelected(position); imageAdapter.notifyDataSetChanged(); } updateWeightContainer(weightContainer, position); weight.setText(weightValue); DialogUtils.setDialogTitleDivider(activity, alertDialog); } }); gridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { alertDialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(true); imageAdapter.setSelected(position); imageAdapter.notifyDataSetChanged(); updateWeightContainer(weightContainer, position); } }); return alertDialog; }
From source file:com.grarak.kerneladiutor.fragments.kernel.CPUVoltageFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.global_offset: View view = inflater.inflate(R.layout.global_offset_view, container, false); final TextView textView = (TextView) view.findViewById(R.id.offset_text); textView.setText("0"); AppCompatButton minus = (AppCompatButton) view.findViewById(R.id.button_minus); minus.setOnClickListener(new View.OnClickListener() { @Override//from w w w .ja va2s . c om public void onClick(View v) { try { textView.setText(String.valueOf(Utils.stringToInt(textView.getText().toString()) - 5)); } catch (NumberFormatException e) { textView.setText("0"); } } }); AppCompatButton plus = (AppCompatButton) view.findViewById(R.id.button_plus); plus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { textView.setText(String.valueOf(Utils.stringToInt(textView.getText().toString()) + 5)); } catch (NumberFormatException e) { textView.setText("0"); } } }); if (Utils.DARKTHEME) { textView.setTextColor(ContextCompat.getColor(getActivity(), R.color.textcolor_dark)); minus.setTextColor(ContextCompat.getColor(getActivity(), R.color.textcolor_dark)); plus.setTextColor(ContextCompat.getColor(getActivity(), R.color.textcolor_dark)); } new AlertDialog.Builder(getActivity(), (Utils.DARKTHEME ? R.style.AlertDialogStyleDark : R.style.AlertDialogStyleLight)).setView(view) .setTitle(getString(R.string.global_offset)) .setMessage(getString(R.string.global_offset_summary)) .setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { CPUVoltage.setGlobalOffset(textView.getText().toString(), getActivity()); refresh(); } }).show(); break; } return super.onOptionsItemSelected(item); }