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

The following examples show how to use android.os.Bundle#putParcelableArrayList() . 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: BypassedAndOfflineDeviceScrollablePopup.java    From arcusandroid with Apache License 2.0 6 votes vote down vote up
public static BypassedAndOfflineDeviceScrollablePopup newInstance(Version1ButtonColor topButtonColor,
                                                                  String topButtonText, Version1ButtonColor bottomButtonColor, String bottomButtonText,
                                                                  ArrayList<AlertDeviceStateModel> deviceStateModelList,
                                                                  BypassedAndOfflineDeviceScrollablePopup.Callback callback) {
    BypassedAndOfflineDeviceScrollablePopup fragment = new BypassedAndOfflineDeviceScrollablePopup();

    Bundle bundle = new Bundle();
    bundle.putSerializable(TOP_COLOR_KEY, topButtonColor);
    bundle.putSerializable(TOP_TITLE_KEY, topButtonText);
    bundle.putSerializable(BOTTOM_COLOR_KEY, bottomButtonColor);
    bundle.putSerializable(BOTTOM_TITLE_KEY, bottomButtonText);
    bundle.putParcelableArrayList(DEVICES, deviceStateModelList);
    fragment.setArguments(bundle);

    fragment.callback = callback;

    return fragment;
}
 
Example 2
Source File: SearchActivity.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
private void route(int position, MyPoiModel poiInfo) {
    AppUtils.closeKeyboard(mEditSearch, this);
    Bundle bundle = new Bundle();
    if ("MainActivity".equals(mFrom) && !(poiInfo.getTypePoi() == TypePoi.BUS_LINE || poiInfo.getTypePoi() == TypePoi.SUBWAY_LINE)) {
        if (null != mResultAdapter) {
            bundle.putParcelableArrayList("poiAll", (ArrayList<MyPoiModel>) mResultAdapter.getList());
        }
        bundle.putInt("position", position);

    } else {
        bundle.putParcelable("poi", poiInfo);
    }

    Intent intent = new Intent();
    intent.putExtras(bundle);
    setResult(MainActivity.REQUEST_SEARCH, intent);
    finish();

}
 
Example 3
Source File: SuperActivityToast.java    From SuperToasts with Apache License 2.0 6 votes vote down vote up
/**
 * Saves the state of all SuperToasts that are showing and/or pending.
 *
 * This should be called in the {@link android.app.Activity#onSaveInstanceState(android.os.Bundle)}
 * method of your Activity.
 * 
 * @param bundle The Bundle provided in onSaveInstanceState()
 */
@SuppressWarnings("unchecked")
public static void onSaveState(Bundle bundle) {
    final ArrayList<Style> styleList = new ArrayList();

    // Create a list of every Style used by a SuperToast in the queue
    for (SuperToast superToast : Toaster.getInstance().getQueue()) {
        if (superToast instanceof SuperActivityToast) {
            superToast.getStyle().isSuperActivityToast = true;
        }
        styleList.add(superToast.getStyle());
    }

    bundle.putParcelableArrayList(BUNDLE_KEY, styleList);

    // Let's avoid any erratic behavior and cancel any showing/pending SuperActivityToasts manually
    Toaster.getInstance().cancelAllSuperToasts();
}
 
Example 4
Source File: MainActivityFragment.java    From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putParcelableArrayList("infoList", infoList);
    if (mPosition != ListView.INVALID_POSITION) {
        outState.putInt(SELECTED_KEY, mPosition);
    }
    super.onSaveInstanceState(outState);
}
 
Example 5
Source File: TVList.java    From moviedb-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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.
 */
@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)
        outState.putBundle("save", save);
    else {
        Bundle send = new Bundle();
        send.putInt("checkLoadMore", checkLoadMore);
        send.putInt("totalPages", totalPages);
        send.putString("currentListURL", getCurrentList());
        send.putString("title", getTitle());
        send.putBoolean("isLoading", isLoading);
        send.putInt("lastVisitedTV", lastVisitedTV);
        if (backState == 1) {
            send.putInt("backState", 1);
            send.putParcelableArrayList("listData", tvList);
            // used to restore the scroll listener variables
            send.putInt("currentPage", endlessScrollListener.getCurrentPage());
            send.putInt("oldCount", endlessScrollListener.getOldCount());
            send.putBoolean("loading", endlessScrollListener.getLoading());
            // Save scroll position
            if (listView != null) {
                Parcelable listState = listView.onSaveInstanceState();
                send.putParcelable("listViewScroll", listState);
            }
        } else
            send.putInt("backState", 0);

        outState.putBundle("save", send);
    }
}
 
Example 6
Source File: MainActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.

    int id = item.getItemId();

    if (id == R.id.nav_insertdata) {
        fragment=new InsertFragment();
    } else if (id == R.id.nav_viewdata) {
        fragment=new DisplayFragment();
        ArrayList<Data> output=(ArrayList)database.readData();
        Bundle bundle=new Bundle();
        bundle.putParcelableArrayList("data",output);
        bundle.putString(" ",output.toString());
        fragment.setArguments(bundle);

    }
    if(fragment!=null)
    {
        FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.content_main,fragment);
        ft.commit();
    }
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
 
Example 7
Source File: BarcodeResultFragment.java    From mlkit-material-android with Apache License 2.0 5 votes vote down vote up
public static void show(
    FragmentManager fragmentManager, ArrayList<BarcodeField> barcodeFieldArrayList) {
  BarcodeResultFragment barcodeResultFragment = new BarcodeResultFragment();
  Bundle bundle = new Bundle();
  bundle.putParcelableArrayList(ARG_BARCODE_FIELD_LIST, barcodeFieldArrayList);
  barcodeResultFragment.setArguments(bundle);
  barcodeResultFragment.show(fragmentManager, TAG);
}
 
Example 8
Source File: DeletePlaylistDialog.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
public static DeletePlaylistDialog create(ArrayList<Playlist> playlists) {
    DeletePlaylistDialog dialog = new DeletePlaylistDialog();
    Bundle args = new Bundle();
    args.putParcelableArrayList("playlists", playlists);
    dialog.setArguments(args);
    return dialog;
}
 
Example 9
Source File: DeletePlaylistDialog.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
public static DeletePlaylistDialog create(ArrayList<Playlist> playlists) {
    DeletePlaylistDialog dialog = new DeletePlaylistDialog();
    Bundle args = new Bundle();
    args.putParcelableArrayList("playlists", playlists);
    dialog.setArguments(args);
    return dialog;
}
 
Example 10
Source File: AddToPlaylistDialog.java    From Music-Player with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
public static AddToPlaylistDialog create(List<Song> songs) {
    AddToPlaylistDialog dialog = new AddToPlaylistDialog();
    Bundle args = new Bundle();
    args.putParcelableArrayList("songs", new ArrayList<>(songs));
    dialog.setArguments(args);
    return dialog;
}
 
Example 11
Source File: DetailFragment.java    From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putParcelableArrayList("matchListA", matchListA);
    outState.putParcelableArrayList("matchListB", matchListB);
    if (mPositionA != ListView.INVALID_POSITION) {
        outState.putInt(SELECTED_KEY_A, mPositionA);
    }
    if (mPositionB != ListView.INVALID_POSITION) {
        outState.putInt(SELECTED_KEY_B, mPositionB);
    }
    super.onSaveInstanceState(outState);
}
 
Example 12
Source File: SearchConfiguration.java    From SearchPreference with MIT License 5 votes vote down vote up
private Bundle toBundle() {
    Bundle arguments = new Bundle();
    arguments.putParcelableArrayList(ARGUMENT_INDEX_ITEMS, itemsToIndex);
    arguments.putBoolean(ARGUMENT_HISTORY_ENABLED, historyEnabled);
    arguments.putParcelable(ARGUMENT_REVEAL_ANIMATION_SETTING, revealAnimationSetting);
    arguments.putBoolean(ARGUMENT_FUZZY_ENABLED, fuzzySearchEnabled);
    arguments.putBoolean(ARGUMENT_BREADCRUMBS_ENABLED, breadcrumbsEnabled);
    arguments.putBoolean(ARGUMENT_SEARCH_BAR_ENABLED, searchBarEnabled);
    arguments.putString(ARGUMENT_TEXT_HINT, textHint);
    arguments.putString(ARGUMENT_TEXT_CLEAR_HISTORY, textClearHistory);
    arguments.putString(ARGUMENT_TEXT_NO_RESULTS, textNoResults);
    return arguments;
}
 
Example 13
Source File: PickCalendarDialogFragment.java    From utexas-utilities with Apache License 2.0 5 votes vote down vote up
public static PickCalendarDialogFragment newInstance(ArrayList<Integer> indices,
        ArrayList<String> calendars, ArrayList<ContentValues> valuesList) {
    PickCalendarDialogFragment pcdf = new PickCalendarDialogFragment();
    Bundle args = new Bundle();
    args.putIntegerArrayList("indices", indices);
    args.putStringArrayList("calendars", calendars);
    args.putParcelableArrayList("valuesList", valuesList);
    pcdf.setArguments(args);
    return pcdf;
}
 
Example 14
Source File: OpenSalesDetailActivity.java    From stockita-point-of-sale with MIT License 5 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    /**
     * Code below to save all the fragment's state
     */

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

    outState.putString(KEY_TWO, mUserUID);
    outState.putString(KEY_THREE, mHeaderKey);

    if (qqOldHeaderKey != null) {
        outState.putString(KEY_MM_ONE, qqOldHeaderKey);
    }

    if (qqUserUid != null) {
        outState.putString(KEY_MM_TWO, qqUserUid);
    }

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

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

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

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

}
 
Example 15
Source File: WallpaperPickerActivity.java    From LB-Launcher with Apache License 2.0 4 votes vote down vote up
protected void onSaveInstanceState(Bundle outState) {
    outState.putParcelableArrayList(TEMP_WALLPAPER_TILES, mTempWallpaperTiles);
    outState.putInt(SELECTED_INDEX, mSelectedIndex);
}
 
Example 16
Source File: MainActivity.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArrayList(BUNDLE_KEY, mSportsData);
}
 
Example 17
Source File: LibraryPreferenceDialog.java    From Phonograph with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArrayList(PreferenceUtil.LIBRARY_CATEGORIES, new ArrayList<>(adapter.getCategoryInfos()));
}
 
Example 18
Source File: StoryListFragment.java    From hacker-news-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(TOP_OF_LIST, mLayoutManager.findFirstVisibleItemPosition());
    outState.putParcelableArrayList(STORY_LIST, getViewModel().getStoryList());
}
 
Example 19
Source File: ArrayFragmentStatePagerAdapter.java    From ArrayPagerAdapter with Apache License 2.0 4 votes vote down vote up
@Override
public void saveItems(Bundle state, ArrayList<Parcelable> items) {
    state.putParcelableArrayList(SAVE_KEY, items);
}
 
Example 20
Source File: MainActivity.java    From epoxy with Apache License 2.0 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle state) {
  super.onSaveInstanceState(state);
  state.putParcelableArrayList(CAROUSEL_DATA_KEY, (ArrayList<? extends Parcelable>) carousels);
  controller.onSaveInstanceState(state);
}