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

The following examples show how to use android.os.Bundle#putParcelable() . 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
Source File: CacheConfig.java    From rcloneExplorer with 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 2
Source File: SecondScreenServiceV2Activity.java    From PoyntSamples with MIT License 6 votes vote down vote up
@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 3
Source File: WeiboMultiMessage.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
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
Source File: CustomTabsSession.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 5
Source File: RNCallKeepModule.java    From react-native-callkeep with 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 6
Source File: StyleNotesFragment.java    From biermacht with 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 7
Source File: ReviewActivity.java    From watchlist with 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 8
Source File: HomeFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
@Override public void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  if (bundlesList != null) {
    outState.putParcelable(LIST_STATE_KEY, bundlesList.getLayoutManager()
        .onSaveInstanceState());
  }
}
 
Example 9
Source File: GalleryCommentsScene.java    From EhViewer with 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 10
Source File: FragmentActivity.java    From guideshow with 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 11
Source File: InitialValueCheckBox.java    From android-card-form with 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 12
Source File: FloatLabel.java    From AndroidFloatLabel with 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 13
Source File: ThreeDSecure.java    From braintree_android with 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 14
Source File: ExpirationDatePickerDialogFragment.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  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 15
Source File: FragmentActivity.java    From V.FlyoutTest with 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 16
Source File: EditMultiRedditActivity.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 5 votes vote down vote up
@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 17
Source File: ViewModelActivity.java    From AndroidMvvm with 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 18
Source File: CommentsFragment.java    From Hews with 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
Source File: HistoryFragment.java    From nongbeer-mvp-android-demo with Apache License 2.0 4 votes vote down vote up
@Override
public void onSaveInstanceState( Bundle outState ){
    super.onSaveInstanceState( outState );
    outState.putParcelable( KEY_HISTORY_GROUP, getPresenter().getHistoryItemGroup() );
}
 
Example 20
Source File: MainActivity.java    From chaoli-forum-for-android-2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
	outState.putParcelable(LAYOUTMANAGER_STATE,layoutManager.onSaveInstanceState());
	outState.putInt(TOOLBAR_OFFSET, binding.appbar.getOffset());
	super.onSaveInstanceState(outState);
}