org.solovyev.android.checkout.ProductTypes Java Examples
The following examples show how to use
org.solovyev.android.checkout.ProductTypes.
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: AppHeap.java From AcDisplay with GNU General Public License v2.0 | 6 votes |
/** * Must be called at {@link android.app.Application#onCreate()} */ public void init(@NonNull Application application, @NonNull IConfiguration configuration) { mRefWatcher = LeakCanary.install(application); mCheckoutInternal = new CheckoutInternal(application, Products.create() .add(ProductTypes.IN_APP, configuration.getBilling().getProducts()) .add(ProductTypes.SUBSCRIPTION, Collections.singletonList(""))); mConfiguration = configuration; mApplication = application; // Setup log /* if (DEBUG) { Timber.plant(new Timber.DebugTree()); } else { Timber.plant(new ReleaseTree()); } */ Timber.plant(new ReleaseTree()); TypefaceHelper.initialize(application); RuntimePermissions.getInstance().load(application); }
Example #2
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 #3
Source File: DonateActivity.java From screenrecorder with GNU Affero General Public License v3.0 | 5 votes |
private void makePurchase(final String sku){ mCheckout.whenReady(new Checkout.EmptyListener() { @Override public void onReady(BillingRequests requests) { requests.purchase(ProductTypes.IN_APP, sku, null, mCheckout.getPurchaseFlow()); } }); }
Example #4
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 #5
Source File: HeartbeatFixerForGcmApp.java From HeartbeatFixerForGCM with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/GothamRnd-Book.otf") .setFontAttrId(R.attr.fontPath) .build()); mCheckoutInternal = new CheckoutInternal(this, Products.create().add(ProductTypes.IN_APP, IabProducts.PRODUCT_LIST)); Once.initialise(this); initFirebaseRemoteConfig(); }
Example #6
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 #7
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 #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(); }