List of usage examples for android.os Bundle putStringArrayList
@Override public void putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value)
From source file:antiboring.game.controller.appBilling.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) { for (String sku : moreSkus) { if (!skuList.contains(sku)) { skuList.add(sku);// w w w . j a va 2s . c o m } } } if (skuList.size() == 0) { logDebug("queryPrices: nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; } // Split the sku list in blocks of no more than 20 elements. ArrayList<ArrayList<String>> packs = new ArrayList<ArrayList<String>>(); ArrayList<String> tempList; int n = skuList.size() / 20; int mod = skuList.size() % 20; for (int i = 0; i < n; i++) { tempList = new ArrayList<String>(); for (String s : skuList.subList(i * 20, i * 20 + 20)) { tempList.add(s); } packs.add(tempList); } if (mod != 0) { tempList = new ArrayList<String>(); for (String s : skuList.subList(n * 20, n * 20 + mod)) { tempList.add(s); } packs.add(tempList); } for (ArrayList<String> skuPartList : packs) { Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList); 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:cw.kop.autobackground.sources.SourceInfoFragment.java
private void showAlbumFragment(String type, int position, ArrayList<String> names, ArrayList<String> images, ArrayList<String> links, ArrayList<String> nums, boolean use) { AlbumFragment albumFragment = new AlbumFragment(); Bundle arguments = new Bundle(); arguments.putString("type", type); arguments.putInt("position", position); arguments.putBoolean("use", use); arguments.putStringArrayList("album_names", names); arguments.putStringArrayList("album_images", images); arguments.putStringArrayList("album_links", links); arguments.putStringArrayList("album_nums", nums); albumFragment.setArguments(arguments); albumFragment.setTargetFragment(this, -1); FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager != null) { fragmentManager.beginTransaction().add(R.id.content_frame, albumFragment, "album_fragment") .addToBackStack(null).commit(); }// w w w. j av a 2 s.co m }
From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java
private void showLoadOccupancyGridDialog(boolean firstTry, java.util.ArrayList<java.lang.String> nameList) { FragmentManager manager = getFragmentManager(); LoadOccupancyGridDialog loadOccupancyGridDialog = new LoadOccupancyGridDialog(); Bundle bundle = new Bundle(); bundle.putBoolean(getString(R.string.show_load_occupancy_grid_empty_key), nameList.isEmpty()); bundle.putBoolean(getString(R.string.show_load_occupancy_grid_error_key), !firstTry); bundle.putStringArrayList(getString(R.string.list_names_occupancy_grid_key), nameList); loadOccupancyGridDialog.setArguments(bundle); loadOccupancyGridDialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.CustomDialog); loadOccupancyGridDialog.show(manager, "LoadOccupancyGridDialog"); }
From source file:com.fuse.billing.android.IabHelper.java
int querySkuDetails(String itemType, List<String> skuList, List<SkuDetails> targetList) throws RemoteException, JSONException { logDebug("Querying SKU details."); if (skuList.size() == 0) { logDebug("queryPrices: nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; }//from www. ja va 2 s . c o m // Split the sku list in blocks of no more than 20 elements. ArrayList<ArrayList<String>> packs = new ArrayList<ArrayList<String>>(); ArrayList<String> currentPack = null; for (String sku : skuList) { if (isTestSku(sku)) { targetList.add(SkuDetails.createForTestProduct(sku)); } else { if (currentPack == null || currentPack.size() >= 20) { currentPack = new ArrayList<String>(); packs.add(currentPack); } currentPack.add(sku); } } for (ArrayList<String> skuPartList : packs) { Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList); 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(thisResponse); logDebug("Got sku details: " + d); targetList.add(d); } } return BILLING_RESPONSE_RESULT_OK; }
From source file:com.kyleshaver.minuteofangle.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) { for (String sku : moreSkus) { if (!skuList.contains(sku)) { skuList.add(sku);/*ww w . j a v a 2 s. c o m*/ } } } if (skuList.size() == 0) { logDebug("queryPrices: nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; } // Split the sku list in blocks of no more than 20 elements. ArrayList<ArrayList<String>> packs = new ArrayList<ArrayList<String>>(); ArrayList<String> tempList; int n = skuList.size() / 20; int mod = skuList.size() % 20; for (int i = 0; i < n; i++) { tempList = new ArrayList<String>(); for (String s : skuList.subList(i * 20, i * 20 + 20)) { tempList.add(s); } packs.add(tempList); } if (mod != 0) { tempList = new ArrayList<String>(); for (String s : skuList.subList(n * 20, n * 20 + mod)) { tempList.add(s); } packs.add(tempList); } for (ArrayList<String> skuPartList : packs) { Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList); 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:jp.sonymusicstudio.cast.castcompanionlibrary.utils.Utils.java
/** * Builds and returns a {@link Bundle} which contains a select subset of data in the * {@link MediaInfo}. Since {@link MediaInfo} is not {@link Parcelable}, one can use this * container bundle to pass around from one activity to another. * * @see <code>bundleToMediaInfo()</code> *//* ww w. j a va 2s. c om*/ public static Bundle mediaInfoToBundle(MediaInfo info) { if (info == null) { return null; } MediaMetadata md = info.getMetadata(); Bundle wrapper = new Bundle(); wrapper.putString(MediaMetadata.KEY_TITLE, md.getString(MediaMetadata.KEY_TITLE)); wrapper.putString(MediaMetadata.KEY_SUBTITLE, md.getString(MediaMetadata.KEY_SUBTITLE)); wrapper.putString(MediaMetadata.KEY_ALBUM_TITLE, md.getString(MediaMetadata.KEY_ALBUM_TITLE)); wrapper.putString(MediaMetadata.KEY_ALBUM_ARTIST, md.getString(MediaMetadata.KEY_ALBUM_ARTIST)); wrapper.putString(MediaMetadata.KEY_COMPOSER, md.getString(MediaMetadata.KEY_COMPOSER)); wrapper.putString(MediaMetadata.KEY_SERIES_TITLE, md.getString(MediaMetadata.KEY_SERIES_TITLE)); wrapper.putString(MediaMetadata.KEY_SEASON_NUMBER, md.getString(MediaMetadata.KEY_SEASON_NUMBER)); wrapper.putString(MediaMetadata.KEY_EPISODE_NUMBER, md.getString(MediaMetadata.KEY_EPISODE_NUMBER)); Calendar releaseCalender = md.getDate(MediaMetadata.KEY_RELEASE_DATE); if (releaseCalender != null) { long releaseMillis = releaseCalender.getTimeInMillis(); wrapper.putLong(MediaMetadata.KEY_RELEASE_DATE, releaseMillis); } wrapper.putInt(KEY_MEDIA_TYPE, info.getMetadata().getMediaType()); wrapper.putString(KEY_URL, info.getContentId()); wrapper.putString(MediaMetadata.KEY_STUDIO, md.getString(MediaMetadata.KEY_STUDIO)); wrapper.putString(KEY_CONTENT_TYPE, info.getContentType()); wrapper.putInt(KEY_STREAM_TYPE, info.getStreamType()); wrapper.putLong(KEY_STREAM_DURATION, info.getStreamDuration()); if (!md.getImages().isEmpty()) { ArrayList<String> urls = new ArrayList<>(); for (WebImage img : md.getImages()) { urls.add(img.getUrl().toString()); } wrapper.putStringArrayList(KEY_IMAGES, urls); } JSONObject customData = info.getCustomData(); if (customData != null) { wrapper.putString(KEY_CUSTOM_DATA, customData.toString()); } if (info.getMediaTracks() != null && !info.getMediaTracks().isEmpty()) { try { JSONArray jsonArray = new JSONArray(); for (MediaTrack mt : info.getMediaTracks()) { JSONObject jsonObject = new JSONObject(); jsonObject.put(KEY_TRACK_NAME, mt.getName()); jsonObject.put(KEY_TRACK_CONTENT_ID, mt.getContentId()); jsonObject.put(KEY_TRACK_ID, mt.getId()); jsonObject.put(KEY_TRACK_LANGUAGE, mt.getLanguage()); jsonObject.put(KEY_TRACK_TYPE, mt.getType()); if (mt.getSubtype() != MediaTrack.SUBTYPE_UNKNOWN) { jsonObject.put(KEY_TRACK_SUBTYPE, mt.getSubtype()); } if (mt.getCustomData() != null) { jsonObject.put(KEY_TRACK_CUSTOM_DATA, mt.getCustomData().toString()); } jsonArray.put(jsonObject); } wrapper.putString(KEY_TRACKS_DATA, jsonArray.toString()); } catch (JSONException e) { LOGE(TAG, "mediaInfoToBundle(): Failed to convert Tracks data to json", e); } } return wrapper; }
From source file:de.geithonline.abattlwp.billinghelper.IabHelper.java
int querySkuDetails(final String itemType, final Inventory inv, final List<String> moreSkus) throws RemoteException, JSONException { logDebug("Querying SKU details."); final ArrayList<String> skuList = new ArrayList<String>(); skuList.addAll(inv.getAllOwnedSkus(itemType)); if (moreSkus != null) { for (final String sku : moreSkus) { if (!skuList.contains(sku)) { skuList.add(sku);/*from w ww . j a 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; } final Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList); final Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus); if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) { final 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; } } final ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST); for (final String thisResponse : responseList) { final SkuDetails d = new SkuDetails(itemType, thisResponse); logDebug("Got sku details: " + d); inv.addSkuDetails(d); } return BILLING_RESPONSE_RESULT_OK; }
From source file:org.proninyaroslav.libretorrent.fragments.DetailTorrentFilesFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putSerializable(TAG_FILE_TREE, fileTree); outState.putSerializable(TAG_CUR_DIR, curDir); if (layoutManager != null) { listFileState = layoutManager.onSaveInstanceState(); }/* w w w . j av a 2 s . c o m*/ outState.putParcelable(TAG_LIST_FILE_STATE, listFileState); if (adapter != null) { outState.putIntegerArrayList(TAG_SELECTABLE_ADAPTER, adapter.getSelectedItems()); } outState.putBoolean(TAG_IN_ACTION_MODE, inActionMode); outState.putStringArrayList(TAG_SELECTED_FILES, selectedFiles); super.onSaveInstanceState(outState); }
From source file:com.farmerbb.notepad.activity.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { if (filesToExport != null && filesToExport.length > 0) { ArrayList<String> filesToExportList = new ArrayList<>(); for (Object file : filesToExport) { filesToExportList.add(file.toString()); }/*from www. ja va2s . co m*/ outState.putStringArrayList("files_to_export", filesToExportList); } if (filesToDelete != null && filesToDelete.length > 0) { ArrayList<String> filesToDeleteList = new ArrayList<>(); for (Object file : filesToDelete) { filesToDeleteList.add(file.toString()); } outState.putStringArrayList("files_to_delete", filesToDeleteList); } if (inCabMode && cab.size() > 0) outState.putStringArrayList("cab", cab); super.onSaveInstanceState(outState); }
From source file:org.onepf.oms.appstore.googleUtils.IabHelper.java
/** * @param inv - Inventory with application SKUs * @param moreSkus - storeSKUs (processed in {@link OpenIabHelper#queryInventory(boolean, List, List)} */// w w w. ja v a 2 s. com int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus) throws RemoteException, JSONException { logDebug("querySkuDetails() Querying SKU details."); Set<String> storeSkus = new TreeSet<String>(); final List<String> allOwnedSkus = inv.getAllOwnedSkus(itemType); for (String sku : allOwnedSkus) { storeSkus.add(OpenIabHelper.getStoreSku(appstore.getAppstoreName(), sku)); } if (moreSkus != null) { for (String sku : moreSkus) { storeSkus.add(OpenIabHelper.getStoreSku(appstore.getAppstoreName(), sku)); } } if (storeSkus.size() == 0) { logDebug("querySkuDetails(): nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; } // Split the sku list in blocks of no more than QUERY_SKU_DETAILS_BATCH_SIZE elements. ArrayList<ArrayList<String>> batches = new ArrayList<ArrayList<String>>(); ArrayList<String> tmpBatch = new ArrayList<String>(QUERY_SKU_DETAILS_BATCH_SIZE); int iSku = 0; for (String sku : storeSkus) { tmpBatch.add(sku); iSku++; if (tmpBatch.size() == QUERY_SKU_DETAILS_BATCH_SIZE || iSku == storeSkus.size()) { batches.add(tmpBatch); tmpBatch = new ArrayList<String>(QUERY_SKU_DETAILS_BATCH_SIZE); } } logDebug("querySkuDetails() batches: " + batches.size() + ", " + batches); for (ArrayList<String> batch : batches) { Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, batch); if (mService == null) { logError("unable to get sku details: service is not connected."); return IABHELPER_BAD_RESPONSE; } 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); d.setSku(OpenIabHelper.getSku(appstore.getAppstoreName(), d.getSku())); logDebug("querySkuDetails() Got sku details: " + d); inv.addSkuDetails(d); } } return BILLING_RESPONSE_RESULT_OK; }