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:com.filemanager.free.fragments.Main.java

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

    int index;/* ww  w.  j a  va2 s .  c  om*/
    View vi;
    if (listView != null) {
        if (IS_LIST) {
            index = (mLayoutManager).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        } else {
            index = (mLayoutManagerGrid).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        }
        int top = (vi == null) ? 0 : vi.getTop();
        outState.putInt("index", index);
        outState.putInt("top", top);
        outState.putBoolean("IS_LIST", IS_LIST);
        outState.putParcelableArrayList("list", LIST_ELEMENTS);
        outState.putString("CURRENT_PATH", CURRENT_PATH);
        outState.putBoolean("selection", selection);
        outState.putInt("openMode", openMode);
        outState.putInt("folder_count", folder_count);
        outState.putInt("file_count", file_count);
        if (selection) {
            outState.putIntegerArrayList("position", adapter.getCheckedItemPositions());
        }
        outState.putBoolean("results", results);

        if (openMode == 1) {
            outState.putString("SmbPath", smbPath);
        }
    }
}

From source file:com.igniva.filemanager.fragments.Main.java

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

    int index;// w  w w  .ja v a  2s  .  c  o  m
    View vi;
    if (listView != null) {
        if (IS_LIST) {

            index = (mLayoutManager).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        } else {
            index = (mLayoutManagerGrid).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        }
        int top = (vi == null) ? 0 : vi.getTop();
        outState.putInt("index", index);
        outState.putInt("top", top);
        //outState.putBoolean("IS_LIST", IS_LIST);
        outState.putParcelableArrayList("list", LIST_ELEMENTS);
        outState.putString("CURRENT_PATH", CURRENT_PATH);
        outState.putBoolean("selection", selection);
        outState.putInt("openMode", openMode);
        outState.putInt("folder_count", folder_count);
        outState.putInt("file_count", file_count);
        if (selection) {
            outState.putIntegerArrayList("position", adapter.getCheckedItemPositions());
        }
        outState.putBoolean("results", results);
        if (openMode == 1) {
            outState.putString("SmbPath", smbPath);
        }
    }
}

From source file:de.mrapp.android.dialog.decorator.WizardDialogDecorator.java

@Override
public final void onSaveInstanceState(@NonNull final Bundle outState) {
    outState.putInt(TAB_POSITION_EXTRA, getTabPosition().getValue());
    outState.putBoolean(TAB_LAYOUT_ENABLED_EXTRA, isTabLayoutEnabled());
    outState.putBoolean(TAB_LAYOUT_SHOWN_EXTRA, isTabLayoutShown());
    outState.putInt(TAB_INDICATOR_HEIGHT_EXTRA, getTabIndicatorHeight());
    outState.putInt(TAB_INDICATOR_COLOR_EXTRA, getTabIndicatorColor());
    outState.putInt(TAB_TEXT_COLOR_EXTRA, getTabTextColor());
    outState.putInt(TAB_SELECTED_TEXT_COLOR_EXTRA, getTabSelectedTextColor());
    outState.putBoolean(SWIPE_ENABLED_EXTRA, isSwipeEnabled());
    outState.putBoolean(BUTTON_BAR_SHOWN_EXTRA, isButtonBarShown());
    outState.putInt(BUTTON_TEXT_COLOR_EXTRA, getButtonTextColor());
    outState.putBoolean(SHOW_BUTTON_BAR_DIVIDER_EXTRA, isButtonBarDividerShown());
    outState.putInt(BUTTON_BAR_DIVIDER_COLOR_EXTRA, getButtonBarDividerColor());
    outState.putCharSequence(BACK_BUTTON_TEXT_EXTRA, getBackButtonText());
    outState.putCharSequence(NEXT_BUTTON_TEXT_EXTRA, getNextButtonText());
    outState.putCharSequence(FINISH_BUTTON_TEXT_EXTRA, getFinishButtonText());
    outState.putParcelableArrayList(VIEW_PAGER_ITEMS_EXTRA,
            getDialog().getRetainInstance() ? null : viewPagerItems);
}

From source file:com.amaze.filemanager.fragments.MainFragment.java

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

    int index;/*from w  w w .ja  va  2  s  .c  o m*/
    View vi;
    if (listView != null) {
        if (IS_LIST) {
            index = (mLayoutManager).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        } else {
            index = (mLayoutManagerGrid).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        }

        int top = (vi == null) ? 0 : vi.getTop();

        outState.putInt("index", index);
        outState.putInt("top", top);
        outState.putParcelableArrayList("list", LIST_ELEMENTS);
        outState.putString("CURRENT_PATH", CURRENT_PATH);
        outState.putBoolean("selection", selection);
        outState.putInt("openMode", openMode.ordinal());
        outState.putInt("folder_count", folder_count);
        outState.putInt("file_count", file_count);

        if (selection) {
            outState.putIntegerArrayList("position", adapter.getCheckedItemsIndex());
        }

        outState.putBoolean("results", results);

        if (openMode == OpenMode.SMB) {
            outState.putString("SmbPath", smbPath);
        }
    }
}

From source file:org.openhab.habdroid.ui.OpenHABMainActivity.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    Log.d(TAG, "onSaveInstanceState");
    // Save opened framents into state retaining fragment (I love Google! :-)
    Log.d(TAG, String.format("Saving %d fragments", pagerAdapter.getFragmentList().size()));
    Log.d(TAG, String.format("Saving current page = %d", pager.getCurrentItem()));
    stateFragment.setFragmentList(pagerAdapter.getFragmentList());
    stateFragment.setCurrentPage(pager.getCurrentItem());
    // Save UI state changes to the savedInstanceState.
    // This bundle will be passed to onCreate if the process is
    // killed and restarted.
    savedInstanceState.putString("openHABBaseUrl", openHABBaseUrl);
    savedInstanceState.putString("sitemapRootUrl", sitemapRootUrl);
    savedInstanceState.putInt("currentFragment", pager.getCurrentItem());
    savedInstanceState.putParcelable("startedWithNetworkConnectivityInfo", mStartedWithNetworkConnectivityInfo);
    savedInstanceState.putInt("openHABVersion", mOpenHABVersion);
    savedInstanceState.putParcelableArrayList("sitemapList", mSitemapList);
    super.onSaveInstanceState(savedInstanceState);
}

From source file:de.sourcestream.movieDB.MainActivity.java

/**
 * Fired when activity is recreated.//from  w  w w  .j  av  a2s .  c o m
 *
 * @param outState Bundle in which to place your saved state.
 */
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt("oldPos", oldPos);
    outState.putInt("currentMovViewPagerPos", currentMovViewPagerPos);
    outState.putInt("currentTVViewPagerPos", currentTVViewPagerPos);
    outState.putBoolean("restoreMovieDetailsAdapterState", restoreMovieDetailsAdapterState);
    outState.putBoolean("restoreMovieDetailsState", restoreMovieDetailsState);
    outState.putParcelableArrayList("movieDetailsBundle", movieDetailsBundle);
    outState.putParcelableArrayList("castDetailsBundle", castDetailsBundle);
    outState.putParcelableArrayList("tvDetailsBundle", tvDetailsBundle);
    outState.putInt("currOrientation", currOrientation);
    outState.putInt("lastVisitedSimMovie", lastVisitedSimMovie);
    outState.putInt("lastVisitedSimTV", lastVisitedSimTV);
    outState.putInt("lastVisitedMovieInCredits", lastVisitedMovieInCredits);
    outState.putBoolean("saveInMovieDetailsSimFragment", saveInMovieDetailsSimFragment);
}

From source file:com.amaze.carbonfilemanager.fragments.MainFragment.java

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

    int index;//from w ww.  j av  a 2  s . c o  m
    View vi;
    if (listView != null) {
        if (IS_LIST) {
            index = (mLayoutManager).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        } else {
            index = (mLayoutManagerGrid).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        }

        int top = (vi == null) ? 0 : vi.getTop();

        outState.putInt("index", index);
        outState.putInt("top", top);
        //outState.putBoolean("IS_LIST", IS_LIST);
        outState.putParcelableArrayList("list", getLayoutElements());
        outState.putString("CURRENT_PATH", CURRENT_PATH);
        outState.putBoolean("selection", selection);
        outState.putInt("openMode", openMode.ordinal());
        outState.putInt("folder_count", folder_count);
        outState.putInt("file_count", file_count);

        if (selection) {
            outState.putIntegerArrayList("position", adapter.getCheckedItemPositions());
        }

        outState.putBoolean("results", results);

        if (openMode == OpenMode.SMB) {
            outState.putString("SmbPath", smbPath);
        }
    }
}

From source file:com.stockita.stockitapointofsales.activities.MainActivity.java

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

    /**//from  www.  ja va  2 s .c om
     * Code below to save all the fragment's state
     */

    if (mItemMasterListFragmentUI != null) {
        getFragmentManager().putFragment(outState, KEY_ONE, mItemMasterListFragmentUI);
    }

    if (mSalesListFragmentUI != null) {
        getFragmentManager().putFragment(outState, KEY_TWO, mSalesListFragmentUI);
    }

    if (mOpenSalesHeaderListFragmentUI != null) {
        getFragmentManager().putFragment(outState, KEY_THREE, mOpenSalesHeaderListFragmentUI);
    }

    // If there's an upload in progress, save the reference so you can query it later
    if (mImageStorageRef != null) {
        outState.putString(KEY_FOUR, mImageStorageRef.toString());
    }

    if (aaItemMasterUserUid != null) {
        outState.putString(KEY_AA_ONE, aaItemMasterUserUid);
    }

    if (aaItemMasterPushKey != null) {
        outState.putString(KEY_AA_TWO, aaItemMasterPushKey);
    }

    if (qqUserUid != null) {
        outState.putSerializable(KEY_MM_ONE, qqUserUid);
    }

    if (qqSalesHeaderModel != null) {
        outState.putParcelable(KEY_MM_TWO, qqSalesHeaderModel);
    }

    if (qqSalesDetailModelList != null) {
        outState.putParcelableArrayList(KEY_MM_THREE, qqSalesDetailModelList);
    }

    if (qqCashPaid != null) {
        outState.putString(KEY_MM_FOUR, qqCashPaid);
    }

    if (qqChangeCash != null) {
        outState.putString(KEY_MM_FIVE, qqChangeCash);
    }

}

From source file:de.sourcestream.movieDB.controller.TVDetails.java

/**
 * Called to ask the fragment to save its current dynamic state,
 * so it can later be reconstructed in a new instance of its process is restarted.
 *
 * @param outState Bundle in which to place your saved state.
 */// w  ww.j av  a  2 s . com
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    // Used to avoid bug where we add item in the back stack
    // and if we change orientation twice the item from the back stack has null values
    if (save != null && save.getInt("timeOut") == 1)
        save = null;
    save = null;

    if (save != null) {
        if (tvDetailsCast != null)
            save.putInt("lastVisitedPerson", tvDetailsCast.getLastVisitedPerson());
        outState.putBundle("save", save);
        if (addToBackStack) {
            activity.addTvDetailsBundle(save);
            addToBackStack = false;
        }
    } else {
        Bundle send = new Bundle();
        send.putInt("currentId", currentId);
        if (request != null && request.getStatus() == AsyncTask.Status.RUNNING) {
            timeOut = 1;
            request.cancel(true);
        }
        send.putInt("timeOut", timeOut);
        send.putString("title", title);
        if (timeOut == 0) {
            // HomePage
            send.putInt("homeIconCheck", homeIconCheck);
            if (homeIconCheck == 0)
                send.putString("homepage", homeIconUrl);

            // Gallery icon
            send.putInt("galleryIconCheck", galleryIconCheck);
            if (galleryIconCheck == 0)
                send.putStringArrayList("galleryList", galleryList);

            // More icon
            send.putInt("moreIconCheck", moreIconCheck);
            // used to pass the data to the castList view
            send.putParcelableArrayList("seasonList", seasonList);

        }

        // TV details info begins here
        if (tvDetailsInfo != null) {
            // Backdrop path
            send.putInt("backDropCheck", tvDetailsInfo.getBackDropCheck());
            if (tvDetailsInfo.getBackDropCheck() == 0 && tvDetailsInfo.getBackDropPath().getTag() != null)
                send.putString("backDropUrl", tvDetailsInfo.getBackDropPath().getTag().toString());

            // Poster path url
            if (tvDetailsInfo.getPosterPath().getTag() != null)
                send.putString("posterPathURL", tvDetailsInfo.getPosterPath().getTag().toString());

            // Rating
            send.putFloat("rating", tvDetailsInfo.getRatingBar().getRating());
            send.putString("voteCount", tvDetailsInfo.getVoteCount().getText().toString());

            // Title
            send.putString("titleText", tvDetailsInfo.getTitle().getText().toString());

            // Status
            send.putString("status", tvDetailsInfo.getStatusText().getText().toString());

            // Type
            send.putString("typeText", tvDetailsInfo.getTypeText().getText().toString());

            // Episode runtime
            send.putString("episodeRuntime", tvDetailsInfo.getEpisodeRuntime().getText().toString());

            // Number of episodes
            send.putString("numberOfEpisodesText",
                    tvDetailsInfo.getNumberOfEpisodesText().getText().toString());

            // Number of seasons
            send.putString("numberOfSeasonsText", tvDetailsInfo.getNumberOfSeasonsText().getText().toString());

            // First air date
            send.putString("firstAirDateText", tvDetailsInfo.getFirstAirDateText().getText().toString());

            // Last air date
            send.putString("lastAirDateText", tvDetailsInfo.getLastAirDateText().getText().toString());

            // Genres
            send.putString("genres", tvDetailsInfo.getGenres().getText().toString());

            // Production countries
            send.putString("productionCountries", tvDetailsInfo.getCountries().getText().toString());

            // Production companies
            send.putString("productionCompanies", tvDetailsInfo.getCompanies().getText().toString());

            // Similar list
            if (tvDetailsInfo.getSimilarList() != null && tvDetailsInfo.getSimilarList().size() > 0)
                send.putParcelableArrayList("similarList", tvDetailsInfo.getSimilarList());

        }
        // TV details info ends here

        // TV details cast starts here
        if (tvDetailsCast != null) {
            send.putParcelableArrayList("castList", castList);
            send.putInt("lastVisitedPerson", tvDetailsCast.getLastVisitedPerson());
        }
        // TV details cast ends here

        if (tvDetailsOverview != null)
            send.putString("overview", tvDetailsOverview.getOverview().getText().toString());

        outState.putBundle("save", send);
        save = send;
        if (addToBackStack) {
            activity.addTvDetailsBundle(send);
            addToBackStack = false;
        }
    }

}