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:org.fs.todo.presenters.TaskListFragmentPresenterImp.java

@Override
public void storeState(Bundle storeState) {
    if (!Collections.isNullOrEmpty(dataSet)) {
        storeState.putParcelableArrayList(BUNDLE_ARGS_DATA_SET, dataSet);
    }/*from www . j  a  v  a2 s  .c  o m*/
    storeState.putInt(BUNDLE_ARGS_DISPLAY_OPTION, displayOption);
}

From source file:com.liferay.mobile.screens.base.list.BaseListScreenletView.java

@Override
protected Parcelable onSaveInstanceState() {
    Parcelable superState = super.onSaveInstanceState();

    A adapter = getAdapter();//from w  w w.j  av a  2s .c om
    ArrayList<E> entries = (ArrayList<E>) adapter.getEntries();

    Bundle state = new Bundle();
    state.putParcelableArrayList(STATE_ENTRIES, entries);
    state.putSerializable(STATE_ROW_COUNT, adapter.getItemCount());
    state.putParcelable(STATE_SUPER, superState);
    state.putStringArrayList(STATE_LABEL_FIELDS,
            (ArrayList<String>) ((BaseListScreenlet) getScreenlet()).getLabelFields());
    state.putInt(STATE_FIRST_ROW, firstRow);

    return state;
}

From source file:com.antonioleiva.materializeyourapp.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (recyclerView.getAdapter() != null) {
        outState.putParcelableArrayList("data",
                (ArrayList) ((RecyclerViewAdapter) recyclerView.getAdapter()).getItems());
    }/* w w w. ja va2s. c om*/
}

From source file:com.google.cloud.android.dialogflow.MainActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mAdapter != null) {
        outState.putParcelableArrayList(STATE_HISTORY, mAdapter.getHistory());
    }// w  w w  . j ava2s.c om
}

From source file:com.dwdesign.tweetings.fragment.ParcelableStatusesListFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    if (mData != null) {
        outState.putParcelableArrayList(INTENT_KEY_DATA, new ArrayList<ParcelableStatus>(mData));
    }//from   w  ww  .  ja  v  a2  s  . c  om
    super.onSaveInstanceState(outState);
}

From source file:com.morlunk.leeroy.LeeroyUpdateService.java

private void handleCheckUpdates(Intent intent, boolean notify, ResultReceiver receiver) {
    List<LeeroyApp> appList = LeeroyApp.getApps(getPackageManager());

    if (appList.size() == 0) {
        return;//from   ww w.j  a  va  2  s .  c om
    }

    List<LeeroyAppUpdate> updates = new LinkedList<>();
    List<LeeroyApp> notUpdatedApps = new LinkedList<>();
    List<LeeroyException> exceptions = new LinkedList<>();
    for (LeeroyApp app : appList) {
        try {
            String paramUrl = app.getJenkinsUrl() + "/api/json?tree=lastSuccessfulBuild[number,url]";
            URL url = new URL(paramUrl);
            URLConnection conn = url.openConnection();
            Reader reader = new InputStreamReader(conn.getInputStream());

            JsonReader jsonReader = new JsonReader(reader);
            jsonReader.beginObject();
            jsonReader.nextName();
            jsonReader.beginObject();

            int latestSuccessfulBuild = 0;
            String buildUrl = null;
            while (jsonReader.hasNext()) {
                String name = jsonReader.nextName();
                if ("number".equals(name)) {
                    latestSuccessfulBuild = jsonReader.nextInt();
                } else if ("url".equals(name)) {
                    buildUrl = jsonReader.nextString();
                } else {
                    throw new RuntimeException("Unknown key " + name);
                }
            }
            jsonReader.endObject();
            jsonReader.endObject();
            jsonReader.close();

            if (latestSuccessfulBuild > app.getJenkinsBuild()) {
                LeeroyAppUpdate update = new LeeroyAppUpdate();
                update.app = app;
                update.newBuild = latestSuccessfulBuild;
                update.newBuildUrl = buildUrl;
                updates.add(update);
            } else {
                notUpdatedApps.add(app);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
            CharSequence appName = app.getApplicationInfo().loadLabel(getPackageManager());
            exceptions.add(new LeeroyException(app, getString(R.string.invalid_url, appName), e));
        } catch (IOException e) {
            e.printStackTrace();
            exceptions.add(new LeeroyException(app, e));
        }
    }

    if (notify) {
        NotificationManagerCompat nm = NotificationManagerCompat.from(this);
        if (updates.size() > 0) {
            NotificationCompat.Builder ncb = new NotificationCompat.Builder(this);
            ncb.setSmallIcon(R.drawable.ic_stat_update);
            ncb.setTicker(getString(R.string.updates_available));
            ncb.setContentTitle(getString(R.string.updates_available));
            ncb.setContentText(getString(R.string.num_updates, updates.size()));
            ncb.setPriority(NotificationCompat.PRIORITY_LOW);
            ncb.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
            Intent appIntent = new Intent(this, AppListActivity.class);
            appIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            ncb.setContentIntent(
                    PendingIntent.getActivity(this, 0, appIntent, PendingIntent.FLAG_CANCEL_CURRENT));
            ncb.setAutoCancel(true);
            NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
            for (LeeroyAppUpdate update : updates) {
                CharSequence appName = update.app.getApplicationInfo().loadLabel(getPackageManager());
                style.addLine(getString(R.string.notify_app_update, appName, update.app.getJenkinsBuild(),
                        update.newBuild));
            }
            style.setSummaryText(getString(R.string.app_name));
            ncb.setStyle(style);
            ncb.setNumber(updates.size());
            nm.notify(NOTIFICATION_UPDATE, ncb.build());
        }

        if (exceptions.size() > 0) {
            NotificationCompat.Builder ncb = new NotificationCompat.Builder(this);
            ncb.setSmallIcon(R.drawable.ic_stat_error);
            ncb.setTicker(getString(R.string.error_checking_updates));
            ncb.setContentTitle(getString(R.string.error_checking_updates));
            ncb.setContentText(getString(R.string.click_to_retry));
            ncb.setPriority(NotificationCompat.PRIORITY_LOW);
            ncb.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
            ncb.setContentIntent(PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT));
            ncb.setAutoCancel(true);
            ncb.setNumber(exceptions.size());
            nm.notify(NOTIFICATION_ERROR, ncb.build());
        }
    }

    if (receiver != null) {
        Bundle results = new Bundle();
        results.putParcelableArrayList(EXTRA_UPDATE_LIST, new ArrayList<>(updates));
        results.putParcelableArrayList(EXTRA_NO_UPDATE_LIST, new ArrayList<>(notUpdatedApps));
        results.putParcelableArrayList(EXTRA_EXCEPTION_LIST, new ArrayList<>(exceptions));
        receiver.send(0, results);
    }
}

From source file:com.zns.comicdroid.activity.Add.java

@Override
protected void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
    state.putParcelableArrayList(STATE_COMICS, new ArrayList<Comic>(mAdapter.getAll()));
}

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

/**
 * Creates new instance of this fragment
 *///from ww w . j a v  a 2s  .c  o m
public static DecryptListFragment newInstance(@NonNull ArrayList<Uri> uris, boolean canDelete) {
    DecryptListFragment frag = new DecryptListFragment();

    Bundle args = new Bundle();
    args.putParcelableArrayList(ARG_INPUT_URIS, uris);
    args.putBoolean(ARG_CAN_DELETE, canDelete);
    frag.setArguments(args);

    return frag;
}

From source file:eu.thedarken.rootvalidator.ValidatorFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (mAdapter != null && !mAdapter.getData().isEmpty()) {
        outState.putParcelableArrayList("data", mAdapter.getData());
    }/*from   ww  w . j  a va  2s.com*/
    super.onSaveInstanceState(outState);
}

From source file:net.granoeste.commons.ui.IconContextMenuDialogFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArrayList(ICON_CONTEXT_MENU_ITEMS, mMenuItems);
    outState.putString(ICON_CONTEXT_MENU_TITLE, mTitle);
}