List of usage examples for android.os Bundle getCharSequence
@Override
@Nullable
public CharSequence getCharSequence(@Nullable String key)
From source file:fr.android.earthdawn.activities.CharacterSheetActivity.java
@Override protected void onPrepareDialog(final int id, final Dialog dialog, final Bundle args) { final AlertDialog alert = (AlertDialog) dialog; switch (id) { case Constants.DIALOG_SHOW_DETAILS: alert.setTitle(getString(R.string.roller_popup_title2, getString(EDDicesLauncher.getRollType()))); alert.setMessage(EDDicesLauncher.getDetailedMessage(this)); break;/*from w w w . j a v a 2s. c o m*/ case Constants.DIALOG_SHOW_DAMAGES_TAKEN: alert.setTitle(R.string.popup_damages_taken_title); alert.setMessage(getString(R.string.popup_damages_taken_msg, args.getCharSequence(Constants.BUNDLE_DMG_TAKEN_ARM), Integer.toString(args.getInt(Constants.BUNDLE_DMG_TAKEN_PV)), Integer.toString(args.getInt(Constants.BUNDLE_DMG_TAKEN_WOUND)))); break; default: break; } super.onPrepareDialog(id, dialog, args); }
From source file:fr.android.earthdawn.activities.CharacterSheetActivity.java
@Override protected Dialog onCreateDialog(final int id, final Bundle args) { final Builder builder = new AlertDialog.Builder(this); switch (id) { case Constants.DIALOG_SHOW_DETAILS: builder.setTitle(getString(R.string.roller_popup_title2, getString(EDDicesLauncher.getRollType()))); builder.setMessage(EDDicesLauncher.getDetailedMessage(this)); break;/* ww w.j a va 2s . com*/ case Constants.DIALOG_SHOW_DAMAGES_TAKEN: builder.setTitle(R.string.popup_damages_taken_title); builder.setMessage(getString(R.string.popup_damages_taken_msg, args.getCharSequence(Constants.BUNDLE_DMG_TAKEN_ARM), Integer.toString(args.getInt(Constants.BUNDLE_DMG_TAKEN_PV)), Integer.toString(args.getInt(Constants.BUNDLE_DMG_TAKEN_WOUND)))); break; default: break; } builder.setIcon(android.R.drawable.ic_dialog_info); builder.setNeutralButton(R.string.button_close, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int whichButton) { dialog.dismiss(); } }); return builder.create(); }
From source file:fr.shywim.antoinedaniel.ui.fragment.VideoListFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { String[] projection = { ProviderContract.SoundEntry._ID, ProviderContract.VideosEntry.COLUMN_NAME_VIDEO_ID, ProviderContract.VideosEntry.COLUMN_NAME_DESC, ProviderContract.VideosEntry.COLUMN_NAME_PAGE, ProviderContract.VideosEntry.COLUMN_NAME_TIMESTAMP }; Uri uri = ProviderConstants.VIDEOS_URI; String where = null;/*from w ww . ja va2 s. c om*/ if (args != null) { where = ProviderContract.VideosEntry.COLUMN_NAME_PAGE + "=\"" + args.getCharSequence(ARG_LOADER_WHERE).toString() + '"'; } return new CursorLoader(mContext, uri, projection, where, null, ProviderContract.VideosEntry.COLUMN_NAME_TIMESTAMP + " DESC"); }
From source file:com.silentcircle.silenttext.activity.AccountCreationActivity.java
@Override public void onFinish(final Bundle arguments) { if (!tasks.isEmpty()) { return;/*from ww w . ja va 2s . c o m*/ } tasks.add(AsyncUtils.execute(new AsyncTask<Void, Void, UsernamePasswordCredential>() { @Override protected UsernamePasswordCredential doInBackground(Void... params) { UserManager manager = SilentTextApplication.from(getActivity()).getUserManager(); BasicUser user = new BasicUser(); user.setFirstName(arguments.getCharSequence(AccountCreationFragment.EXTRA_FIRST_NAME)); user.setLastName(arguments.getCharSequence(AccountCreationFragment.EXTRA_LAST_NAME)); user.setEmailAddress(arguments.getCharSequence(AccountCreationFragment.EXTRA_EMAIL)); CharSequence username = arguments.getCharSequence(AccountCreationFragment.EXTRA_USERNAME); CharSequence password = arguments.getCharSequence(AccountCreationFragment.EXTRA_PASSWORD); CharSequence licenseCode = arguments.getCharSequence(AccountCreationFragment.EXTRA_LICENSE_CODE); try { UsernamePasswordCredential credential = new UsernamePasswordCredential(username, password); manager.createUser(credential, user, licenseCode); return credential; } catch (HTTPException e) { onError(e); } catch (Throwable t) { onError(t); } return null; } protected void onError(HTTPException e) { try { String errorString = new String(); JSONObject errorJSON = new JSONObject(e.getBody()); if (errorJSON.has("error_fields")) { JSONObject errorFieldsJSON = errorJSON.getJSONObject("error_fields"); if (errorFieldsJSON.length() > 0) { if (errorFieldsJSON.has("license_code")) { errorString = errorFieldsJSON.getJSONObject("license_code").getString("error_msg"); } else { if (!StringUtils.isEmpty( JSONObjectParser.parseFault(JSONParser.parse(e.getBody())).getFields()[0] .getMessage())) { errorString = JSONObjectParser.parseFault(JSONParser.parse(e.getBody())) .getFields()[0].getMessage().toString(); } } } else { if (!StringUtils.isEmpty(errorJSON.getString("error_msg"))) { errorString = errorJSON.getString("error_msg"); } } } AccountCreationActivity.this.onError(errorString); } catch (Throwable t) { t.printStackTrace(); } } protected void onError(Throwable t) { AccountCreationActivity.this.onError(t.getLocalizedMessage()); } @Override protected void onPostExecute(UsernamePasswordCredential credential) { tasks.clear(); if (credential != null) { activate(credential); credential.burn(); } } @Override protected void onPreExecute() { Toast.makeText(getActivity(), getString(R.string.creating_account), Toast.LENGTH_LONG).show(); } })); }
From source file:android.support.car.ui.CarNavExtender.java
/** * Reconstruct a CarNavExtender from an existing notification. Can be used to retrieve values. * * @param notification The notification to retrieve the values from. *//*from ww w .j av a 2 s.c o m*/ public CarNavExtender(@NonNull Notification notification) { Bundle extras = NotificationCompat.getExtras(notification); if (extras == null) { return; } Bundle b = extras.getBundle(EXTRA_CAR_EXTENDER); if (b == null) { return; } mIsExtended = b.getBoolean(EXTRA_IS_EXTENDED); mContentId = (Long) b.getSerializable(EXTRA_CONTENT_ID); // The ternary guarantees that we return either TYPE_HERO or TYPE_NORMAL. mType = (b.getInt(EXTRA_TYPE, TYPE_NORMAL) == TYPE_HERO) ? TYPE_HERO : TYPE_NORMAL; mContentTitle = b.getCharSequence(Notification.EXTRA_TITLE); mContentText = b.getCharSequence(Notification.EXTRA_TEXT); mSubText = b.getCharSequence(EXTRA_SUB_TEXT); mLargeIcon = b.getParcelable(Notification.EXTRA_LARGE_ICON); mActionIcon = b.getInt(EXTRA_ACTION_ICON); mContentIntent = b.getParcelable(EXTRA_CONTENT_INTENT); mColor = b.getInt(EXTRA_COLOR, Notification.COLOR_DEFAULT); mNightColor = b.getInt(EXTRA_NIGHT_COLOR, Notification.COLOR_DEFAULT); mShowInStream = b.getBoolean(EXTRA_STREAM_VISIBILITY, true); mShowAsHeadsUp = b.getBoolean(EXTRA_HEADS_UP_VISIBILITY); mIgnoreInStream = b.getBoolean(EXTRA_IGNORE_IN_STREAM); }
From source file:org.onebusaway.android.report.ui.ReportStopProblemFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { // The code spinner mCodeView = (Spinner) view.findViewById(R.id.report_problem_code); ArrayAdapter<?> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.report_stop_problem_code, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mCodeView.setAdapter(adapter);/*from w w w. j av a 2 s .c om*/ // Comment mUserComment = (TextView) view.findViewById(R.id.report_problem_comment); if (savedInstanceState != null) { int position = savedInstanceState.getInt(CODE); mCodeView.setSelection(position); CharSequence comment = savedInstanceState.getCharSequence(USER_COMMENT); mUserComment.setText(comment); } SPINNER_TO_CODE = new String[] { null, ObaReportProblemWithStopRequest.NAME_WRONG, ObaReportProblemWithStopRequest.NUMBER_WRONG, ObaReportProblemWithStopRequest.LOCATION_WRONG, ObaReportProblemWithStopRequest.ROUTE_OR_TRIP_MISSING, ObaReportProblemWithStopRequest.OTHER }; // Dynamically change the color of the small icons setupIconColors(); }
From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java
private void setNeutralButton(AlertDialog.Builder builder) { final Bundle args = getArguments(); final CharSequence naturalButtonText = args.getCharSequence(NEUTRAL_BUTTON); if (naturalButtonText == null) { return;//from www . jav a 2 s .c o m } final boolean useOnNeutralClickListener = args.getBoolean(NEUTRAL_CLICK_LISTENER); builder.setNeutralButton(naturalButtonText, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (useOnNeutralClickListener) { bindClickListener(which); } } }); }
From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java
private void setPositiveButton(AlertDialog.Builder builder) { final Bundle args = getArguments(); final CharSequence positiveButtonText = args.getCharSequence(POSITIVE_BUTTON); if (positiveButtonText == null) { return;/*from w w w .ja v a2 s.com*/ } final boolean useOnPositiveClickListener = args.getBoolean(POSITIVE_CLICK_LISTENER); builder.setPositiveButton(positiveButtonText, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (useOnPositiveClickListener) { bindClickListener(which); } } }); }
From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java
private void setNegativeButton(AlertDialog.Builder builder) { final Bundle args = getArguments(); final CharSequence negativeButtonText = args.getCharSequence(NEGATIVE_BUTTON); if (negativeButtonText == null) { return;//from ww w . ja v a2 s .co m } final boolean useOnNegativeClickListener = args.getBoolean(NEGATIVE_CLICK_LISTENER); builder.setNegativeButton(negativeButtonText, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (useOnNegativeClickListener) { bindClickListener(which); } } }); }
From source file:com.jefftharris.passwdsafe.FileListActivity.java
/** * View files/*www . ja v a 2 s .com*/ */ private void showFiles(boolean initial, Bundle savedState) { itsIsLegacyChooserChanged = false; if (savedState == null) { Fragment filesFrag; if (itsIsLegacyChooser) { filesFrag = new FileListFragment(); } else { filesFrag = new StorageFileListFragment(); } doChangeView(initial ? ChangeMode.VIEW_FILES_INIT : ChangeMode.VIEW_FILES, filesFrag, new SyncProviderFragment()); } else { itsTitle = savedState.getCharSequence(STATE_TITLE); } itsPermissionMgr.checkPerms(); }