Example usage for android.os Bundle putParcelableArrayList

List of usage examples for android.os Bundle putParcelableArrayList

Introduction

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

Prototype

public void putParcelableArrayList(@Nullable String key, @Nullable ArrayList<? extends Parcelable> value) 

Source Link

Document

Inserts a List of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:net.naonedbus.fragment.impl.ItineraireFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    outState.putParcelable(BUNDLE_LOCATION_FROM, mFromLocation);
    outState.putParcelable(BUNDLE_LOCATION_TO, mToLocation);
    outState.putString(BUNDLE_ADDRESS_FROM, mFromAddressTextView.getText().toString());
    outState.putString(BUNDLE_ADDRESS_TO, mToAddressTextView.getText().toString());
    outState.putLong(BUNDLE_DATE_TIME, mDateTime.getMillis());
    outState.putBoolean(BUNDLE_ARRIVE_BY, mArriveBy);
    outState.putInt(BUNDLE_ICON_FROM, mIconFromResId);
    outState.putInt(BUNDLE_ICON_TO, mIconToResId);
    outState.putInt(BUNDLE_COLOR_FROM, mIconFromColor);
    outState.putInt(BUNDLE_COLOR_TO, mIconToColor);
    outState.putParcelableArrayList(BUNDLE_RESULTS, new ArrayList<ItineraryWrapper>(mItineraryWrappers));
    super.onSaveInstanceState(outState);
}

From source file:org.odk.collect.android.activities.GoogleDriveActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putBoolean(MY_DRIVE_KEY, myDrive);
    ArrayList<DriveListItem> dl = new ArrayList<DriveListItem>();
    for (int i = 0; i < listView.getCount(); i++) {
        dl.add((DriveListItem) listView.getItemAtPosition(i));
    }//from www.  j  a  v  a  2  s.c  om
    outState.putParcelableArrayList(DRIVE_ITEMS_KEY, dl);
    outState.putStringArray(PATH_KEY, currentPath.toArray(new String[currentPath.size()]));
    outState.putString(PARENT_KEY, parentId);
    outState.putBoolean(ALERT_SHOWING_KEY, alertShowing);
    outState.putString(ALERT_MSG_KEY, alertMsg);
    super.onSaveInstanceState(outState);
}

From source file:com.lcl.thumbweather.MainActivity.java

/**
 * ???/*from www  . jav  a  2s.c o m*/
 *
 */

private void updateLongTermWeatherUI() {
    if (destroyed) {
        return;
    }
    //ViewPagerAdapter
    ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    //??
    Bundle bundleTemper = new Bundle();
    bundleTemper.putInt("day", 3);
    bundleTemper.putParcelableArrayList("list", temper);
    TemperLineChartFragemnt temperLineChartFragemnt = new TemperLineChartFragemnt(this, todayWeather);
    temperLineChartFragemnt.setArguments(bundleTemper);
    viewPagerAdapter.addFragment(temperLineChartFragemnt, getString(R.string.temper));

    //??
    Bundle bundleToday = new Bundle();
    bundleToday.putInt("day", 0);
    RecyclerViewFragment recyclerViewFragmentToday = new RecyclerViewFragment();
    recyclerViewFragmentToday.setArguments(bundleToday);
    viewPagerAdapter.addFragment(recyclerViewFragmentToday, getString(R.string.today));

    //??
    Bundle bundleTomorrow = new Bundle();
    bundleTomorrow.putInt("day", 1);
    RecyclerViewFragment recyclerViewFragmentTomorrow = new RecyclerViewFragment();
    recyclerViewFragmentTomorrow.setArguments(bundleTomorrow);
    viewPagerAdapter.addFragment(recyclerViewFragmentTomorrow, getString(R.string.tomorrow));

    //???
    Bundle bundle = new Bundle();
    bundle.putInt("day", 2);
    RecyclerViewFragment recyclerViewFragment = new RecyclerViewFragment();
    recyclerViewFragment.setArguments(bundle);
    viewPagerAdapter.addFragment(recyclerViewFragment, getString(R.string.later));

    int currentPage = viewPager.getCurrentItem();
    //ViewPagerAdapter?ViewPager
    viewPagerAdapter.notifyDataSetChanged();
    viewPager.setAdapter(viewPagerAdapter);
    tabLayout.setupWithViewPager(viewPager);

    if (currentPage == 0 && longTermTodayWeather.isEmpty()) {
        currentPage = 1;
    }
    viewPager.setCurrentItem(currentPage, false);
}

From source file:org.sufficientlysecure.keychain.ui.EncryptFilesFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putBoolean(ARG_DELETE_AFTER_ENCRYPT, mDeleteAfterEncrypt);
    outState.putBoolean(ARG_USE_ASCII_ARMOR, mUseArmor);
    outState.putBoolean(ARG_USE_COMPRESSION, mUseCompression);
    outState.putBoolean(ARG_ENCRYPT_FILENAMES, mEncryptFilenames);

    outState.putParcelableArrayList(ARG_URIS, mFilesAdapter.getAsArrayList());
}

From source file:app.hacked.ProjectDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.project_details_activity);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    getActionBar().setIcon(R.drawable.ic_ab_logo);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    // savedInstanceState is non-null when there is fragment state
    // saved from previous configurations of this activity
    // (e.g. when rotating the screen from portrait to landscape).
    // In this case, the fragment will automatically be re-added
    // to its container so we don't need to manually add it.
    // For more information, see the Fragments API guide at:
    ////  w  ww .j a  v  a  2s . c  o  m
    // http://developer.android.com/guide/components/fragments.html
    //
    if (savedInstanceState == null) {
        // Create the detail fragment and add it to the activity
        // using a fragment transaction.
        Bundle arguments = new Bundle();
        arguments.putInt(ProjectDetailsFragment.PROJECTID,
                getIntent().getIntExtra(ProjectDetailsFragment.PROJECTID, 0));
        arguments.putString(ProjectDetailsFragment.NAME,
                getIntent().getStringExtra(ProjectDetailsFragment.NAME));
        arguments.putString(ProjectDetailsFragment.SYNOPSIS,
                getIntent().getStringExtra(ProjectDetailsFragment.SYNOPSIS));
        arguments.putString(ProjectDetailsFragment.DESCRIPTION,
                getIntent().getStringExtra(ProjectDetailsFragment.DESCRIPTION));
        arguments.putString(ProjectDetailsFragment.LOCATION,
                getIntent().getStringExtra(ProjectDetailsFragment.LOCATION));
        arguments.putString(ProjectDetailsFragment.TECHNOLOGIES,
                getIntent().getStringExtra(ProjectDetailsFragment.TECHNOLOGIES));
        arguments.putInt(ProjectDetailsFragment.POPULARITY,
                getIntent().getIntExtra(ProjectDetailsFragment.POPULARITY, 1));
        //arguments.putString(ProjectDetailsFragment.TEAMMEMBERS, getIntent().getStringExtra(ProjectDetailsFragment.TEAMMEMBERS));
        arguments.putParcelableArrayList(ProjectDetailsFragment.TEAMMEMBERS,
                getIntent().getParcelableArrayListExtra(ProjectDetailsFragment.TEAMMEMBERS));
        arguments.putBoolean(ProjectDetailsFragment.ARG_2PANE,
                getIntent().getBooleanExtra(ProjectDetailsFragment.ARG_2PANE, false));

        ProjectDetailsFragment fragment = new ProjectDetailsFragment();
        fragment.setArguments(arguments);
        fragment.setHasOptionsMenu(true);
        getSupportFragmentManager().beginTransaction().replace(R.id.ProjectDetails, fragment).commit();
    }
}

From source file:com.silentcircle.contacts.group.GroupEditorFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(KEY_ACTION, mAction);
    outState.putParcelable(KEY_GROUP_URI, mGroupUri);
    outState.putLong(KEY_GROUP_ID, mGroupId);

    outState.putSerializable(KEY_STATUS, mStatus);

    outState.putBoolean(KEY_GROUP_NAME_IS_READ_ONLY, mGroupNameIsReadOnly);
    outState.putString(KEY_ORIGINAL_GROUP_NAME, mOriginalGroupName);

    outState.putParcelableArrayList(KEY_MEMBERS_TO_ADD, mListMembersToAdd);
    outState.putParcelableArrayList(KEY_MEMBERS_TO_REMOVE, mListMembersToRemove);
    outState.putParcelableArrayList(KEY_MEMBERS_TO_DISPLAY, mListToDisplay);
}

From source file:info.icefilms.icestream.browse.BrowseFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    // Call base class method
    super.onSaveInstanceState(outState);

    // Save the stop parcel and other settings and lists
    outState.putParcelable("StopParcel", new StopParcel(this));
    outState.putBoolean("InitialConnection", mInitialConnection);
    outState.putParcelableArrayList("Heading1Items", mHeadingItems[0]);
    outState.putParcelableArrayList("Heading2Items", mHeadingItems[1]);
    outState.putParcelableArrayList("Heading3Items", mHeadingItems[2]);
    outState.putParcelableArrayList("ListItems", mListItems);
    outState.putParcelableArray("CurrentState", mCurrentState.toArray(new State[0]));
}

From source file:org.openhab.habdroid.ui.activity.ContentController.java

/**
 * Saves the controller's instance state
 * To be called from the onSaveInstanceState callback of the activity
 *
 * @param state Bundle to save state into
 *///from  ww  w. j  a  va  2  s .  c o  m
public void onSaveInstanceState(Bundle state) {
    ArrayList<OpenHABLinkedPage> pages = new ArrayList<>();
    for (Pair<OpenHABLinkedPage, OpenHABWidgetListFragment> item : mPageStack) {
        pages.add(item.first);
        if (item.second.isAdded()) {
            mFm.putFragment(state, "pageFragment-" + item.first.link(), item.second);
        }
    }
    state.putParcelable("controllerSitemap", mCurrentSitemap);
    if (mSitemapFragment != null && mSitemapFragment.isAdded()) {
        mFm.putFragment(state, "sitemapFragment", mSitemapFragment);
    }
    if (mDefaultProgressFragment.isAdded()) {
        mFm.putFragment(state, "progressFragment", mDefaultProgressFragment);
    }
    state.putParcelableArrayList("controllerPages", pages);
    if (mTemporaryPage != null) {
        mFm.putFragment(state, "temporaryPage", mTemporaryPage);
    }
}

From source file:org.sufficientlysecure.keychain.ui.DecryptListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putParcelableArrayList(ARG_INPUT_URIS, mInputUris);

    HashMap<Uri, InputDataResult> results = new HashMap<>(mInputUris.size());
    for (Uri uri : mInputUris) {
        if (mPendingInputUris.contains(uri)) {
            continue;
        }/*  w ww  .  j  ava 2s.  c  o  m*/
        InputDataResult result = mAdapter.getItemResult(uri);
        if (result != null) {
            results.put(uri, result);
        }
    }

    outState.putParcelable(ARG_RESULTS, new ParcelableHashMap<>(results));
    outState.putParcelable(ARG_OUTPUT_URIS, new ParcelableHashMap<>(mInputDataResults));
    outState.putParcelableArrayList(ARG_CANCELLED_URIS, mCancelledInputUris);
    outState.putBoolean(ARG_CAN_DELETE, mCanDelete);

    // this does not save mCurrentInputUri - if anything is being
    // processed at fragment recreation time, the operation in
    // progress will be lost!
}

From source file:fr.univsavoie.ltp.client.MainActivity.java

protected void onSaveInstanceState(Bundle outState) {
    outState.putParcelable("start", startPoint);
    outState.putParcelable("destination", destinationPoint);
    outState.putParcelableArrayList("viapoints", viaPoints);
    outState.putParcelable("road", mRoad);
    outState.putInt("zoom_level", map.getZoomLevel());
    GeoPoint c = (GeoPoint) map.getMapCenter();
    outState.putParcelable("map_center", c);
    outState.putParcelableArrayList("poi", mPOIs);
}