Example usage for android.os Bundle putAll

List of usage examples for android.os Bundle putAll

Introduction

In this page you can find the example usage for android.os Bundle putAll.

Prototype

public void putAll(Bundle bundle) 

Source Link

Document

Inserts all mappings from the given Bundle into this Bundle.

Usage

From source file:com.wly.net.PortScannerActivity.java

@Override
public void onSaveInstanceState(Bundle savedPacketInstanceState) {
    if (!datagramBundle.isEmpty())
        savedPacketInstanceState.putAll(datagramBundle);
    else/* w ww . ja  va2  s  .c  o m*/
        Toast.makeText(this, "The datagram bundle is empty!", Toast.LENGTH_LONG).show();
}

From source file:com.example.flashcards.WizardActivity.java

private Bundle getJointBundle() {
    Bundle result = new Bundle();
    for (Page page : mCurrentPageSequence) {
        result.putAll(page.getData());
    }//from w ww.j  a  v a 2  s  . co  m
    return result;
}

From source file:androidx.navigation.NavDestination.java

/**
 * Navigates to this destination./*from w  ww . j  av  a  2  s .  com*/
 *
 * <p>Uses the {@link #getNavigator() configured navigator} to navigate to this destination.
 * Apps should not call this directly, instead use {@link NavController}'s navigation methods
 * to ensure consistent back stack tracking and behavior.</p>
 *
 * @param args arguments to the new destination
 * @param navOptions options for navigation
 */
@SuppressWarnings("unchecked")
public void navigate(@Nullable Bundle args, @Nullable NavOptions navOptions) {
    Bundle defaultArgs = getDefaultArguments();
    Bundle finalArgs = new Bundle();
    finalArgs.putAll(defaultArgs);
    if (args != null) {
        finalArgs.putAll(args);
    }
    mNavigator.navigate(this, finalArgs, navOptions);
}

From source file:org.yammp.app.AlbumFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putAll(getArguments() != null ? getArguments() : new Bundle());
    super.onSaveInstanceState(outState);
}

From source file:com.andrew.apollo.ui.fragments.profile.AlbumSongFragment.java

/**
 * {@inheritDoc}/*from  w w w  .  j av  a 2 s.co m*/
 */
@Override
public void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putAll(getArguments() != null ? getArguments() : new Bundle());
}

From source file:net.goldenspiral.fetlifeoss.ui.MainActivity.java

private void swapPage(FetLifeFragment fragment, boolean replaceFragment) {
    binding.drawerLayout.closeDrawers();

    Bundle args = fragment.getArguments();
    if (args == null) {
        fragment.setArguments(getIntent().getExtras());
    } else {/*from w w w . ja va  2  s . c o  m*/
        args.putAll(getIntent().getExtras());
        fragment.setArguments(args);
    }
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    if (replaceFragment)
        transaction.replace(R.id.activity_container, fragment);
    else
        transaction.add(R.id.activity_container, fragment);

    transaction.commit();
    int titleId = fragment.getTitle();
    binding.toolbarTitle.setText(
            titleId == -1 ? getResources().getText(R.string.app_name) : getResources().getText(titleId));
}

From source file:com.playtang.commonnavigation.login.PlayTangLoginActivity.java

private Bundle getMergedOptions() {
    // Read activity metadata from AndroidManifest.xml
    ActivityInfo activityInfo = null;/*from   ww w .  j  a va 2s .com*/
    try {
        activityInfo = getPackageManager().getActivityInfo(this.getComponentName(),
                PackageManager.GET_META_DATA);
    } catch (NameNotFoundException e) {
        if (Parse.getLogLevel() <= Parse.LOG_LEVEL_ERROR && Log.isLoggable(LOG_TAG, Log.WARN)) {
            Log.w(LOG_TAG, e.getMessage());
        }
    }

    // The options specified in the Intent (from PlayTangLoginBuilder) will
    // override any duplicate options specified in the activity metadata
    Bundle mergedOptions = new Bundle();
    if (activityInfo != null && activityInfo.metaData != null) {
        mergedOptions.putAll(activityInfo.metaData);
    }
    if (getIntent().getExtras() != null) {
        mergedOptions.putAll(getIntent().getExtras());
    }

    return mergedOptions;
}

From source file:liqui.droid.activity.Initiative.java

public void onSaveInstanceState(Bundle outState) {
    Log.v(Constants.LOG_TAG, this.getLocalClassName() + " onSaveInstanceState");
    outState.putAll(mBundle);
    super.onSaveInstanceState(outState);
}

From source file:org.croudtrip.activities.MainActivity.java

private void fillNavigationDrawer() {

    // Check the action that was given to the activity to determine the sections that
    // should be shown
    Intent intent = getIntent();/*from w w  w . j  a v  a2 s  .  co  m*/
    String action = intent.getAction();
    action = (action == null) ? "" : action;

    // (0) JOIN TRIP
    JoinDispatchFragment joinDispatchFragment = new JoinDispatchFragment();
    joinDispatchFragment.setArguments(getIntent().getExtras());
    this.addSection(
            newSection(getString(R.string.menu_join_trip), R.drawable.hitchhiker, joinDispatchFragment));

    // (1) OFFER TRIP
    String offerName = getString(R.string.menu_offer_trip);
    SharedPreferences prefs = getSharedPreferences(Constants.SHARED_PREF_FILE_PREFERENCES, MODE_PRIVATE);
    if (prefs.getBoolean(Constants.SHARED_PREF_KEY_RUNNING_TRIP_OFFER, false)) {
        offerName = getString(R.string.menu_my_trip);
    }

    DispatchOfferTripFragment dispatchOfferTripFragment = new DispatchOfferTripFragment();
    dispatchOfferTripFragment.setArguments(getIntent().getExtras());
    this.addSection(newSection(offerName, R.drawable.ic_directions_car_white, dispatchOfferTripFragment));

    // (2) PROFILE
    if (AccountManager.isUserLoggedIn(this)) {
        // Only logged-in users can view their profile
        this.addSection(newSection(getString(R.string.menu_profile), R.drawable.ic_person_black_36dp,
                new ProfileFragment()));
    }

    // (3) SETTINGS
    this.addBottomSection(
            newSection(getString(R.string.menu_settings), R.drawable.ic_settings, new SettingsFragment()));

    // Set the section that should be loaded at the start of the application
    if (action.equalsIgnoreCase(ACTION_SHOW_REQUEST_DECLINED) || action.equals(ACTION_SHOW_FOUND_MATCHES)) {
        this.setDefaultSectionLoaded(0);
        MaterialSection section = this.getSectionByTitle(getString(R.string.menu_my_trip));

        Bundle extras = getIntent().getExtras();
        Bundle bundle = new Bundle();
        bundle.putAll(extras);

        Fragment requestFrag = (Fragment) section.getTargetFragment();
        requestFrag.setArguments(bundle);

    } else if (action.equalsIgnoreCase(ACTION_SHOW_JOIN_TRIP_REQUESTS)) {
        this.setDefaultSectionLoaded(1); // Offer trip (My trip)
    } else if (action.equalsIgnoreCase(ACTION_SHOW_JOIN_TRIP_FRAGMENT)) {
        this.setDefaultSectionLoaded(0); //Join trip
    }
}

From source file:org.musicmod.android.app.MusicBrowserActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putAll(getIntent().getExtras() != null ? getIntent().getExtras() : new Bundle());
    super.onSaveInstanceState(outState);
}