List of usage examples for android.os Bundle putSerializable
@Override public void putSerializable(@Nullable String key, @Nullable Serializable value)
From source file:co.taqat.call.LinphoneActivity.java
public void displayContact(LinphoneContact contact, boolean chatOnly) { Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2); if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CONTACT_DETAIL) { ContactDetailsFragment contactFragment = (ContactDetailsFragment) fragment2; contactFragment.changeDisplayedContact(contact); } else {/*from w w w . j a v a 2 s.c o m*/ Bundle extras = new Bundle(); extras.putSerializable("Contact", contact); extras.putBoolean("ChatAddressOnly", chatOnly); changeCurrentFragment(FragmentsAvailable.CONTACT_DETAIL, extras); } }
From source file:com.gelakinetic.mtgfam.fragments.CardViewFragment.java
/** * Inflates the view and saves references to UI elements for later filling * * @param savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given * here./*from w ww . jav a 2s.c o m*/ * @param inflater The LayoutInflater object that can be used to inflate any views in the fragment, * @param container If non-null, this is the parent view that the fragment's UI should be attached to. The * fragment should not add the view itself, but this can be used to generate the * LayoutParams of the view. * @return The inflated view */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { mActivity = ((FamiliarFragment) getParentFragment()).getFamiliarActivity(); } catch (NullPointerException e) { mActivity = getFamiliarActivity(); } View myFragmentView = inflater.inflate(R.layout.card_view_frag, container, false); assert myFragmentView != null; /* Because Android Studio */ mNameTextView = (TextView) myFragmentView.findViewById(R.id.name); mCostTextView = (TextView) myFragmentView.findViewById(R.id.cost); mTypeTextView = (TextView) myFragmentView.findViewById(R.id.type); mSetTextView = (TextView) myFragmentView.findViewById(R.id.set); mAbilityTextView = (TextView) myFragmentView.findViewById(R.id.ability); mFlavorTextView = (TextView) myFragmentView.findViewById(R.id.flavor); mArtistTextView = (TextView) myFragmentView.findViewById(R.id.artist); mNumberTextView = (TextView) myFragmentView.findViewById(R.id.number); mPowTouTextView = (TextView) myFragmentView.findViewById(R.id.pt); mTransformButtonDivider = myFragmentView.findViewById(R.id.transform_button_divider); mTransformButton = (Button) myFragmentView.findViewById(R.id.transformbutton); mTextScrollView = (ScrollView) myFragmentView.findViewById(R.id.cardTextScrollView); mImageScrollView = (ScrollView) myFragmentView.findViewById(R.id.cardImageScrollView); mCardImageView = (ImageView) myFragmentView.findViewById(R.id.cardpic); mColorIndicatorLayout = (LinearLayout) myFragmentView.findViewById(R.id.color_indicator_view); registerForContextMenu(mNameTextView); registerForContextMenu(mCostTextView); registerForContextMenu(mTypeTextView); registerForContextMenu(mSetTextView); registerForContextMenu(mAbilityTextView); registerForContextMenu(mPowTouTextView); registerForContextMenu(mFlavorTextView); registerForContextMenu(mArtistTextView); registerForContextMenu(mNumberTextView); mSetTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SearchCriteria setSearch = new SearchCriteria(); assert mSetTextView.getText() != null; setSearch.set = mSetTextView.getText().toString(); Bundle arguments = new Bundle(); arguments.putSerializable(SearchViewFragment.CRITERIA, setSearch); ResultListFragment rlFrag = new ResultListFragment(); startNewFragment(rlFrag, arguments); } }); mCardImageView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { if (mAsyncTask != null) { mAsyncTask.cancel(true); } mAsyncTask = new saveCardImageTask(); ((saveCardImageTask) mAsyncTask).execute(MAIN_PAGE); return true; } }); setInfoFromBundle(this.getArguments()); return myFragmentView; }
From source file:com.taw.gotothere.GoToThereActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { // Superclass handles map type, centre point of map and zoom level super.onSaveInstanceState(outState); Log.d(TAG, "onSaveInstanceState()"); GeoPoint pt = null;/* ww w .j a v a 2 s.co m*/ pt = navigationOverlay.getSelectedLocation(); if (pt != null) { outState.putInt(END_LAT_KEY, pt.getLatitudeE6()); outState.putInt(END_LONG_KEY, pt.getLongitudeE6()); } pt = navigationOverlay.getStartLocation(); if (pt != null) { outState.putInt(START_LAT_KEY, pt.getLatitudeE6()); outState.putInt(START_LONG_KEY, pt.getLongitudeE6()); } // Whether we're placing a marker to navigate to outState.putBoolean(PLACING_MARKER_KEY, placingMarker); // Whether we're navigating to a point outState.putBoolean(NAVIGATING_KEY, navigating); if (navigating) { outState.putSerializable(DIRECTIONS_KEY, navigationOverlay.getDirections()); } SharedPreferences.Editor edit = getPreferences(Activity.MODE_PRIVATE).edit(); edit.putString(PREVIOUS_QUERY, searchTextView.getText().toString()).commit(); }
From source file:com.borax12.materialdaterangepicker.single.date.DatePickerDialog.java
@Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(KEY_SELECTED_YEAR, mCalendar.get(Calendar.YEAR)); outState.putInt(KEY_SELECTED_MONTH, mCalendar.get(Calendar.MONTH)); outState.putInt(KEY_SELECTED_DAY, mCalendar.get(Calendar.DAY_OF_MONTH)); outState.putInt(KEY_WEEK_START, mWeekStart); outState.putInt(KEY_YEAR_START, mMinYear); outState.putInt(KEY_YEAR_END, mMaxYear); outState.putInt(KEY_CURRENT_VIEW, mCurrentView); int listPosition = -1; if (mCurrentView == MONTH_AND_DAY_VIEW) { listPosition = mDayPickerView.getMostVisiblePosition(); } else if (mCurrentView == YEAR_VIEW) { listPosition = mYearPickerView.getFirstVisiblePosition(); outState.putInt(KEY_LIST_POSITION_OFFSET, mYearPickerView.getFirstPositionOffset()); }//from w w w .j av a 2 s .com outState.putInt(KEY_LIST_POSITION, listPosition); outState.putSerializable(KEY_MIN_DATE, mMinDate); outState.putSerializable(KEY_MAX_DATE, mMaxDate); outState.putSerializable(KEY_HIGHLIGHTED_DAYS, highlightedDays); outState.putSerializable(KEY_SELECTABLE_DAYS, selectableDays); outState.putBoolean(KEY_THEME_DARK, mThemeDark); outState.putBoolean(KEY_THEME_DARK_CHANGED, mThemeDarkChanged); outState.putInt(KEY_ACCENT, mAccentColor); outState.putBoolean(KEY_VIBRATE, mVibrate); outState.putBoolean(KEY_DISMISS, mDismissOnPause); outState.putBoolean(KEY_AUTO_DISMISS, mAutoDismiss); outState.putInt(KEY_DEFAULT_VIEW, mDefaultView); outState.putString(KEY_TITLE, mTitle); outState.putInt(KEY_OK_RESID, mOkResid); outState.putString(KEY_OK_STRING, mOkString); outState.putInt(KEY_CANCEL_RESID, mCancelResid); outState.putString(KEY_CANCEL_STRING, mCancelString); }
From source file:com.customdatepicker.date.DatePickerDialog.java
@Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(KEY_SELECTED_YEAR, mCalendar.get(Calendar.YEAR)); outState.putInt(KEY_SELECTED_MONTH, mCalendar.get(Calendar.MONTH)); outState.putInt(KEY_SELECTED_DAY, mCalendar.get(Calendar.DAY_OF_MONTH)); outState.putInt(KEY_WEEK_START, mWeekStart); outState.putInt(KEY_CURRENT_VIEW, mCurrentView); int listPosition = -1; if (mCurrentView == MONTH_AND_DAY_VIEW) { listPosition = mDayPickerView.getMostVisiblePosition(); } else if (mCurrentView == YEAR_VIEW) { listPosition = mYearPickerView.getFirstVisiblePosition(); outState.putInt(KEY_LIST_POSITION_OFFSET, mYearPickerView.getFirstPositionOffset()); }/*w ww . ja v a 2 s . c o m*/ outState.putInt(KEY_LIST_POSITION, listPosition); outState.putSerializable(KEY_HIGHLIGHTED_DAYS, highlightedDays); outState.putBoolean(KEY_THEME_DARK, mThemeDark); outState.putBoolean(KEY_THEME_DARK_CHANGED, mThemeDarkChanged); outState.putInt(KEY_ACCENT, mAccentColor); outState.putBoolean(KEY_VIBRATE, mVibrate); outState.putBoolean(KEY_DISMISS, mDismissOnPause); outState.putBoolean(KEY_AUTO_DISMISS, mAutoDismiss); outState.putInt(KEY_DEFAULT_VIEW, mDefaultView); outState.putString(KEY_TITLE, mTitle); outState.putInt(KEY_OK_RESID, mOkResid); outState.putString(KEY_OK_STRING, mOkString); outState.putInt(KEY_OK_COLOR, mOkColor); outState.putInt(KEY_CANCEL_RESID, mCancelResid); outState.putString(KEY_CANCEL_STRING, mCancelString); outState.putInt(KEY_CANCEL_COLOR, mCancelColor); outState.putSerializable(KEY_VERSION, mVersion); outState.putSerializable(KEY_TIMEZONE, mTimezone); outState.putParcelable(KEY_DATERANGELIMITER, mDateRangeLimiter); }
From source file:com.gelakinetic.mtgfam.FamiliarActivity.java
private boolean processIntent(Intent intent) { boolean isDeepLink = false; if (Intent.ACTION_SEARCH.equals(intent.getAction())) { /* Do a search by name, launched from the quick search */ String query = intent.getStringExtra(SearchManager.QUERY); Bundle args = new Bundle(); SearchCriteria sc = new SearchCriteria(); sc.name = query;/* w ww . j a v a 2s .c om*/ args.putSerializable(SearchViewFragment.CRITERIA, sc); selectItem(R.string.main_card_search, args, false, true); /* Don't clear backstack, do force the intent */ } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { boolean shouldSelectItem = true; Uri data = intent.getData(); Bundle args = new Bundle(); assert data != null; boolean shouldClearFragmentStack = true; /* Clear backstack for deep links */ if (data.getAuthority().toLowerCase().contains("gatherer.wizards")) { SQLiteDatabase database = DatabaseManager.getInstance(this, false).openDatabase(false); try { String queryParam; if ((queryParam = data.getQueryParameter("multiverseid")) != null) { Cursor cursor = CardDbAdapter.fetchCardByMultiverseId(Long.parseLong(queryParam), new String[] { CardDbAdapter.DATABASE_TABLE_CARDS + "." + CardDbAdapter.KEY_ID }, database); if (cursor.getCount() != 0) { isDeepLink = true; args.putLongArray(CardViewPagerFragment.CARD_ID_ARRAY, new long[] { cursor.getInt(cursor.getColumnIndex(CardDbAdapter.KEY_ID)) }); } cursor.close(); if (args.size() == 0) { throw new Exception("Not Found"); } } else if ((queryParam = data.getQueryParameter("name")) != null) { Cursor cursor = CardDbAdapter.fetchCardByName(queryParam, new String[] { CardDbAdapter.DATABASE_TABLE_CARDS + "." + CardDbAdapter.KEY_ID }, true, database); if (cursor.getCount() != 0) { isDeepLink = true; args.putLongArray(CardViewPagerFragment.CARD_ID_ARRAY, new long[] { cursor.getInt(cursor.getColumnIndex(CardDbAdapter.KEY_ID)) }); } cursor.close(); if (args.size() == 0) { throw new Exception("Not Found"); } } else { throw new Exception("Not Found"); } } catch (Exception e) { /* empty cursor, just return */ ToastWrapper.makeText(this, R.string.no_results_found, ToastWrapper.LENGTH_LONG).show(); this.finish(); shouldSelectItem = false; } finally { DatabaseManager.getInstance(this, false).closeDatabase(false); } } else if (data.getAuthority().contains("CardSearchProvider")) { /* User clicked a card in the quick search autocomplete, jump right to it */ args.putLongArray(CardViewPagerFragment.CARD_ID_ARRAY, new long[] { Long.parseLong(data.getLastPathSegment()) }); shouldClearFragmentStack = false; /* Don't clear backstack for search intents */ } else { /* User clicked a deep link, jump to the card(s) */ isDeepLink = true; SQLiteDatabase database = DatabaseManager.getInstance(this, false).openDatabase(false); try { Cursor cursor = null; boolean screenLaunched = false; if (data.getScheme().toLowerCase().equals("card") && data.getAuthority().toLowerCase().equals("multiverseid")) { if (data.getLastPathSegment() == null) { /* Home screen deep link */ launchHomeScreen(); screenLaunched = true; shouldSelectItem = false; } else { try { /* Don't clear the fragment stack for internal links (thanks Meld cards) */ if (data.getPathSegments().contains("internal")) { shouldClearFragmentStack = false; } cursor = CardDbAdapter.fetchCardByMultiverseId( Long.parseLong(data.getLastPathSegment()), new String[] { CardDbAdapter.DATABASE_TABLE_CARDS + "." + CardDbAdapter.KEY_ID }, database); } catch (NumberFormatException e) { cursor = null; } } } if (cursor != null) { if (cursor.getCount() != 0) { args.putLongArray(CardViewPagerFragment.CARD_ID_ARRAY, new long[] { cursor.getInt(cursor.getColumnIndex(CardDbAdapter.KEY_ID)) }); } else { /* empty cursor, just return */ ToastWrapper.makeText(this, R.string.no_results_found, ToastWrapper.LENGTH_LONG).show(); this.finish(); shouldSelectItem = false; } cursor.close(); } else if (!screenLaunched) { /* null cursor, just return */ ToastWrapper.makeText(this, R.string.no_results_found, ToastWrapper.LENGTH_LONG).show(); this.finish(); shouldSelectItem = false; } } catch (FamiliarDbException e) { e.printStackTrace(); } DatabaseManager.getInstance(this, false).closeDatabase(false); } args.putInt(CardViewPagerFragment.STARTING_CARD_POSITION, 0); if (shouldSelectItem) { selectItem(R.string.main_card_search, args, shouldClearFragmentStack, true); } } else if (ACTION_ROUND_TIMER.equals(intent.getAction())) { selectItem(R.string.main_timer, null, true, false); } else if (ACTION_CARD_SEARCH.equals(intent.getAction())) { selectItem(R.string.main_card_search, null, true, false); } else if (ACTION_LIFE.equals(intent.getAction())) { selectItem(R.string.main_life_counter, null, true, false); } else if (ACTION_DICE.equals(intent.getAction())) { selectItem(R.string.main_dice, null, true, false); } else if (ACTION_TRADE.equals(intent.getAction())) { selectItem(R.string.main_trade, null, true, false); } else if (ACTION_MANA.equals(intent.getAction())) { selectItem(R.string.main_mana_pool, null, true, false); } else if (ACTION_WISH.equals(intent.getAction())) { selectItem(R.string.main_wishlist, null, true, false); } else if (ACTION_RULES.equals(intent.getAction())) { selectItem(R.string.main_rules, null, true, false); } else if (ACTION_JUDGE.equals(intent.getAction())) { selectItem(R.string.main_judges_corner, null, true, false); } else if (ACTION_MOJHOSTO.equals(intent.getAction())) { selectItem(R.string.main_mojhosto, null, true, false); } else if (ACTION_PROFILE.equals(intent.getAction())) { selectItem(R.string.main_profile, null, true, false); } else if (ACTION_DECKLIST.equals(intent.getAction())) { selectItem(R.string.main_decklist, null, true, false); } else if (Intent.ACTION_MAIN.equals(intent.getAction())) { /* App launched as regular, show the default fragment if there isn't one already */ if (getSupportFragmentManager().getFragments() == null) { launchHomeScreen(); } } else { /* Some unknown intent, just finish */ finish(); } mDrawerList.setItemChecked(mCurrentFrag, true); return isDeepLink; }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
@Override protected void onSaveInstanceState(Bundle b) { super.onSaveInstanceState(b); b.putSerializable("historyFilterDevices", historyFilterDevices); b.putSerializable("historyFilterNetworks", historyFilterNetworks); b.putSerializable("historyFilterDevicesFilter", historyFilterDevicesFilter); b.putSerializable("historyFilterNetworksFilter", historyFilterNetworksFilter); b.putSerializable("historyItemList", historyItemList); b.putSerializable("historyStorageList", historyStorageList); b.putInt("historyResultLimit", historyResultLimit); b.putSerializable("currentMapOptions", currentMapOptions); b.putSerializable("currentMapOptionTitles", currentMapOptionTitles); b.putSerializable("mapTypeListSectionList", mapTypeListSectionList); b.putSerializable("mapFilterListSectionListMap", mapFilterListSectionListMap); b.putSerializable("currentMapType", currentMapType); }
From source file:com.hotstar.player.adplayer.player.PlayerFragment.java
/** * Called from main activity.//from w w w. ja va 2 s .c om */ protected void onFragmentSaveInstanceState(Bundle outState) { AdVideoApplication.logger.i(LOG_TAG + "#onSaveInstanceState", "Saving activity state."); outState.putLong(CURRENT_PLAYER_POSITION, lastKnownTime); AdVideoApplication.logger.i(LOG_TAG + "#onSaveInstanceState", "Current player time [" + lastKnownTime + "] saved."); outState.putSerializable(CURRENT_PLAYER_STATE, savedPlayerState); AdVideoApplication.logger.i(LOG_TAG + "#onSaveInstanceState", "Current player state [" + savedPlayerState + "] saved."); }
From source file:com.android.contacts.ContactSaveService.java
private void joinSeveralContacts(Intent intent) { final long[] contactIds = intent.getLongArrayExtra(EXTRA_CONTACT_IDS); final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_RESULT_RECEIVER); // Load raw contact IDs for all contacts involved. final long rawContactIds[] = getRawContactIdsForAggregation(contactIds); final long[][] separatedRawContactIds = getSeparatedRawContactIds(contactIds); if (rawContactIds == null) { Log.e(TAG, "Invalid arguments for joinSeveralContacts request"); if (receiver != null) { receiver.send(BAD_ARGUMENTS, new Bundle()); }/*from www . j av a2s . co m*/ return; } // For each pair of raw contacts, insert an aggregation exception final ContentResolver resolver = getContentResolver(); // The maximum number of operations per batch (aka yield point) is 500. See b/22480225 final int batchSize = MAX_CONTACTS_PROVIDER_BATCH_SIZE; final ArrayList<ContentProviderOperation> operations = new ArrayList<>(batchSize); for (int i = 0; i < rawContactIds.length; i++) { for (int j = 0; j < rawContactIds.length; j++) { if (i != j) { buildJoinContactDiff(operations, rawContactIds[i], rawContactIds[j]); } // Before we get to 500 we need to flush the operations list if (operations.size() > 0 && operations.size() % batchSize == 0) { if (!applyOperations(resolver, operations)) { if (receiver != null) { receiver.send(CP2_ERROR, new Bundle()); } return; } operations.clear(); } } } if (operations.size() > 0 && !applyOperations(resolver, operations)) { if (receiver != null) { receiver.send(CP2_ERROR, new Bundle()); } return; } final String name = queryNameOfLinkedContacts(contactIds); if (name != null) { if (receiver != null) { final Bundle result = new Bundle(); result.putSerializable(EXTRA_RAW_CONTACT_IDS, separatedRawContactIds); result.putString(EXTRA_DISPLAY_NAME, name); receiver.send(CONTACTS_LINKED, result); } else { if (TextUtils.isEmpty(name)) { showToast(R.string.contactsJoinedMessage); } else { showToast(R.string.contactsJoinedNamedMessage, name); } } LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(BROADCAST_LINK_COMPLETE)); } else { if (receiver != null) { receiver.send(CP2_ERROR, new Bundle()); } showToast(R.string.contactJoinErrorToast); } }
From source file:com.g_node.gca.schedule.fragment_schedule.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Log.i("GCA-Error", "onViewCreaed Called"); // TextView notificationNote = (TextView)getView().findViewById(R.id.schedulemain); // /*from w ww.j ava 2 s. c o m*/ Bundle bundle = this.getArguments(); int dayNumber = bundle.getInt("tab"); Log.i(LOG_TAG, "Current Tab: " + ++dayNumber); // notificationNote.setText("Day : " + ++dayNumber); ListView ScheduleList = (ListView) getView().findViewById(R.id.ScheduleMainList); Log.i(LOG_TAG, "ScheduleList id got - layout got"); scheduleAdapter adapter = new scheduleAdapter(getActivity(), eventsForThisFragment, eventsRecordsArray, tracksRecordsArray, sessionRecordsArray, getActivity()); Log.i(LOG_TAG, "Adapter set - constructor initialized"); ScheduleList.setAdapter(adapter); //List Item Click Listener ScheduleList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { // TODO Auto-generated method stub Log.i("GCA-Schedule-List", "Clicked Item - int position: " + position); Log.i("GCA-Schedule-List", "Clicked Item - Long ID: " + id); if (eventsForThisFragment.get(position).getSchedule_item_type().equals(SCHEDULE_ITEMTYPE_EVENT)) { Log.i("GCA-Schedule-List", "Event Clicked"); ScheduleItemRecord scheduleItemRecordAtCurrentPosition = eventsForThisFragment.get(position); EventScheduleItem eventAtListPosition = eventsRecordsArray .get(scheduleItemRecordAtCurrentPosition.getIndex()); //ScheduleItemExtended scheduleDetailObject = new ScheduleItemExtended(eventAtListPosition); Intent intent = new Intent(getActivity(), ScheduleItemExtended.class); Bundle bundle = new Bundle(); bundle.putSerializable("dEvent", eventAtListPosition); //bundle.putString("type", SCHEDULE_ITEMTYPE_SESSION); bundle.putString("type", eventsForThisFragment.get(position).getSchedule_item_type()); intent.putExtras(bundle); startActivity(intent); } else if (eventsForThisFragment.get(position).getSchedule_item_type() .equals(SCHEDULE_ITEMTYPE_TRACK)) { Log.i("GCA-Schedule-List", "Track Clicked"); ScheduleItemRecord scheduleItemRecordAtCurrentPosition = eventsForThisFragment.get(position); TrackScheduleItem trackAtListPosition = tracksRecordsArray .get(scheduleItemRecordAtCurrentPosition.getIndex()); //ScheduleItemExtended scheduleDetailObject = new ScheduleItemExtended(eventAtListPosition); Intent intent = new Intent(getActivity(), ScheduleItemExtended.class); Bundle bundle = new Bundle(); bundle.putSerializable("dTrack", trackAtListPosition); //bundle.putString("type", SCHEDULE_ITEMTYPE_SESSION); bundle.putString("type", eventsForThisFragment.get(position).getSchedule_item_type()); intent.putExtras(bundle); startActivity(intent); } else { Log.i("GCA-Schedule-List", "Session Clicked"); ScheduleItemRecord scheduleItemRecordAtCurrentPosition = eventsForThisFragment.get(position); SessionScheduleItem sessionkAtListPosition = sessionRecordsArray .get(scheduleItemRecordAtCurrentPosition.getIndex()); Intent intent = new Intent(getActivity(), ScheduleItemExtended.class); Bundle bundle = new Bundle(); bundle.putSerializable("dSession", sessionkAtListPosition); //bundle.putString("type", SCHEDULE_ITEMTYPE_SESSION); bundle.putString("type", eventsForThisFragment.get(position).getSchedule_item_type()); intent.putExtras(bundle); startActivity(intent); } } }); }