List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:com.arkami.myidkey.activity.KeyCardEditActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable("keyCard", keyCard); outState.putBoolean("isInEditMode", isInEditMode); outState.putParcelableArrayList("componentHolder", (ArrayList<? extends Parcelable>) componentHolder.getCustomComponents()); outState.putParcelable("photoUri", photoUri); Log.w("onSaveInstanceState", "called"); }
From source file:com.brandao.tictactoe.board.BoardFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putInt(SAVED_STATE_PLAYER_ONE_WINS, mPlayerOneWins); outState.putInt(SAVED_STATE_PLAYER_TWO_WINS, mPlayerTwoWins); outState.putInt(SAVED_STATE_TOTAL_TIES, mTotalTies); outState.putLong(SAVED_STATE_START_TIME, mStartTime); outState.putInt(SAVED_STATE_LAST_GAME_WINNER, mLastGameWinner); outState.putInt(SAVED_STATE_LAST_MOVE_INDEX, mLastMoveIndex); outState.putParcelable(SAVED_STATE_BOARD, mBoard); outState.putInt(SAVED_STATE_GAME_STATE, mGameState); super.onSaveInstanceState(outState); }
From source file:com.markupartist.sthlmtraveling.RoutesActivity.java
/** * If there is any running search for routes, save it and process it later * on.// w w w .j av a 2 s . c o m * @param outState the out state */ private void saveJourneyQuery(Bundle outState) { outState.putParcelable(EXTRA_JOURNEY_QUERY, mJourneyQuery); }
From source file:be.billington.calendar.recurrencepicker.RecurrencePickerDialog.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(BUNDLE_MODEL, mModel); if (mEndCount.hasFocus()) { outState.putBoolean(BUNDLE_END_COUNT_HAS_FOCUS, true); }/* w w w.j a v a 2 s . c o m*/ }
From source file:aksha.upcomingdemo.HorizontalListView.java
@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); // Add the parent state to the bundle bundle.putParcelable(BUNDLE_ID_PARENT_STATE, super.onSaveInstanceState()); // Add our state to the bundle bundle.putInt(BUNDLE_ID_CURRENT_X, mCurrentX); return bundle; }
From source file:com.appybite.customer.HorizontalListView.java
/** * Parse the XML configuration for this widget * * @param context Context used for extracting attributes * @param attrs The Attribute Set containing the ColumnView attributes */// w w w .jav a 2 s. c om // private void retrieveXmlConfiguration(Context context, AttributeSet attrs) { // if (attrs != null) { // TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HorizontalListView); // // // Get the provided drawable from the XML // final Drawable d = a.getDrawable(R.styleable.HorizontalListView_android_divider); // if (d != null) { // // If a drawable is provided to use as the divider then use its intrinsic width for the divider width // setDivider(d); // } // // // If a width is explicitly specified then use that width // final int dividerWidth = a.getDimensionPixelSize(R.styleable.HorizontalListView_dividerWidth, 0); // if (dividerWidth != 0) { // setDividerWidth(dividerWidth); // } // // a.recycle(); // } // } @Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); // Add the parent state to the bundle bundle.putParcelable(BUNDLE_ID_PARENT_STATE, super.onSaveInstanceState()); // Add our state to the bundle bundle.putInt(BUNDLE_ID_CURRENT_X, mCurrentX); return bundle; }
From source file:com.android.mail.ui.ConversationListFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mListView != null) { outState.putParcelable(LIST_STATE_KEY, mListView.onSaveInstanceState()); outState.putInt(CHOICE_MODE_KEY, mListView.getChoiceMode()); }/*from w ww . j ava 2s . com*/ if (mListAdapter != null) { mListAdapter.saveSpecialItemInstanceState(outState); } }
From source file:org.anhonesteffort.flock.SubscriptionGoogleFragment.java
private void handleRequestPurchaseIntent(final String productType, final String productSku) { if (asyncTask != null) return;/*from w w w . ja va2s.c o m*/ asyncTask = new AsyncTask<Void, Void, Bundle>() { @Override protected void onPreExecute() { Log.d(TAG, "handleRequestPurchaseIntent"); subscriptionActivity.setProgressBarIndeterminateVisibility(true); subscriptionActivity.setProgressBarVisibility(true); } @Override protected Bundle doInBackground(Void... params) { Bundle result = new Bundle(); if (subscriptionActivity.billingService == null) { Log.e(TAG, "billing service is null"); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); return result; } String developerPayload = Base64 .encodeBytes(subscriptionActivity.davAccount.getUserId().toUpperCase().getBytes()); try { Bundle intentBundle = subscriptionActivity.billingService.getBuyIntent(3, SubscriptionGoogleFragment.class.getPackage().getName(), productSku, productType, developerPayload); if (intentBundle.getParcelable("BUY_INTENT") != null) { result.putParcelable("BUY_INTENT", intentBundle.getParcelable("BUY_INTENT")); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); return result; } Log.e(TAG, "buy intent is null"); } catch (RemoteException e) { Log.e(TAG, "caught remote exception while getting buy intent", e); } result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); return result; } @Override protected void onPostExecute(Bundle result) { asyncTask = null; subscriptionActivity.setProgressBarIndeterminateVisibility(false); subscriptionActivity.setProgressBarVisibility(false); if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) handleStartPurchaseIntent((PendingIntent) result.getParcelable("BUY_INTENT")); else ErrorToaster.handleDisplayToastBundledError(subscriptionActivity, result); } }.execute(); }
From source file:ca.ualberta.cmput301w14t08.geochan.adapters.ThreadViewAdapter.java
/** * Listener for the buttons of the thread op (TYPE_OP) listView item. Comments have * listeners in ThreadViewFragment because they are only displayed after * onItemClick, threadComment buttons have a listener in the adapter for * ease of access to the permanently displayed buttons. * //from w ww .ja va 2 s.c om * @param convertView view that contains the ThreadComments OP. * @param thread threadComment object that contains the ThreadComments OP. * */ private void listenForThreadButtons(View convertView, final ThreadComment thread) { // Here handle button presses final ImageButton replyButton = (ImageButton) convertView.findViewById(R.id.comment_reply_button); final ImageButton starButton = (ImageButton) convertView.findViewById(R.id.comment_star_button); if (FavouritesLog.getInstance(context).hasThreadComment(thread.getId())) { starButton.setImageResource(R.drawable.ic_rating_marked); } final ImageButton mapButton = (ImageButton) convertView.findViewById(R.id.thread_map_button); final ImageButton editButton = (ImageButton) convertView.findViewById(R.id.thread_edit_button); if (HashHelper.getHash(thread.getBodyComment().getUser()).equals(thread.getBodyComment().getHash())) { editButton.setVisibility(View.VISIBLE); } if (thread.getBodyComment().hasImage()) { listenForThumbnail(convertView, thread.getBodyComment()); } // Listen for the star(favourites) button. if (starButton != null) { starButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click depending on if the thread has // been favourited. if (!FavouritesLog.getInstance(context).hasThreadComment(thread.getId())) { Toast.makeText(context, "Thread saved to Favourites.", Toast.LENGTH_SHORT).show(); starButton.setImageResource(R.drawable.ic_rating_marked); FavouritesLog log = FavouritesLog.getInstance(context); log.addThreadComment(thread); } else { Toast.makeText(context, "Thread removed from Favourites.", Toast.LENGTH_SHORT).show(); starButton.setImageResource(R.drawable.ic_rating_important); FavouritesLog log = FavouritesLog.getInstance(context); log.removeThreadComment(thread); } } }); } // Listen for the edit button. if (editButton != null) { editButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Fragment fragment = new EditFragment(); Bundle bundle = new Bundle(); bundle.putInt("threadIndex", id); bundle.putString("commentId", thread.getBodyComment().getId()); fragment.setArguments(bundle); manager.beginTransaction().replace(R.id.fragment_container, fragment, "editFrag") .addToBackStack(null).commit(); manager.executePendingTransactions(); } }); } // Listen for the map button. if (mapButton != null) { mapButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click to launch mapFragment Bundle bundle = new Bundle(); bundle.putParcelable("thread_comment", thread.getBodyComment()); Fragment mapFrag = new MapViewFragment(); mapFrag.setArguments(bundle); Fragment fav = manager.findFragmentByTag("favThrFragment"); if (fav != null) { manager.beginTransaction().replace(R.id.container, mapFrag, "mapFrag").addToBackStack(null) .commit(); } else { manager.beginTransaction().replace(R.id.fragment_container, mapFrag, "mapFrag") .addToBackStack(null).commit(); } manager.executePendingTransactions(); } }); } // Listen for the reply button. if (replyButton != null) { replyButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click to launch postCommentFragment Fragment fragment = new PostFragment(); Bundle bundle = new Bundle(); bundle.putParcelable("cmt", thread.getBodyComment()); bundle.putLong("id", id); fragment.setArguments(bundle); Fragment fav = manager.findFragmentByTag("favThrFragment"); if (fav != null) { manager.beginTransaction().replace(R.id.container, fragment, "postFrag") .addToBackStack(null).commit(); manager.executePendingTransactions(); } else { manager.beginTransaction().replace(R.id.fragment_container, fragment, "postFrag") .addToBackStack(null).commit(); manager.executePendingTransactions(); } } }); } }