Example usage for android.os Bundle putStringArrayList

List of usage examples for android.os Bundle putStringArrayList

Introduction

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

Prototype

@Override
public void putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value) 

Source Link

Document

Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.abplus.surroundcalc.billing.BillingHelper.java

int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException {
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(ITEM_TYPE_INAPP));
    if (moreSkus != null)
        skuList.addAll(moreSkus);// ww  w .  ja va  2s .c  om

    if (skuList.size() == 0) {
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = connection.getSkuDetails(querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            return response;
        } else {
            return HELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(thisResponse);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:br.com.cpb.esperanca.iab.IabHelper.java

int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus());
    if (moreSkus != null) {
        skuList.addAll(moreSkus);/*w  ww . ja va  2 s  . c o m*/
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), ITEM_TYPE_INAPP, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:com.nextgis.mobile.InputPointActivity.java

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

    if (descriptfrag != null)
        descriptfrag.onStoreValues();/*from   www  .  j  a v a2  s. c  om*/
    if (positionfrag != null)
        positionfrag.onStoreValues();
    if (camfrag != null)
        camfrag.onStoreValues();
    if (notefrag != null)
        notefrag.onStoreValues();

    outState.putString("cat", m_sCat);
    outState.putString("subcat", m_sSubCat);
    outState.putFloat("az", m_fAzimuth);
    outState.putFloat("dist", m_fDist);
    outState.putString("note", m_sNote);
    outState.putStringArrayList("photos", image_lst);
    int nAzArraySize = image_rotation.size();
    double[] adfAz = new double[nAzArraySize];
    for (int i = 0; i < nAzArraySize; i++)
        adfAz[i] = image_rotation.get(i);

    outState.putDoubleArray("photos_az", adfAz);
}

From source file:com.soomla.billing.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    StoreUtils.LogDebug(TAG, "Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null)
        skuList.addAll(moreSkus);/*w  ww.  j  a va  2 s  .  c  o  m*/

    if (skuList.size() == 0) {
        StoreUtils.LogDebug(TAG, "queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, SoomlaApp.getAppContext().getPackageName(), itemType,
            querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            StoreUtils.LogDebug(TAG, "getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            StoreUtils.LogError(TAG,
                    "getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        StoreUtils.LogDebug(TAG, "Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:org.fs.galleon.presenters.ToolsFragmentPresenter.java

@Override
public void storeState(Bundle storeState) {
    if (tempTakenPhoto != null) {
        storeState.putString(KEY_TEMP_TAKEN_PHOTO, tempTakenPhoto.getAbsolutePath());
    }/*  w  w  w  .  j av a2s.c o m*/
    if (!Collections.isNullOrEmpty(images)) {
        storeState.putParcelableArrayList(KEY_IMAGE_ENTITIES, new ArrayList<>(images));
    }
    if (!Collections.isNullOrEmpty(pdfs)) {
        List<String> absolutePaths = StreamSupport.stream(pdfs).map(File::getAbsolutePath)
                .collect(Collectors.toList());
        storeState.putStringArrayList(KEY_PDF_FILES, new ArrayList<>(absolutePaths));
    }
}

From source file:co.hmsk.android.webdbpress76.util.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null)
        skuList.addAll(moreSkus);/*from w w w .j av  a2s. c om*/

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:me.ccrama.redditslide.util.IabHelper.java

private int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);// w w w  .j  a v  a 2 s . com
            }
        }
    }

    if (skuList.isEmpty()) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    List<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:org.horaapps.leafpic.util.inapppurchase.IabHelper.java

private int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);/*ww w.j  a v a 2 s.c o  m*/
            }
        }
    }

    if (skuList.isEmpty()) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    List<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:org.runbuddy.tomahawk.ui.fragments.ContextMenuFragment.java

private void setupContextMenuItems(final View view) {
    if (view == null) {
        return;//from  ww w  .  ja va 2s  .c o  m
    }

    final TomahawkMainActivity activity = (TomahawkMainActivity) getActivity();

    // set up "Add to playlist" context menu item
    if (mAlbum != null) {
        mCollection.getAlbumTracks(mAlbum).done(new DoneCallback<Playlist>() {
            @Override
            public void onDone(Playlist result) {
                List<Query> queries = null;
                if (result != null && result.isFilled()) {
                    queries = new ArrayList<>();
                    for (PlaylistEntry entry : result.getEntries()) {
                        queries.add(entry.getQuery());
                    }
                }
                setupAddToPlaylistButton(view, queries);
            }
        });
    } else if (mPlaylist != null) {
        List<Query> queries = null;
        if (mPlaylist.isFilled()) {
            queries = new ArrayList<>();
            for (PlaylistEntry entry : mPlaylist.getEntries()) {
                queries.add(entry.getQuery());
            }
        }
        setupAddToPlaylistButton(view, queries);
    } else if (mQuery != null || mPlaylistEntry != null) {
        Query q = mQuery;
        if (mPlaylistEntry != null) {
            q = mPlaylistEntry.getQuery();
        }
        ArrayList<Query> queries = new ArrayList<>();
        queries.add(q);
        setupAddToPlaylistButton(view, queries);
    }

    // set up "Create station" context menu item
    if (mAlbum != null || mArtist != null || mPlaylist != null || mPlaylistEntry != null || mQuery != null) {
        setupCreateStationButton(view, mAlbum, mArtist, mPlaylist, mPlaylistEntry, mQuery);
    }

    // set up "Add to collection" context menu item
    if (mAlbum != null || mArtist != null) {
        int drawableResId;
        int stringResId;
        UserCollection userCollection = CollectionManager.get().getUserCollection();
        if ((mAlbum != null && userCollection.isLoved(mAlbum))
                || (mArtist != null && userCollection.isLoved(mArtist))) {
            drawableResId = R.drawable.ic_action_collection_underlined;
            stringResId = R.string.context_menu_removefromcollection;
        } else {
            drawableResId = R.drawable.ic_action_collection;
            stringResId = R.string.context_menu_addtocollection;
        }
        View v = ViewUtils.ensureInflation(view, R.id.context_menu_addtocollection_stub,
                R.id.context_menu_addtocollection);
        TextView textView = (TextView) v.findViewById(R.id.textview);
        ImageView imageView = (ImageView) v.findViewById(R.id.imageview);
        imageView.setImageResource(drawableResId);
        textView.setText(stringResId);
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().getSupportFragmentManager().popBackStack();
                if (mAlbum != null) {
                    CollectionManager.get().toggleLovedItem(mAlbum);
                } else {
                    CollectionManager.get().toggleLovedItem(mArtist);
                }
            }
        });
    }

    // set up "Add to favorites" context menu item
    if (mQuery != null || mPlaylistEntry != null) {
        final Query query = mQuery != null ? mQuery : mPlaylistEntry.getQuery();
        int drawableResId;
        int stringResId;
        if (DatabaseHelper.get().isItemLoved(query)) {
            drawableResId = R.drawable.ic_action_favorites_underlined;
            stringResId = R.string.context_menu_unlove;
        } else {
            drawableResId = R.drawable.ic_action_favorites;
            stringResId = R.string.context_menu_love;
        }
        View v = ViewUtils.ensureInflation(view, R.id.context_menu_favorite_stub, R.id.context_menu_favorite);
        TextView textView = (TextView) v.findViewById(R.id.textview);
        ImageView imageView = (ImageView) v.findViewById(R.id.imageview);
        imageView.setImageResource(drawableResId);
        textView.setText(stringResId);
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().getSupportFragmentManager().popBackStack();
                CollectionManager.get().toggleLovedItem(query);
            }
        });
    }

    // set up "Share" context menu item
    if (mStationPlaylist == null) {
        View v = ViewUtils.ensureInflation(view, R.id.context_menu_share_stub, R.id.context_menu_share);
        TextView textView = (TextView) v.findViewById(R.id.textview);
        ImageView imageView = (ImageView) v.findViewById(R.id.imageview);
        imageView.setImageResource(R.drawable.ic_action_share);
        textView.setText(R.string.context_menu_share);
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                boolean error = false;
                if (mAlbum != null) {
                    ShareUtils.sendShareIntent(activity, mAlbum);
                } else if (mArtist != null) {
                    ShareUtils.sendShareIntent(activity, mArtist);
                } else if (mQuery != null) {
                    ShareUtils.sendShareIntent(activity, mQuery);
                } else if (mPlaylistEntry != null) {
                    ShareUtils.sendShareIntent(activity, mPlaylistEntry.getQuery());
                } else if (mPlaylist != null) {
                    if (mPlaylist.getHatchetId() == null) {
                        new Handler(Looper.getMainLooper()).post(new Runnable() {
                            @Override
                            public void run() {
                                Toast.makeText(TomahawkApp.getContext(), R.string.contest_menu_share_error,
                                        Toast.LENGTH_LONG).show();
                            }
                        });
                        error = true;
                    } else {
                        ShareUtils.sendShareIntent(activity, mPlaylist);
                    }
                }
                if (!error) {
                    getActivity().getSupportFragmentManager().popBackStack();
                }
            }
        });
    }

    // set up "Remove" context menu item
    if (!mHideRemoveButton && (mPlaylist != null || mPlaylistEntry != null || mStationPlaylist != null)) {
        int stringResId;
        if (mPlaylistEntry != null) {
            stringResId = R.string.context_menu_removefromplaylist;
        } else {
            stringResId = R.string.context_menu_delete;
        }
        View v = ViewUtils.ensureInflation(view, R.id.context_menu_remove_stub, R.id.context_menu_remove);
        TextView textView = (TextView) v.findViewById(R.id.textview);
        ImageView imageView = (ImageView) v.findViewById(R.id.imageview);
        imageView.setImageResource(R.drawable.ic_navigation_close);
        textView.setText(stringResId);
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().getSupportFragmentManager().popBackStack();
                if (mStationPlaylist != null) {
                    DatabaseHelper.get().deleteStation(mStationPlaylist);
                } else {
                    String localPlaylistId = mPlaylist != null ? mPlaylist.getId()
                            : mPlaylistEntry.getPlaylistId();
                    if (mPlaylistEntry != null) {
                        CollectionManager.get().deletePlaylistEntry(localPlaylistId, mPlaylistEntry.getId());
                    } else {
                        CollectionManager.get().deletePlaylist(localPlaylistId);
                    }
                }
            }
        });
    }

    // set up "Add to queue" context menu item
    if (mAlbum != null || mQuery != null || mPlaylistEntry != null || mPlaylist != null) {
        int drawableResId = R.drawable.ic_action_queue;
        int stringResId = R.string.context_menu_add_to_queue;
        View v = ViewUtils.ensureInflation(view, R.id.context_menu_addtoqueue_stub,
                R.id.context_menu_addtoqueue);
        TextView textView = (TextView) v.findViewById(R.id.textview);
        ImageView imageView = (ImageView) v.findViewById(R.id.imageview);
        imageView.setImageResource(drawableResId);
        textView.setText(stringResId);
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().getSupportFragmentManager().popBackStack();
                if (mAlbum != null) {
                    mCollection.getAlbumTracks(mAlbum).done(new DoneCallback<Playlist>() {
                        @Override
                        public void onDone(Playlist playlist) {
                            ArrayList<String> queryKeys = new ArrayList<>();
                            if (playlist != null) {
                                for (PlaylistEntry entry : playlist.getEntries()) {
                                    queryKeys.add(entry.getQuery().getCacheKey());
                                }
                            }
                            Bundle extras = new Bundle();
                            extras.putStringArrayList(TomahawkFragment.QUERYARRAY, queryKeys);
                            getActivity().getSupportMediaController().getTransportControls()
                                    .sendCustomAction(PlaybackService.ACTION_ADD_QUERIES_TO_QUEUE, extras);
                        }
                    });
                } else if (mQuery != null) {
                    Bundle extras = new Bundle();
                    extras.putString(TomahawkFragment.QUERY, mQuery.getCacheKey());
                    getActivity().getSupportMediaController().getTransportControls()
                            .sendCustomAction(PlaybackService.ACTION_ADD_QUERY_TO_QUEUE, extras);
                } else if (mPlaylistEntry != null) {
                    Bundle extras = new Bundle();
                    extras.putString(TomahawkFragment.QUERY, mPlaylistEntry.getQuery().getCacheKey());
                    getActivity().getSupportMediaController().getTransportControls()
                            .sendCustomAction(PlaybackService.ACTION_ADD_QUERY_TO_QUEUE, extras);
                } else if (mPlaylist != null) {
                    ArrayList<String> queryKeys = new ArrayList<>();
                    if (mPlaylist != null) {
                        for (PlaylistEntry entry : mPlaylist.getEntries()) {
                            queryKeys.add(entry.getQuery().getCacheKey());
                        }
                    }
                    Bundle extras = new Bundle();
                    extras.putStringArrayList(TomahawkFragment.QUERYARRAY, queryKeys);
                    getActivity().getSupportMediaController().getTransportControls()
                            .sendCustomAction(PlaybackService.ACTION_ADD_QUERIES_TO_QUEUE, extras);
                }
            }
        });
    }
}

From source file:com.psiphon3.psiphonlibrary.TunnelManager.java

private Bundle getTunnelStateBundle() {
    Bundle data = new Bundle();
    data.putStringArrayList(DATA_TUNNEL_STATE_AVAILABLE_EGRESS_REGIONS, m_tunnelState.availableEgressRegions);
    data.putBoolean(DATA_TUNNEL_STATE_IS_CONNECTED, m_tunnelState.isConnected);
    data.putInt(DATA_TUNNEL_STATE_LISTENING_LOCAL_SOCKS_PROXY_PORT, m_tunnelState.listeningLocalSocksProxyPort);
    data.putInt(DATA_TUNNEL_STATE_LISTENING_LOCAL_HTTP_PROXY_PORT, m_tunnelState.listeningLocalHttpProxyPort);
    data.putString(DATA_TUNNEL_STATE_CLIENT_REGION, m_tunnelState.clientRegion);
    data.putStringArrayList(DATA_TUNNEL_STATE_HOME_PAGES, m_tunnelState.homePages);
    return data;/*from  w  ww. j a  v a2s .  c o  m*/
}