List of usage examples for android.os Bundle getStringArrayList
@Override
@Nullable
public ArrayList<String> getStringArrayList(@Nullable String key)
From source file:org.solovyev.android.checkout.Skus.java
@Nonnull private static List<String> extractList(@Nonnull Bundle bundle) { final List<String> list = bundle.getStringArrayList(BUNDLE_LIST); return list != null ? list : Collections.<String>emptyList(); }
From source file:org.solovyev.android.checkout.Purchases.java
@Nonnull private static List<String> extractDatasList(@Nonnull Bundle bundle) { final List<String> list = bundle.getStringArrayList(BUNDLE_DATA_LIST); return list != null ? list : Collections.<String>emptyList(); }
From source file:org.solovyev.android.checkout.Purchases.java
@Nonnull static List<Purchase> getListFromBundle(@Nonnull Bundle bundle) throws JSONException { final List<String> datas = extractDatasList(bundle); final List<String> signatures = bundle.getStringArrayList(BUNDLE_SIGNATURE_LIST); final List<Purchase> purchases = new ArrayList<Purchase>(datas.size()); for (int i = 0; i < datas.size(); i++) { final String data = datas.get(i); final String signature = signatures != null ? signatures.get(i) : ""; purchases.add(Purchase.fromJson(data, signature)); }//from www . j av a 2 s . com return purchases; }
From source file:com.facebook.login.LoginMethodHandler.java
static AccessToken createAccessTokenFromNativeLogin(Bundle bundle, AccessTokenSource source, String applicationId) {// w w w. j av a 2 s.c o m Date expires = Utility.getBundleLongAsDate(bundle, NativeProtocol.EXTRA_EXPIRES_SECONDS_SINCE_EPOCH, new Date(0)); ArrayList<String> permissions = bundle.getStringArrayList(NativeProtocol.EXTRA_PERMISSIONS); String token = bundle.getString(NativeProtocol.EXTRA_ACCESS_TOKEN); if (Utility.isNullOrEmpty(token)) { return null; } String userId = bundle.getString(NativeProtocol.EXTRA_USER_ID); return new AccessToken(token, applicationId, userId, permissions, null, source, expires, new Date()); }
From source file:net.gcompris.GComprisActivity.java
public static void checkPayment() { if (m_instance.m_service == null) { Log.e(QtApplication.QtTAG, "Check full version is bought failed: No billing service"); return;// w w w.j a va 2 s. c o m } try { Bundle ownedItems = m_instance.m_service.getPurchases(3, m_instance.getPackageName(), "inapp", null); int responseCode = ownedItems.getInt("RESPONSE_CODE"); if (responseCode == 0) { ArrayList ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); ArrayList purchaseDataList = ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST"); for (int i = 0; i < purchaseDataList.size(); ++i) { String purchaseData = (String) purchaseDataList.get(i); String sku = (String) ownedSkus.get(i); if (sku.equals(SKU_NAME)) { bought(true); return; } else { Log.e(QtApplication.QtTAG, "Unknown item bought " + sku); } } bought(false); return; } else { bought(false); Log.e(QtApplication.QtTAG, "Item not owed " + responseCode); } } catch (Exception e) { Log.e(QtApplication.QtTAG, "Exception caught when checking if full version is bought!", e); } }
From source file:com.facebook.LegacyTokenHelper.java
public static Set<String> getPermissions(Bundle bundle) { Validate.notNull(bundle, "bundle"); ArrayList<String> arrayList = bundle.getStringArrayList(PERMISSIONS_KEY); if (arrayList == null) { return null; }/* ww w .j av a 2s . c o m*/ return new HashSet<String>(arrayList); }
From source file:com.vk.sdk.payments.VKIInAppBillingService.java
private static String getPurchaseData(@NonNull final Object iInAppBillingService, final int apiVersion, @NonNull final String packageName, @NonNull final String purchaseToken) throws RemoteException { Bundle ownedItems = getPurchases(iInAppBillingService, apiVersion, packageName, "inapp", purchaseToken); ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST); if (purchaseDataList != null) { for (int i = 0; i < purchaseDataList.size(); ++i) { String purchaseDataLocal = purchaseDataList.get(i); try { JSONObject o = new JSONObject(purchaseDataLocal); String token = o.optString(PURCHASE_DETAIL_TOKEN, o.optString(PURCHASE_DETAIL_PURCHASE_TOKEN)); if (TextUtils.equals(purchaseToken, token)) { return getReceipt(iInAppBillingService, apiVersion, packageName, purchaseDataLocal) .toJson();/* w w w .ja v a2s.c o m*/ } } catch (JSONException e) { // nothing } } } return null; }
From source file:com.vk.sdk.payments.VKIInAppBillingService.java
private static Receipt getReceipt(@NonNull final Object iInAppBillingService, final int apiVersion, @NonNull final String packageName, @NonNull final String receiptOriginal) throws JSONException, RemoteException { JSONObject objectReceipt = new JSONObject(receiptOriginal); Receipt receipt = new Receipt(); receipt.receiptData = receiptOriginal; receipt.quantity = 1;//from w w w . ja v a 2s . c o m String sku = objectReceipt.getString(PRODUCT_ID); ArrayList<String> skuList = new ArrayList<>(); skuList.add(sku); Bundle queryBundle = new Bundle(); queryBundle.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList); Bundle responseBundle = getSkuDetails(iInAppBillingService, apiVersion, packageName, "inapp", queryBundle); ArrayList<String> responseList = responseBundle.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST); if (responseList != null && !responseList.isEmpty()) { try { JSONObject object = new JSONObject(responseList.get(0)); receipt.priceValue = Float.parseFloat(object.optString(SKU_DETAIL_AMOUNT_MICROS)) / 1000000f; receipt.currency = object.optString(SKU_DETAIL_PRICE_CURRENCY_CODE); } catch (JSONException e) { // nothing } } return receipt; }
From source file:com.facebook.AccessToken.java
static List<String> getPermissionsFromBundle(Bundle bundle, String key) { // Copy the list so we can guarantee immutable List<String> originalPermissions = bundle.getStringArrayList(key); List<String> permissions; if (originalPermissions == null) { permissions = Collections.emptyList(); } else {//ww w. j a v a 2 s. c om permissions = Collections.unmodifiableList(new ArrayList<String>(originalPermissions)); } return permissions; }
From source file:com.hivewallet.androidclient.wallet.AddressBookProvider.java
/** Finds non-permanent photo assets that have not been used in a while. * Deletes them from the database and returns their uris. *//*from ww w . j ava2 s. c om*/ public static List<Uri> deleteStalePhotoAssets(final Context context) { final Uri uri = contentUri(context.getPackageName()); Bundle bundle = context.getContentResolver().call(uri, METHOD_DELETE_STALE_PHOTO_URIS, null, null); List<Uri> photoUris = new ArrayList<Uri>(); for (String photoUriStr : bundle.getStringArrayList(STALE_PHOTO_URIS)) { Uri photoUri = Uri.parse(photoUriStr); if (photoUri == null) throw new RuntimeException("Invalid URI in photo assets database table"); photoUris.add(photoUri); } return photoUris; }