List of usage examples for android.os Bundle putBundle
public void putBundle(@Nullable String key, @Nullable Bundle value)
From source file:jp.co.noxi.app.NXDialog.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Listener/*from ww w .ja va 2s . c om*/ saveState(outState, SAVED_KEY_LISTENER, mKeyListener); saveState(outState, SAVED_SHOW_LISTENER, mShowListener); saveState(outState, SAVED_CANCEL_LISTENER, mCancelListener); saveState(outState, SAVED_DISMISS_LISTENER, mDismissListener); // Other if (mCanceledOnTouchOutside != VALUE_NULL) { outState.putInt(SAVED_TOUCH_OUTSIDE, mCanceledOnTouchOutside); } if (mExtra != null) { outState.putBundle(SAVED_EXTRA, mExtra); } }
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 w w w . ja v a2 s.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:androidx.media.MediaSession2StubImplBase.java
void notifyCurrentMediaItemChanged(final MediaItem2 item) { notifyAll(COMMAND_CODE_PLAYLIST_GET_CURRENT_MEDIA_ITEM, new Session2Runnable() { @Override/* w ww .j a v a 2s .c o m*/ public void run(ControllerInfo controller) throws RemoteException { Bundle bundle = new Bundle(); bundle.putBundle(ARGUMENT_MEDIA_ITEM, item.toBundle()); controller.getControllerBinder().onEvent(SESSION_EVENT_ON_CURRENT_MEDIA_ITEM_CHANGED, bundle); } }); }
From source file:androidx.media.MediaSession2StubImplBase.java
void notifyPlaybackInfoChanged(final PlaybackInfo info) { notifyAll(new Session2Runnable() { @Override/*from w w w . j a v a 2 s . com*/ public void run(ControllerInfo controller) throws RemoteException { Bundle bundle = new Bundle(); bundle.putBundle(ARGUMENT_PLAYBACK_INFO, info.toBundle()); controller.getControllerBinder().onEvent(SESSION_EVENT_ON_PLAYBACK_INFO_CHANGED, bundle); } }); }
From source file:androidx.media.MediaSession2StubImplBase.java
void notifyPlaylistMetadataChanged(final MediaMetadata2 metadata) { notifyAll(SessionCommand2.COMMAND_CODE_PLAYLIST_GET_LIST_METADATA, new Session2Runnable() { @Override//w ww. ja v a 2s .c om public void run(ControllerInfo controller) throws RemoteException { Bundle bundle = new Bundle(); bundle.putBundle(ARGUMENT_PLAYLIST_METADATA, metadata == null ? null : metadata.toBundle()); controller.getControllerBinder().onEvent(SESSION_EVENT_ON_PLAYLIST_METADATA_CHANGED, bundle); } }); }
From source file:androidx.media.MediaSession2StubImplBase.java
void notifyBufferingStateChanged(final MediaItem2 item, final int bufferingState) { notifyAll(new Session2Runnable() { @Override/*w w w .jav a2s. com*/ public void run(ControllerInfo controller) throws RemoteException { Bundle bundle = new Bundle(); bundle.putBundle(ARGUMENT_MEDIA_ITEM, item.toBundle()); bundle.putInt(ARGUMENT_BUFFERING_STATE, bufferingState); controller.getControllerBinder().onEvent(SESSION_EVENT_ON_BUFFERING_STATE_CHAGNED, bundle); } }); }
From source file:androidx.media.MediaSession2StubImplBase.java
public void sendCustomCommand(final SessionCommand2 command, final Bundle args) { if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); }//w w w .ja va2 s .com final Bundle bundle = new Bundle(); bundle.putBundle(ARGUMENT_CUSTOM_COMMAND, command.toBundle()); bundle.putBundle(ARGUMENT_ARGUMENTS, args); notifyAll(new Session2Runnable() { @Override public void run(ControllerInfo controller) throws RemoteException { controller.getControllerBinder().onEvent(SESSION_EVENT_SEND_CUSTOM_COMMAND, bundle); } }); }
From source file:androidx.media.MediaSession2StubImplBase.java
void setAllowedCommands(ControllerInfo controller, final SessionCommandGroup2 commands) { synchronized (mLock) { mAllowedCommandGroupMap.put(controller, commands); }/* www. j a v a 2 s . c om*/ notifyInternal(controller, new Session2Runnable() { @Override public void run(ControllerInfo controller) throws RemoteException { Bundle bundle = new Bundle(); bundle.putBundle(ARGUMENT_ALLOWED_COMMANDS, commands.toBundle()); controller.getControllerBinder().onEvent(SESSION_EVENT_ON_ALLOWED_COMMANDS_CHANGED, bundle); } }); }
From source file:androidx.media.MediaSession2StubImplBase.java
public void sendCustomCommand(ControllerInfo controller, final SessionCommand2 command, final Bundle args, final ResultReceiver receiver) { if (receiver != null && controller == null) { throw new IllegalArgumentException("Controller shouldn't be null if result receiver is" + " specified"); }//w w w. j av a2 s . c om if (command == null) { throw new IllegalArgumentException("command shouldn't be null"); } notifyInternal(controller, new Session2Runnable() { @Override public void run(ControllerInfo controller) throws RemoteException { // TODO: Send this event through MediaSessionCompat.XXX() Bundle bundle = new Bundle(); bundle.putBundle(ARGUMENT_CUSTOM_COMMAND, command.toBundle()); bundle.putBundle(ARGUMENT_ARGUMENTS, args); bundle.putParcelable(ARGUMENT_RESULT_RECEIVER, receiver); controller.getControllerBinder().onEvent(SESSION_EVENT_SEND_CUSTOM_COMMAND, bundle); } }); }
From source file:at.wada811.android.dialogfragments.AbstractDialogFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (iconId != VALUE_NULL) { outState.putInt(ICON_ID, iconId); }/*from w ww. ja v a 2 s .c o m*/ if (title != null) { outState.putString(TITLE, (String) title); } if (titleId != VALUE_NULL) { outState.putInt(TITLE_ID, titleId); } if (isCanceledOnTouchOutside != VALUE_NULL) { outState.putInt(CANCELED_TOUCH_OUTSIDE, isCanceledOnTouchOutside); } if (extra != null) { outState.putBundle(EXTRA, extra); } }