mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 02:01:56 +00:00
display prices
This commit is contained in:
parent
e5e710eb1c
commit
b510097c9e
2 changed files with 28 additions and 2 deletions
|
|
@ -25,6 +25,7 @@ public class GemPurchaseOptionsView extends FrameLayout {
|
|||
|
||||
@BindView(R.id.purchase_button)
|
||||
Button purchaseButton;
|
||||
private String sku;
|
||||
|
||||
public GemPurchaseOptionsView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
|
@ -49,4 +50,16 @@ public class GemPurchaseOptionsView extends FrameLayout {
|
|||
public void setOnPurchaseClickListener(Button.OnClickListener listener) {
|
||||
purchaseButton.setOnClickListener(listener);
|
||||
}
|
||||
|
||||
public void setPurchaseButtonText(String price) {
|
||||
purchaseButton.setText(price);
|
||||
}
|
||||
|
||||
public void setSku(String sku) {
|
||||
this.sku = sku;
|
||||
}
|
||||
|
||||
public String getSku() {
|
||||
return sku;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,20 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
}
|
||||
|
||||
private void updateButtonLabel(String sku, String price) {
|
||||
|
||||
GemPurchaseOptionsView matchingView;
|
||||
if (sku.equals(PurchaseTypes.Purchase4Gems)) {
|
||||
matchingView = gems4View;
|
||||
} else if (sku.equals(PurchaseTypes.Purchase21Gems)) {
|
||||
matchingView = gems21View;
|
||||
} else if (sku.equals(PurchaseTypes.Purchase42Gems)) {
|
||||
matchingView = gems42View;
|
||||
} else if (sku.equals(PurchaseTypes.Purchase84Gems)) {
|
||||
matchingView = gems84View;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
matchingView.setPurchaseButtonText(price);
|
||||
matchingView.setSku(sku);
|
||||
}
|
||||
|
||||
private void checkIfPendingPurchases() {
|
||||
|
|
@ -156,7 +169,7 @@ public class GemsPurchaseFragment extends BaseMainFragment {
|
|||
public void onSuccess(@NonNull Purchases purchases) {
|
||||
for (Purchase purchase : purchases.list) {
|
||||
if (PurchaseTypes.allTypes.contains(purchase.sku)) {
|
||||
billingRequests.consume(purchase.token, new RequestListener<Object>() {
|
||||
billingRequests.consume(purchase.token, new RequestListener<Object>) {
|
||||
@Override
|
||||
public void onSuccess(@NonNull Object o) {
|
||||
EventBus.getDefault().post(new BoughtGemsEvent(GEMS_TO_ADD));
|
||||
|
|
|
|||
Loading…
Reference in a new issue