Java Code Examples for android.os.Bundle#putParcelable()

The following examples show how to use android.os.Bundle#putParcelable() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * 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;
    }
}
 
Example 2
Source Project: react-native-callkeep   File: RNCallKeepModule.java    License: ISC License 6 votes vote down vote up
@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);
}
 
Example 3
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;
}
 
Example 4
@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();
    }
}
 
Example 5
Source Project: rcloneExplorer   File: CacheConfig.java    License: MIT License 6 votes vote down vote up
@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);
    }
}
 
Example 6
Source Project: AndroidMvvm   File: ViewModelActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (viewModel != null) {
        outState.putParcelable(EXTRA_VIEW_MODEL_STATE, viewModel.getInstanceState());
    }
}
 
Example 7
@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);
}
 
Example 8
Source Project: V.FlyoutTest   File: FragmentActivity.java    License: MIT License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 9
/**
 *  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;
}
 
Example 10
Source Project: braintree_android   File: ThreeDSecure.java    License: MIT License 5 votes vote down vote up
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);
}
 
Example 11
Source Project: AndroidFloatLabel   File: FloatLabel.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 12
Source Project: android-card-form   File: InitialValueCheckBox.java    License: MIT License 5 votes vote down vote up
@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;
}
 
Example 13
Source Project: biermacht   File: StyleNotesFragment.java    License: Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 14
Source Project: guideshow   File: FragmentActivity.java    License: MIT License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 15
Source Project: EhViewer   File: GalleryCommentsScene.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 16
@Override public void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  if (bundlesList != null) {
    outState.putParcelable(LIST_STATE_KEY, bundlesList.getLayoutManager()
        .onSaveInstanceState());
  }
}
 
Example 17
Source Project: watchlist   File: ReviewActivity.java    License: Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 18
Source Project: Hews   File: CommentsFragment.java    License: MIT License 4 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    mCommentPresenter.saveState(outState);
    outState.putParcelable(KEY_LIST_STATE, rvCommentList.getLayoutManager().onSaveInstanceState());
}
 
Example 19
@Override
public void onSaveInstanceState( Bundle outState ){
    super.onSaveInstanceState( outState );
    outState.putParcelable( KEY_HISTORY_GROUP, getPresenter().getHistoryItemGroup() );
}
 
Example 20
@Override
protected void onSaveInstanceState(Bundle outState) {
	outState.putParcelable(LAYOUTMANAGER_STATE,layoutManager.onSaveInstanceState());
	outState.putInt(TOOLBAR_OFFSET, binding.appbar.getOffset());
	super.onSaveInstanceState(outState);
}