List of usage examples for android.os Bundle putBoolean
public void putBoolean(@Nullable String key, boolean value)
From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java
private void showLoadOccupancyGridDialog(boolean firstTry, java.util.ArrayList<java.lang.String> nameList) { FragmentManager manager = getFragmentManager(); LoadOccupancyGridDialog loadOccupancyGridDialog = new LoadOccupancyGridDialog(); Bundle bundle = new Bundle(); bundle.putBoolean(getString(R.string.show_load_occupancy_grid_empty_key), nameList.isEmpty()); bundle.putBoolean(getString(R.string.show_load_occupancy_grid_error_key), !firstTry); bundle.putStringArrayList(getString(R.string.list_names_occupancy_grid_key), nameList); loadOccupancyGridDialog.setArguments(bundle); loadOccupancyGridDialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.CustomDialog); loadOccupancyGridDialog.show(manager, "LoadOccupancyGridDialog"); }
From source file:app.hacked.MainActivity.java
/** * Defines what we do when a schedule item is clicked. * * @param SchItem The selected schedule item *///from w w w. j a va2 s .co m @Override public void onScheduleItemSelected(ScheduleItem SchItem) { if (findViewById(R.id.ScheduleDetails) != null) { mTwoPane = true; //((ScheduleListFragment) getSupportFragmentManager().findFragmentById(R.id.pager)).setActivateOnItemClick(true); Bundle arguments = new Bundle(); arguments.putString(ScheduleItemDetailFragment.SCHEDULETITLE, SchItem.Title); arguments.putString(ScheduleItemDetailFragment.SCHEDULEID, SchItem.ID); arguments.putString(ScheduleItemDetailFragment.SCHEDULEFULLDATAHTML, SchItem.fullDetails); arguments.putString(ScheduleItemDetailFragment.SCHEDULESTARTTIME, SchItem.StartDate); arguments.putString(ScheduleItemDetailFragment.SCHEDULEDESC, SchItem.itemDesc); arguments.putBoolean(ScheduleItemDetailFragment.ISDAYTITLE, SchItem.isDay); arguments.putString(ScheduleItemDetailFragment.SCHEDULEENDTIME, SchItem.EndDate); arguments.putBoolean(ScheduleItemDetailFragment.ARG_2PANE, true); ScheduleItemDetailFragment fragment = new ScheduleItemDetailFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction().replace(R.id.ScheduleDetails, fragment).commit(); } else { mTwoPane = false; Intent detailIntent = new Intent(this, ScheduleListItemDetailActivity.class); detailIntent.putExtra(ScheduleItemDetailFragment.SCHEDULETITLE, SchItem.Title); detailIntent.putExtra(ScheduleItemDetailFragment.SCHEDULEID, SchItem.ID); detailIntent.putExtra(ScheduleItemDetailFragment.SCHEDULEFULLDATAHTML, SchItem.fullDetails); detailIntent.putExtra(ScheduleItemDetailFragment.SCHEDULESTARTTIME, SchItem.StartDate); detailIntent.putExtra(ScheduleItemDetailFragment.SCHEDULEDESC, SchItem.itemDesc); detailIntent.putExtra(ScheduleItemDetailFragment.ISDAYTITLE, SchItem.isDay); detailIntent.putExtra(ScheduleItemDetailFragment.SCHEDULEENDTIME, SchItem.EndDate); detailIntent.putExtra(ScheduleItemDetailFragment.ARG_2PANE, true); startActivity(detailIntent); } }
From source file:com.dwdesign.tweetings.fragment.BaseStatusesListFragment.java
@Override public boolean onMenuItemClick(final MenuItem item) { final ParcelableStatus status = mSelectedStatus; if (status == null) return false; final long account_id = getDefaultAccountId(mApplication); switch (item.getItemId()) { case MENU_VIEW: { openStatus(getActivity(), status); break;//w w w . j av a 2 s. c om } case MENU_SHARE: { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, "@" + status.screen_name + ": " + status.text_plain); startActivity(Intent.createChooser(intent, getString(R.string.share))); break; } case MENU_TRANSLATE: { translate(status); break; } case MENU_RETWEET: { if (isMyRetweet(status)) { mService.destroyStatus(status.account_id, status.status_id); } else { final long id_to_retweet = mSelectedStatus.is_retweet && mSelectedStatus.retweet_id > 0 ? mSelectedStatus.retweet_id : mSelectedStatus.status_id; mService.retweetStatus(status.account_id, id_to_retweet); } break; } case MENU_QUOTE: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id); bundle.putBoolean(INTENT_KEY_IS_QUOTE, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_QUOTE_REPLY: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id); bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, status.status_id); bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, status.screen_name); bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, status.name); bundle.putBoolean(INTENT_KEY_IS_QUOTE, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_ADD_TO_BUFFER: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id); bundle.putBoolean(INTENT_KEY_IS_BUFFER, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_REPLY: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); final List<String> mentions = new Extractor().extractMentionedScreennames(status.text_plain); mentions.remove(status.screen_name); mentions.add(0, status.screen_name); bundle.putStringArray(INTENT_KEY_MENTIONS, mentions.toArray(new String[mentions.size()])); bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id); bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, status.status_id); bundle.putString(INTENT_KEY_IN_REPLY_TO_TWEET, status.text_plain); bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, status.screen_name); bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, status.name); intent.putExtras(bundle); startActivity(intent); break; } case MENU_FAV: { if (mSelectedStatus.is_favorite) { mService.destroyFavorite(status.account_id, status.status_id); } else { mService.createFavorite(status.account_id, status.status_id); } break; } case MENU_CONVERSATION: { openConversation(getActivity(), status.account_id, status.status_id); break; } case MENU_DELETE: { mService.destroyStatus(status.account_id, status.status_id); break; } case MENU_EXTENSIONS: { final Intent intent = new Intent(INTENT_ACTION_EXTENSION_OPEN_STATUS); final Bundle extras = new Bundle(); extras.putParcelable(INTENT_KEY_STATUS, status); intent.putExtras(extras); startActivity(Intent.createChooser(intent, getString(R.string.open_with_extensions))); break; } case MENU_MULTI_SELECT: { if (!mApplication.isMultiSelectActive()) { mApplication.startMultiSelect(); } final NoDuplicatesLinkedList<Object> list = mApplication.getSelectedItems(); if (!list.contains(status)) { list.add(status); } break; } case MENU_BLOCK: { mService.createBlock(account_id, status.user_id); break; } case MENU_REPORT_SPAM: { mService.reportSpam(account_id, status.user_id); break; } case MENU_MUTE_USER: { final String screen_name = status.screen_name; final Uri uri = Filters.Users.CONTENT_URI; final ContentValues values = new ContentValues(); final SharedPreferences.Editor editor = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).edit(); final ContentResolver resolver = getContentResolver(); values.put(Filters.Users.TEXT, screen_name); resolver.delete(uri, Filters.Users.TEXT + " = '" + screen_name + "'", null); resolver.insert(uri, values); editor.putBoolean(PREFERENCE_KEY_ENABLE_FILTER, true).commit(); Toast.makeText(getActivity(), R.string.user_muted, Toast.LENGTH_SHORT).show(); break; } case MENU_MAKE_GAP: { Uri uri = Statuses.CONTENT_URI; final Uri query_uri = buildQueryUri(uri, false); ContentResolver mResolver = getContentResolver(); final ContentValues values = new ContentValues(); values.put(Statuses.IS_GAP, 1); final StringBuilder where = new StringBuilder(); where.append(Statuses.ACCOUNT_ID + "=" + account_id); where.append(" AND " + Statuses.STATUS_ID + "=" + status.status_id); mResolver.update(query_uri, values, where.toString(), null); getActivity().sendBroadcast(new Intent(BROADCAST_FILTERS_UPDATED).putExtra(INTENT_KEY_SUCCEED, true)); break; } case MENU_COPY: { final CharSequence text = Html.fromHtml(status.text_html); if (ClipboardUtils.setText(getActivity(), text)) { Toast.makeText(getActivity(), R.string.text_copied, Toast.LENGTH_SHORT).show(); } break; } } return true; }
From source file:de.sourcestream.movieDB.controller.TVList.java
/** * Called to ask the fragment to save its current dynamic state, * so it can later be reconstructed in a new instance of its process is restarted. * * @param outState Bundle in which to place your saved state. *///from ww w. j ava 2s . c om @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Used to avoid bug where we add item in the back stack // and if we change orientation twice the item from the back stack has null values if (save != null) outState.putBundle("save", save); else { Bundle send = new Bundle(); send.putInt("checkLoadMore", checkLoadMore); send.putInt("totalPages", totalPages); send.putString("currentListURL", getCurrentList()); send.putString("title", getTitle()); send.putBoolean("isLoading", isLoading); send.putInt("lastVisitedTV", lastVisitedTV); if (backState == 1) { send.putInt("backState", 1); send.putParcelableArrayList("listData", tvList); // used to restore the scroll listener variables send.putInt("currentPage", endlessScrollListener.getCurrentPage()); send.putInt("oldCount", endlessScrollListener.getOldCount()); send.putBoolean("loading", endlessScrollListener.getLoading()); // Save scroll position if (listView != null) { Parcelable listState = listView.onSaveInstanceState(); send.putParcelable("listViewScroll", listState); } } else send.putInt("backState", 0); outState.putBundle("save", send); } }
From source file:de.ub0r.android.wifibarcode.WifiBarcodeActivity.java
/** * {@inheritDoc}/* w w w .java2 s . com*/ */ @Override protected void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(EXTRA_GOT_ROOT, gotRoot); outState.putBoolean("mFirstLoad", mFirstLoad); }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.ThreadViewFragment.java
/** * Set up and launch the postCommentFragment when the user wishes to reply * to a comment. The fragment takes as input the index of the thread and the * comment object to reply to./*from w w w. jav a2 s . c o m*/ * * @param comment The Comment being replied to. * @param threadIndex The index of the ThreadComment where the reply is taking place. */ public void replyToComment(Comment comment, int threadIndex) { Fragment fragment = new PostFragment(); Bundle bundle = new Bundle(); bundle.putParcelable("cmt", comment); bundle.putLong("id", threadIndex); fragment.setArguments(bundle); boolean fromFavs = false; Fragment fav = getFragmentManager().findFragmentByTag("favThrFragment"); if (fav != null) { fromFavs = true; } bundle.putBoolean("fromFavs", fromFavs); getFragmentManager().beginTransaction().replace(container, fragment, "postFrag").addToBackStack(null) .commit(); getFragmentManager().executePendingTransactions(); }
From source file:cn.tycoon.lighttrans.fileManager.AbstractFilePickerFragment.java
/** * Set before making the fragment visible. This method will re-use the existing * arguments bundle in the fragment if it exists so extra arguments will not * be overwritten. This allows you to set any extra arguments in the fragment * constructor if you wish./* ww w. j av a 2s. c o m*/ * <p/> * The key/value-pairs listed below will be overwritten however. * * @param startPath path to directory the picker will show upon start * @param mode what is allowed to be selected (dirs, files, both) * @param allowMultiple selecting a single item or several? * @param allowDirCreate can new directories be created? */ public void setArgs(final String startPath, final int mode, final boolean allowMultiple, final boolean allowDirCreate) { // There might have been arguments set elsewhere, if so do not overwrite them. Bundle b = getArguments(); if (b == null) { b = new Bundle(); } if (startPath != null) { b.putString(KEY_START_PATH, startPath); } b.putBoolean(KEY_ALLOW_DIR_CREATE, allowDirCreate); b.putBoolean(KEY_ALLOW_MULTIPLE, allowMultiple); b.putInt(KEY_MODE, mode); setArguments(b); }
From source file:ca.uwaterloo.magic.goodhikes.MapsActivity.java
@Override public void onSaveInstanceState(Bundle outState) { if (selectedRoute != null) outState.putLong(RouteEntry._ID, selectedRoute.getId()); if (followingExistingRoute != false) outState.putBoolean("followingExistingRoute", followingExistingRoute); super.onSaveInstanceState(outState); }
From source file:com.plusub.lib.service.BaseRequestService.java
/** * ??//w w w . j a v a 2s.co m * <p>Title: transmitParams * <p>Description: * @param map * @return */ private Bundle transmitParams(Map map) { String keys; if (map != null && map.size() > 0) { Bundle bd = new Bundle(); for (Object key : map.keySet()) { //String if (key instanceof String) { keys = (String) key; // Object obj = map.get(key); if (obj instanceof String) { bd.putString(keys, (String) obj); } else if (obj instanceof Integer) { bd.putInt(keys, (Integer) obj); } else if (obj instanceof Boolean) { bd.putBoolean(keys, (Boolean) obj); } else if (obj instanceof Serializable) { bd.putSerializable(keys, (Serializable) obj); } else if (obj instanceof Character) { bd.putChar(keys, (Character) obj); } else if (obj instanceof Double) { bd.putDouble(keys, (Double) obj); } else if (obj instanceof Float) { bd.putFloat(keys, (Float) obj); } else { Logger.e("[MainService] : unknow map values type ! keys:" + keys); } } } return bd; } return null; }
From source file:no.nordicsemi.android.nrftoolbox.dfu.DfuActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(DATA_FILE_PATH, mFilePath); outState.putParcelable(DATA_FILE_STREAM, mFileStreamUri); outState.putBoolean(DATA_STATUS, mStatusOk); }