下面列出了android.os.Bundle#putParcelable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Updates the visuals for toolbar items. Will only succeed if a custom tab created using this
* session is in the foreground in browser and the given id is valid.
* @param id The id for the item to update.
* @param icon The new icon of the toolbar item.
* @param description Content description of the toolbar item.
* @return Whether the update succeeded.
* @deprecated Use
* CustomTabsSession#setSecondaryToolbarViews(RemoteViews, int[], PendingIntent)
*/
@Deprecated
public boolean setToolbarItem(int id, @NonNull Bitmap icon, @NonNull String description) {
Bundle bundle = new Bundle();
bundle.putInt(CustomTabsIntent.KEY_ID, id);
bundle.putParcelable(CustomTabsIntent.KEY_ICON, icon);
bundle.putString(CustomTabsIntent.KEY_DESCRIPTION, description);
Bundle metaBundle = new Bundle();
metaBundle.putBundle(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE, bundle);
try {
return mService.updateVisuals(mCallback, metaBundle);
} catch (RemoteException e) {
return false;
}
}
@ReactMethod
public void displayIncomingCall(String uuid, String number, String callerName) {
if (!isConnectionServiceAvailable() || !hasPhoneAccount()) {
return;
}
Log.d(TAG, "displayIncomingCall number: " + number + ", callerName: " + callerName);
Bundle extras = new Bundle();
Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null);
extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS, uri);
extras.putString(EXTRA_CALLER_NAME, callerName);
extras.putString(EXTRA_CALL_UUID, uuid);
telecomManager.addNewIncomingCall(handle, extras);
}
public Bundle toBundle(Bundle bundle)
{
if (textObject != null)
{
bundle.putParcelable("_weibo_message_text", textObject);
bundle.putString("_weibo_message_text_extra", textObject.toExtraMediaString());
}
if (imageObject != null)
{
bundle.putParcelable("_weibo_message_image", imageObject);
bundle.putString("_weibo_message_image_extra", imageObject.toExtraMediaString());
}
if (mediaObject != null)
{
bundle.putParcelable("_weibo_message_media", mediaObject);
bundle.putString("_weibo_message_media_extra", mediaObject.toExtraMediaString());
}
return bundle;
}
@OnClick(R.id.displayMessage)
public void showConfirmation() {
try {
// Supported options
// Intents.EXTRA_BACKGROUND_IMAGE (value should be a Bitmap object)
// Intents.EXTRA_CONTENT_TYPE
Bundle options = new Bundle();
Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.thank_you_screen_bg);
options.putParcelable(Intents.EXTRA_BACKGROUND_IMAGE, background);
options.putString("FONT_COLOR", "#eef442");
//secondScreenService.displayMessage("", options);
// secondScreenService.displayMessage("Happy Friday!", options);
options.putString(Intents.EXTRA_CONTENT_TYPE, Intents.EXTRA_CONTENT_TYPE_HTML);
secondScreenService.displayMessage("<h2>Thank You</h2><p>Good-bye!</p>", options);
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
if (selectedRemote != null) {
outState.putParcelable(SAVED_SELECTED_REMOTE, selectedRemote);
}
if (remotePath != null) {
outState.putString(SAVED_REMOTE_PATH, remotePath);
}
if (chunkSizeString != null) {
outState.putString(SAVED_CHUNK_SIZE, chunkSizeString);
}
if (infoAgeString != null) {
outState.putString(SAVED_CACHE_EXPIRY, infoAgeString);
}
if (chunkTotalSizeString != null) {
outState.putString(SAVED_CACHE_SIZE, chunkTotalSizeString);
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (viewModel != null) {
outState.putParcelable(EXTRA_VIEW_MODEL_STATE, viewModel.getInstanceState());
}
}
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(NULL_ACCESS_TOKEN_STATE, mNullAccessToken);
outState.putString(ACCESS_TOKEN_STATE, mAccessToken);
outState.putString(ACCOUNT_NAME_STATE, mAccountName);
outState.putParcelable(MULTI_REDDIT_STATE, multiReddit);
outState.putString(MULTI_PATH_STATE, multipath);
}
/**
* Save all appropriate fragment state.
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Parcelable p = mFragments.saveAllState();
if (p != null) {
outState.putParcelable(FRAGMENTS_TAG, p);
}
}
/**
* Factory method to create new instances
*
* @param file File to bind an expiration date
* @param chosenDateInMillis Date chosen when the dialog appears
* @return New dialog instance
*/
public static ExpirationDatePickerDialogFragment newInstance(OCFile file, long chosenDateInMillis) {
Bundle arguments = new Bundle();
arguments.putParcelable(ARG_FILE, file);
arguments.putLong(ARG_CHOSEN_DATE_IN_MILLIS, chosenDateInMillis);
ExpirationDatePickerDialogFragment dialog = new ExpirationDatePickerDialogFragment();
dialog.setArguments(arguments);
return dialog;
}
private static void performCardinalAuthentication(final BraintreeFragment fragment, final ThreeDSecureLookup threeDSecureLookup) {
fragment.sendAnalyticsEvent("three-d-secure.verification-flow.started");
Bundle extras = new Bundle();
extras.putParcelable(ThreeDSecureActivity.EXTRA_THREE_D_SECURE_LOOKUP, threeDSecureLookup);
Intent intent = new Intent(fragment.getApplicationContext(), ThreeDSecureActivity.class);
intent.putExtras(extras);
fragment.startActivityForResult(intent, BraintreeRequestCodes.THREE_D_SECURE);
}
@Override
protected Parcelable onSaveInstanceState() {
final Parcelable superState = super.onSaveInstanceState();
final Bundle saveState = new Bundle();
saveState.putParcelable(SAVE_STATE_KEY_EDIT_TEXT, mEditText.onSaveInstanceState());
saveState.putParcelable(SAVE_STATE_KEY_LABEL, mLabel.onSaveInstanceState());
saveState.putBoolean(SAVE_STATE_KEY_FOCUS, mEditText.isFocused());
saveState.putBoolean(SAVE_STATE_TAG, true);
saveState.putParcelable(SAVE_STATE_PARENT, superState);
return saveState;
}
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
Bundle bundle = new Bundle();
bundle.putParcelable(EXTRA_SUPER_STATE, superState);
bundle.putBoolean(EXTRA_CHECKED_VALUE, isChecked());
return bundle;
}
public static StyleNotesFragment instance(BeerStyle s) {
// Create the fragment.
StyleNotesFragment f = new StyleNotesFragment();
// Store the recipe in the arguments bundle.
Bundle b = new Bundle();
b.putParcelable(Constants.KEY_STYLE, s);
f.setArguments(b);
// Return the newly created fragment.
return f;
}
/**
* Save all appropriate fragment state.
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Parcelable p = mFragments.saveAllState();
if (p != null) {
outState.putParcelable(FRAGMENTS_TAG, p);
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putLong(KEY_API_UID, mApiUid);
outState.putString(KEY_API_KEY, mApiKey);
outState.putLong(KEY_GID, mGid);
outState.putString(KEY_TOKEN, mToken);
outState.putParcelable(KEY_COMMENT_LIST, mCommentList);
}
@Override public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (bundlesList != null) {
outState.putParcelable(LIST_STATE_KEY, bundlesList.getLayoutManager()
.onSaveInstanceState());
}
}
public void loadDetailFragmentWith(String movieName, Review review) {
ReviewDetailFragment fragment = new ReviewDetailFragment();
Bundle args = new Bundle();
args.putString(WatchlistApp.MOVIE_NAME, movieName);
args.putParcelable(WatchlistApp.REVIEW_OBJECT, review);
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction().replace(R.id.review_detail_container, fragment).commit();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mCommentPresenter.saveState(outState);
outState.putParcelable(KEY_LIST_STATE, rvCommentList.getLayoutManager().onSaveInstanceState());
}
@Override
public void onSaveInstanceState( Bundle outState ){
super.onSaveInstanceState( outState );
outState.putParcelable( KEY_HISTORY_GROUP, getPresenter().getHistoryItemGroup() );
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putParcelable(LAYOUTMANAGER_STATE,layoutManager.onSaveInstanceState());
outState.putInt(TOOLBAR_OFFSET, binding.appbar.getOffset());
super.onSaveInstanceState(outState);
}