@Nonnull private Inventory.Products loadProducts(@Nonnull Inventory.Request request, @Nonnull SQLiteDatabase db) { final Inventory.Products result = new Inventory.Products(); for (String productId : ProductTypes.ALL) { final Inventory.Product product = new Inventory.Product(productId, true); final List<String> skus = request.getSkus(productId); if (!skus.isEmpty()) { product.setPurchases(loadPurchases(skus, db)); } else { Billing.warning("There are no SKUs for \"" + product.id + "\" product. No purchase information will be loaded"); } result.add(product); } return result; }
private void loadSkus(@Nonnull BillingRequests requests, @Nonnull final Product product) { final List<String> skuIds = mTask.getRequest().getSkus(product.id); if (skuIds.isEmpty()) { Billing.warning("There are no SKUs for \"" + product.id + "\" product. No SKU information will be loaded"); synchronized (mLock) { countDown(); } return; } requests.getSkus(product.id, skuIds, synchronizedListener(new RequestListener<Skus>() { @Override public void onSuccess(@Nonnull Skus skus) { product.setSkus(skus.list); countDown(); } @Override public void onError(int response, @Nonnull Exception e) { countDown(); } })); } }