org.solovyev.android.checkout.Inventory Java Examples
The following examples show how to use
org.solovyev.android.checkout.Inventory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DonateActivity.java From screenrecorder with GNU Affero General Public License v3.0 | 5 votes |
private void setupPurchase(){ mCheckout.start(); mCheckout.createPurchaseFlow(new PurchaseListener()); mInventory = mCheckout.makeInventory(); mInventory.load(Inventory.Request.create() .loadAllPurchases() .loadSkus(ProductTypes.IN_APP, "sku_1", "sku_2", "sku_5"), new InventoryCallback()); }
Example #2
Source File: DonateDialogFragment.java From HeartbeatFixerForGCM with Apache License 2.0 | 5 votes |
@Override public void onLoaded(@NonNull Inventory.Products products) { final Inventory.Product product = products.get(ProductTypes.IN_APP); mAdapter.setNotifyOnChange(false); mAdapter.clear(); if (product.supported) { for (Sku sku : product.getSkus()) { final Purchase purchase = product.getPurchaseInState(sku, Purchase.State.PURCHASED); final SkuUi skuUi = new SkuUi(sku, purchase != null); mAdapter.add(skuUi); } // Sort items by prices. mAdapter.sort(new Comparator<SkuUi>() { @Override public int compare(@NonNull SkuUi l, @NonNull SkuUi r) { return (int) (l.sku.detailedPrice.amount - r.sku.detailedPrice.amount); } }); showScene(SCREEN_INVENTORY); } else { mEmptyView.setText(R.string.donate_billing_not_supported); showScene(SCREEN_EMPTY_VIEW); } mAdapter.notifyDataSetChanged(); }
Example #3
Source File: MainActivity.java From HeartbeatFixerForGCM with Apache License 2.0 | 5 votes |
@Override public void onLoaded(@NonNull Inventory.Products products) { final Inventory.Product product = products.get(ProductTypes.IN_APP); if (isPurchased(product)) { hideAd(); } else { showAd(); AdvertisementManager.getInstance(MainActivity.this).showAdIfNeeded(); } }
Example #4
Source File: MainActivity.java From HeartbeatFixerForGCM with Apache License 2.0 | 5 votes |
private boolean isPurchased(Inventory.Product product) { if (!product.supported) { return false; } for (String sku : IabProducts.PRODUCT_LIST) { if (product.isPurchased(sku)) { return true; } } return false; }
Example #5
Source File: CheckoutInternal.java From HeartbeatFixerForGCM with Apache License 2.0 | 5 votes |
@Nullable @Override public Inventory getFallbackInventory(@NonNull Checkout checkout, @NonNull Executor onLoadExecutor) { if (RobotmediaDatabase.exists(mBilling.getContext())) { return new RobotmediaInventory(checkout, onLoadExecutor); } else { return null; } }
Example #6
Source File: DonateDialog.java From AcDisplay with GNU General Public License v2.0 | 5 votes |
@Override public void onLoaded(@NonNull Inventory.Products products) { final Inventory.Product product = products.get(ProductTypes.IN_APP); mAdapter.setNotifyOnChange(false); mAdapter.clear(); if (product.supported) { for (Sku sku : product.getSkus()) { final Purchase purchase = product.getPurchaseInState(sku, Purchase.State.PURCHASED); final SkuUi skuUi = new MySkuUi(sku, purchase != null); mAdapter.add(skuUi); } // Sort items by prices. mAdapter.sort(new Comparator<SkuUi>() { @Override public int compare(@NonNull SkuUi l, @NonNull SkuUi r) { return (int) (l.sku.detailedPrice.amount - r.sku.detailedPrice.amount); } }); // Show the inventory. refreshUi(SCREEN_INVENTORY); } else refreshUi(SCREEN_EMPTY_VIEW); mAdapter.notifyDataSetChanged(); }
Example #7
Source File: CheckoutInternal.java From AcDisplay with GNU General Public License v2.0 | 5 votes |
@Nullable @Override public Inventory getFallbackInventory(@NonNull Checkout checkout, @NonNull Executor onLoadExecutor) { if (RobotmediaDatabase.exists(mBilling.getContext())) { return new RobotmediaInventory(checkout, onLoadExecutor); } else { return null; } }
Example #8
Source File: DonateDialog.java From HeadsUp with GNU General Public License v2.0 | 5 votes |
@Override public void onLoaded(@NonNull Inventory.Products products) { final Inventory.Product product = products.get(ProductTypes.IN_APP); mAdapter.setNotifyOnChange(false); mAdapter.clear(); if (product.supported) { for (Sku sku : product.getSkus()) { final Purchase purchase = product.getPurchaseInState(sku, Purchase.State.PURCHASED); final SkuUi skuUi = new SkuUi(sku, purchase != null); mAdapter.add(skuUi); } // Sort items by prices. mAdapter.sort(new Comparator<SkuUi>() { @Override public int compare(@NonNull SkuUi l, @NonNull SkuUi r) { return (int) (l.sku.detailedPrice.amount - r.sku.detailedPrice.amount); } }); showScene(SCREEN_INVENTORY); } else { mEmptyView.setText(R.string.donate_billing_not_supported); showScene(SCREEN_EMPTY_VIEW); } mAdapter.notifyDataSetChanged(); }
Example #9
Source File: CheckoutInternal.java From HeadsUp with GNU General Public License v2.0 | 5 votes |
@Nullable @Override public Inventory getFallbackInventory(@NonNull Checkout checkout, @NonNull Executor onLoadExecutor) { if (RobotmediaDatabase.exists(mBilling.getContext())) { return new RobotmediaInventory(checkout, onLoadExecutor); } else { return null; } }
Example #10
Source File: DonateActivity.java From screenrecorder with GNU Affero General Public License v3.0 | 4 votes |
@Override public void onLoaded(Inventory.Products products) { // your code here }