mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
add new subscriber gem modal design
This commit is contained in:
parent
f2a87dbe84
commit
3692854f12
4 changed files with 26 additions and 2 deletions
|
|
@ -762,4 +762,6 @@
|
|||
<string name="join_party_title">Want to join a party?</string>
|
||||
<string name="create_party_website">Open website to create party</string>
|
||||
<string name="id_copied">ID copied to clipboard</string>
|
||||
<string name="insufficientSubscriberGems">You have bought all the Gems you can this month. More become available within the first three days of each month. Thanks for subscribing!</string>
|
||||
<string name="insufficientSubscriberGemsTitle">Monthly Gem Cap Reached</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -11,5 +11,6 @@ public class InsufficientGoldDialog extends InsufficientCurrencyDialog {
|
|||
|
||||
imageView.setImageBitmap(HabiticaIconsHelper.imageOfGoldReward());
|
||||
textView.setText(context.getString(R.string.insufficientGold));
|
||||
setTitle(R.string.insufficientSubscriberGemsTitle);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.habitrpg.android.habitica.ui.views.insufficientCurrency
|
||||
|
||||
import android.content.Context
|
||||
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
|
||||
|
||||
class InsufficientSubscriberGemsDialog(context: Context) : InsufficientCurrencyDialog(context) {
|
||||
init {
|
||||
|
||||
imageView.setImageBitmap(HabiticaIconsHelper.imageOfGem_36())
|
||||
textView.text = context.getString(R.string.insufficientSubscriberGems)
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
|
|||
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientGemsDialog
|
||||
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientGoldDialog
|
||||
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientHourglassesDialog
|
||||
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientSubscriberGemsDialog
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import rx.Observable
|
||||
import rx.functions.Action1
|
||||
|
|
@ -164,7 +165,11 @@ class PurchaseDialog(context: Context, component: AppComponent, val item: ShopIt
|
|||
limitedTextView.text = context.getString(R.string.gems_left_nomax, gemsLeft)
|
||||
}
|
||||
limitedTextView.visibility = View.VISIBLE
|
||||
limitedTextView.setBackgroundColor(ContextCompat.getColor(context, R.color.green_10))
|
||||
if (gemsLeft == 0) {
|
||||
limitedTextView.setBackgroundColor(ContextCompat.getColor(context, R.color.orange_10))
|
||||
} else {
|
||||
limitedTextView.setBackgroundColor(ContextCompat.getColor(context, R.color.green_10))
|
||||
}
|
||||
}
|
||||
|
||||
if (!shopItem.canAfford(user)) {
|
||||
|
|
@ -208,7 +213,8 @@ class PurchaseDialog(context: Context, component: AppComponent, val item: ShopIt
|
|||
if (shopItem.locked) {
|
||||
return
|
||||
}
|
||||
if (shopItem.canAfford(user)) {
|
||||
val gemsLeft = if (shopItem.limitedNumberLeft != null) shopItem.limitedNumberLeft else 0
|
||||
if ((gemsLeft == 0 && shopItem.purchaseType == "gems") || shopItem.canAfford(user)) {
|
||||
val observable: Observable<Void>
|
||||
if (shopIdentifier != null && shopIdentifier == Shop.TIME_TRAVELERS_SHOP || "mystery_set" == shopItem.purchaseType) {
|
||||
observable = if (shopItem.purchaseType == "gear") {
|
||||
|
|
@ -261,6 +267,7 @@ class PurchaseDialog(context: Context, component: AppComponent, val item: ShopIt
|
|||
}
|
||||
} else {
|
||||
when {
|
||||
"gems" == shopItem.purchaseType -> InsufficientSubscriberGemsDialog(context)
|
||||
"gold" == shopItem.currency -> InsufficientGoldDialog(context)
|
||||
"gems" == shopItem.currency -> InsufficientGemsDialog(context)
|
||||
"hourglasses" == shopItem.currency -> InsufficientHourglassesDialog(context)
|
||||
|
|
|
|||
Loading…
Reference in a new issue