com.anjlab.android.iab.v3.SkuDetails Java Examples
The following examples show how to use
com.anjlab.android.iab.v3.SkuDetails.
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: DonationsDialog.java From Phonograph with GNU General Public License v3.0 | 6 votes |
@Override protected void onPostExecute(List<SkuDetails> skuDetails) { super.onPostExecute(skuDetails); DonationsDialog dialog = donationDialogWeakReference.get(); if (dialog == null) return; if (skuDetails == null || skuDetails.isEmpty()) { dialog.dismiss(); return; } View customView = ((MaterialDialog) dialog.getDialog()).getCustomView(); //noinspection ConstantConditions customView.findViewById(R.id.progress_container).setVisibility(View.GONE); ListView listView = customView.findViewById(R.id.list); listView.setAdapter(new SkuDetailsAdapter(dialog, skuDetails)); listView.setVisibility(View.VISIBLE); }
Example #2
Source File: DonationsDialog.java From Orin with GNU General Public License v3.0 | 6 votes |
@Override protected void onPostExecute(List<SkuDetails> skuDetails) { super.onPostExecute(skuDetails); DonationsDialog dialog = donationDialogWeakReference.get(); if (dialog == null) return; if (skuDetails == null || skuDetails.isEmpty()) { dialog.dismiss(); return; } View customView = ((MaterialDialog) dialog.getDialog()).getCustomView(); //noinspection ConstantConditions customView.findViewById(R.id.progress_container).setVisibility(View.GONE); ListView listView = ButterKnife.findById(customView, R.id.list); listView.setAdapter(new SkuDetailsAdapter(dialog, skuDetails)); listView.setVisibility(View.VISIBLE); }
Example #3
Source File: DonateDialog.java From TwistyTimer with GNU General Public License v3.0 | 6 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ArrayList<String> donationTiers = new ArrayList<>( Arrays.asList("donation_tier1", "donation_tier2", "donation_tier3", "donation_tier4", "donation_tier5")); List<SkuDetails> tiers = bp.getPurchaseListingDetails(donationTiers); // If size < 5, the app was not able to fetch all value info if (tiers.size() == 5) { tier5.setText(tiers.get(4).currency + " " + String.valueOf(tiers.get(4).priceValue)); tier4.setText(tiers.get(3).currency + " " + String.valueOf(tiers.get(3).priceValue)); tier3.setText(tiers.get(2).currency + " " + String.valueOf(tiers.get(2).priceValue)); tier2.setText(tiers.get(1).currency + " " + String.valueOf(tiers.get(1).priceValue)); tier1.setText(tiers.get(0).currency + " " + String.valueOf(tiers.get(0).priceValue)); } }
Example #4
Source File: InAppBillingFragment.java From wallpaperboard with Apache License 2.0 | 6 votes |
@Override protected Boolean doInBackground(Void... voids) { while (!isCancelled()) { try { Thread.sleep(1); for (int i = 0; i < mProductsId.length; i++) { SkuDetails product = InAppBillingProcessor.get(getActivity()).getProcessor() .getPurchaseListingDetails(mProductsId[i]); if (product != null) { InAppBilling inAppBilling; String title = product.title.substring(0, product.title.lastIndexOf("(")); inAppBilling = new InAppBilling(product.priceText, mProductsId[i], title); inAppBillings[i] = inAppBilling; } else { if (i == mProductsId.length - 1) return false; } } return true; } catch (Exception e) { LogUtil.e(Log.getStackTraceString(e)); return false; } } return false; }
Example #5
Source File: PremiumGold.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 5 votes |
@Override public void refreshData(BillingAdapterListener billingAdapterListener) { SkuDetails details = billingAdapterListener.getDetails(SKU_ID); if (details != null) { this.title = details.title; this.price = details.priceText; this.description = details.description; this.billingType = SkuType.INAPP; this.billingType = details.isSubscription ? SkuType.SUBS : SkuType.INAPP; this.purchased = billingAdapterListener.isPurchased(SKU_ID); } }
Example #6
Source File: DonationsDialog.java From Phonograph with GNU General Public License v3.0 | 5 votes |
@Override @NonNull public View getView(final int position, View convertView, @NonNull ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(LAYOUT_RES_ID, parent, false); } SkuDetails skuDetails = getItem(position); ViewHolder viewHolder = new ViewHolder(convertView); viewHolder.title.setText(skuDetails.title.replace("(Phonograph Music Player)", "").trim()); viewHolder.text.setText(skuDetails.description); viewHolder.price.setText(skuDetails.priceText); final boolean purchased = donationsDialog.billingProcessor.isPurchased(skuDetails.productId); int titleTextColor = purchased ? ATHUtil.resolveColor(getContext(), android.R.attr.textColorHint) : ThemeStore.textColorPrimary(getContext()); int contentTextColor = purchased ? titleTextColor : ThemeStore.textColorSecondary(getContext()); //noinspection ResourceAsColor viewHolder.title.setTextColor(titleTextColor); //noinspection ResourceAsColor viewHolder.text.setTextColor(contentTextColor); //noinspection ResourceAsColor viewHolder.price.setTextColor(titleTextColor); strikeThrough(viewHolder.title, purchased); strikeThrough(viewHolder.text, purchased); strikeThrough(viewHolder.price, purchased); convertView.setOnTouchListener((v, event) -> purchased); convertView.setOnClickListener(v -> donationsDialog.donate(position)); return convertView; }
Example #7
Source File: DonationsDialog.java From Phonograph with GNU General Public License v3.0 | 5 votes |
@Override protected List<SkuDetails> doInBackground(Void... params) { DonationsDialog dialog = donationDialogWeakReference.get(); if (dialog != null) { final String[] ids = dialog.getResources().getStringArray(DONATION_PRODUCT_IDS); return dialog.billingProcessor.getPurchaseListingDetails(new ArrayList<>(Arrays.asList(ids))); } cancel(false); return null; }
Example #8
Source File: InAppBillingBridge.java From react-native-billing with MIT License | 5 votes |
@ReactMethod public void getProductDetails(final ReadableArray productIds, final Promise promise) { if (bp != null) { try { ArrayList<String> productIdList = new ArrayList<>(); for (int i = 0; i < productIds.size(); i++) { productIdList.add(productIds.getString(i)); } List<SkuDetails> details = bp.getPurchaseListingDetails(productIdList); if (details != null) { WritableArray arr = Arguments.createArray(); for (SkuDetails detail : details) { if (detail != null) { WritableMap map = Arguments.createMap(); map.putString("productId", detail.productId); map.putString("title", detail.title); map.putString("description", detail.description); map.putBoolean("isSubscription", detail.isSubscription); map.putString("currency", detail.currency); map.putDouble("priceValue", detail.priceValue); map.putString("priceText", detail.priceText); arr.pushMap(map); } } promise.resolve(arr); } else { promise.reject("EUNSPECIFIED", "Details was not found."); } } catch (Exception ex) { promise.reject("EUNSPECIFIED", "Failure on getting product details: " + ex.getMessage()); } } else { promise.reject("EUNSPECIFIED", "Channel is not opened. Call open() on InAppBilling."); } }
Example #9
Source File: InAppBillingFragment.java From candybar-library with Apache License 2.0 | 5 votes |
@Override protected Boolean doInBackground(Void... voids) { while (!isCancelled()) { try { Thread.sleep(1); for (int i = 0; i < mProductsId.length; i++) { SkuDetails product = InAppBillingProcessor.get(getActivity()).getProcessor() .getPurchaseListingDetails(mProductsId[i]); if (product != null) { InAppBilling inAppBilling; String title = product.title.substring(0, product.title.lastIndexOf("(")); if (mProductsCount != null) { inAppBilling = new InAppBilling(product.priceText, mProductsId[i], title, mProductsCount[i]); } else { inAppBilling = new InAppBilling(product.priceText, mProductsId[i], title); } inAppBillings[i] = inAppBilling; } else { if (i == mProductsId.length - 1) return false; } } return true; } catch (Exception e) { LogUtil.e(Log.getStackTraceString(e)); return false; } } return false; }
Example #10
Source File: InAppDetailsDialogFragment.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 5 votes |
public static InAppDetailsDialogFragment newInstance(String itemId, SkuDetails detlails) { InAppDetailsDialogFragment fragment = new InAppDetailsDialogFragment(); Bundle args = new Bundle(); args.putString(ARG_Id, itemId); args.putParcelable(ARG_SKU_DETAILS, detlails); fragment.setArguments(args); return fragment; }
Example #11
Source File: PremiumDiamond.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 5 votes |
@Override public void refreshData(BillingAdapterListener billingAdapterListener) { SkuDetails details = billingAdapterListener.getDetails(SKU_ID); if (details != null) { this.title = details.title; this.price = details.priceText; this.description = details.description; this.billingType = SkuType.INAPP; this.billingType = details.isSubscription ? SkuType.SUBS : SkuType.INAPP; this.purchased = billingAdapterListener.isPurchased(SKU_ID); } }
Example #12
Source File: InAppBillingFragment.java From candybar with Apache License 2.0 | 5 votes |
@Override protected Boolean doInBackground(Void... voids) { while (!isCancelled()) { try { Thread.sleep(1); for (int i = 0; i < mProductsId.length; i++) { SkuDetails product = InAppBillingProcessor.get(getActivity()).getProcessor() .getPurchaseListingDetails(mProductsId[i]); if (product != null) { InAppBilling inAppBilling; String title = product.title.substring(0, product.title.lastIndexOf("(")); if (mProductsCount != null) { inAppBilling = new InAppBilling(product.priceText, mProductsId[i], title, mProductsCount[i]); } else { inAppBilling = new InAppBilling(product.priceText, mProductsId[i], title); } inAppBillings[i] = inAppBilling; } else { if (i == mProductsId.length - 1) return false; } } return true; } catch (Exception e) { LogUtil.e(Log.getStackTraceString(e)); return false; } } return false; }
Example #13
Source File: PremiumSilver.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 5 votes |
public void refreshData(BillingAdapterListener billingAdapterListener) { SkuDetails details = billingAdapterListener.getDetails(SKU_ID); if (details != null) { this.title = details.title; this.price = details.priceText; this.description = details.description; this.billingType = SkuType.INAPP; this.billingType = details.isSubscription ? SkuType.SUBS : SkuType.INAPP; this.purchased = billingAdapterListener.isPurchased(SKU_ID); } }
Example #14
Source File: DonationsDialog.java From Orin with GNU General Public License v3.0 | 5 votes |
@Override protected List<SkuDetails> doInBackground(Void... params) { DonationsDialog dialog = donationDialogWeakReference.get(); if (dialog != null) { final String[] ids = dialog.getResources().getStringArray(DONATION_PRODUCT_IDS); return dialog.billingProcessor.getPurchaseListingDetails(new ArrayList<>(Arrays.asList(ids))); } cancel(false); return null; }
Example #15
Source File: SkuDetailsItem.java From fingen with Apache License 2.0 | 5 votes |
public SkuDetailsItem(SkuDetails skuDetails, Drawable icon, long id, boolean isPurchased, View.OnClickListener onClickListener) { mSkuDetails = skuDetails; mIcon = icon; mId = id; mIsPurchased = isPurchased; mOnClickListener = onClickListener; }
Example #16
Source File: BillingActivity.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 4 votes |
@Override public SkuDetails getDetails(String itemId) { return bp.getPurchaseListingDetails(itemId); }
Example #17
Source File: DonationsDialog.java From Orin with GNU General Public License v3.0 | 4 votes |
public SkuDetailsAdapter(@NonNull DonationsDialog donationsDialog, @NonNull List<SkuDetails> objects) { super(donationsDialog.getContext(), LAYOUT_RES_ID, objects); this.donationsDialog = donationsDialog; }
Example #18
Source File: SkuDetailsItem.java From fingen with Apache License 2.0 | 4 votes |
public SkuDetails getSkuDetails() { return mSkuDetails; }
Example #19
Source File: InAppBillingBridge.java From react-native-billing with MIT License | 4 votes |
@ReactMethod public void getSubscriptionDetails(final ReadableArray productIds, final Promise promise) { if (bp != null) { try { ArrayList<String> productIdList = new ArrayList<>(); for (int i = 0; i < productIds.size(); i++) { productIdList.add(productIds.getString(i)); } List<SkuDetails> details = bp.getSubscriptionListingDetails(productIdList); if (details != null) { WritableArray arr = Arguments.createArray(); for (SkuDetails detail : details) { if (detail != null) { WritableMap map = Arguments.createMap(); map.putString("productId", detail.productId); map.putString("title", detail.title); map.putString("description", detail.description); map.putBoolean("isSubscription", detail.isSubscription); map.putString("currency", detail.currency); map.putDouble("priceValue", detail.priceValue); map.putString("priceText", detail.priceText); map.putString("subscriptionPeriod", detail.subscriptionPeriod); if (detail.subscriptionFreeTrialPeriod != null) map.putString("subscriptionFreeTrialPeriod", detail.subscriptionFreeTrialPeriod); map.putBoolean("haveTrialPeriod", detail.haveTrialPeriod); map.putDouble("introductoryPriceValue", detail.introductoryPriceValue); if (detail.introductoryPriceText != null) map.putString("introductoryPriceText", detail.introductoryPriceText); if (detail.introductoryPricePeriod != null) map.putString("introductoryPricePeriod", detail.introductoryPricePeriod); map.putBoolean("haveIntroductoryPeriod", detail.haveIntroductoryPeriod); map.putInt("introductoryPriceCycles", detail.introductoryPriceCycles); arr.pushMap(map); } } promise.resolve(arr); } else { promise.reject("EUNSPECIFIED", "Details was not found."); } } catch (Exception ex) { promise.reject("EUNSPECIFIED", "Failure on getting product details: " + ex.getMessage()); } } else { promise.reject("EUNSPECIFIED", "Channel is not opened. Call open() on InAppBilling."); } }
Example #20
Source File: SkuDetailsWrapper.java From fingen with Apache License 2.0 | 4 votes |
public void setSkuDetails(SkuDetails skuDetails) { mSkuDetails = skuDetails; }
Example #21
Source File: DonationsDialog.java From Phonograph with GNU General Public License v3.0 | 4 votes |
public SkuDetailsAdapter(@NonNull DonationsDialog donationsDialog, @NonNull List<SkuDetails> objects) { super(donationsDialog.getContext(), LAYOUT_RES_ID, objects); this.donationsDialog = donationsDialog; }
Example #22
Source File: SkuDetailsWrapper.java From fingen with Apache License 2.0 | 4 votes |
public SkuDetails getSkuDetails() { return mSkuDetails; }
Example #23
Source File: BillingAdapterListener.java From IslamicLibraryAndroid with GNU General Public License v3.0 | votes |
SkuDetails getDetails(String itemId);