Update subscription page
|
|
@ -22,7 +22,7 @@
|
|||
android:label="@string/app_name"
|
||||
android:theme="@style/MainAppTheme"
|
||||
android:fullBackupContent="@xml/backup_descriptor"
|
||||
android:configChanges="orientation"
|
||||
android:configChanges="orientation|smallestScreenSize|screenLayout"
|
||||
android:networkSecurityConfig="@xml/network_security_config">
|
||||
<meta-data
|
||||
android:name="firebase_performance_logcat_enabled"
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
BIN
Habitica/res/drawable-hdpi/sub_benefits_faint.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 1,016 B |
|
Before Width: | Height: | Size: 438 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 886 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 7 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 2.1 KiB |
6
Habitica/res/drawable/pill_bg_green_10.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/green_10"/>
|
||||
<corners android:radius="20dip"/>
|
||||
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
|
||||
</shape>
|
||||
|
|
@ -105,11 +105,6 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionDetailsView
|
||||
android:id="@+id/subscriptionDetails"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/header_image_view"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -119,6 +114,11 @@
|
|||
android:src="@drawable/subscribe_header_dark"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionDetailsView
|
||||
android:id="@+id/subscriptionDetails"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/gift_segment_subscribed"
|
||||
|
|
@ -256,6 +256,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/subscription_bg"
|
||||
android:scaleType="centerCrop"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -270,9 +271,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textColorLink="@color/yellow_100"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="italic"
|
||||
android:gravity="center"/>
|
||||
android:textStyle="italic"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
|
|||
|
|
@ -9,25 +9,40 @@
|
|||
tools:background="@color/content_background"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/heart_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/thanks_for_subscribing"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:fontFamily="@string/font_family_medium"
|
||||
android:layout_marginBottom="14dp"/>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/subscription_credit_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:cardBackgroundColor="@color/transparent"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:strokeColor="@color/green_50"
|
||||
app:strokeWidth="1dp">
|
||||
app:strokeColor="@color/green_100"
|
||||
app:strokeWidth="3dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subscription_credit_text_view"
|
||||
style="@style/subscriptionBoxText.Subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:padding="4dp"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/subscription_credit_canceling"
|
||||
android:textColor="@color/green_50" />
|
||||
android:textColor="@color/green_500" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
|
@ -59,6 +74,7 @@
|
|||
<TextView
|
||||
android:id="@+id/subscriptionStatusActive"
|
||||
style="@style/Pill.Selected.Green"
|
||||
android:background="@drawable/pill_bg_green_10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@
|
|||
<string name="belongs_to_challenge">Belongs to Challenge</string>
|
||||
<string name="has_reminder">Has Reminder</string>
|
||||
<string name="has_tag">Has Tag</string>
|
||||
<string name="subscribe_title">Subscribing supports our small team and help keeps Habitica running</string>
|
||||
<string name="subscribe_title">Subscribing supports our small team and helps keep Habitica running</string>
|
||||
<string name="subscribe_prompt">Stay motivated with even more rewards when you subscribe</string>
|
||||
<string name="subscribe_listitem1">Free Monthly Gems</string>
|
||||
<string name="subscribe_listitem2">Monthly Mystic Hourglass</string>
|
||||
|
|
@ -407,6 +407,7 @@
|
|||
<string name="subscribe_listitem2_description">Never miss an item with 1 Mystic Hourglass a month to use in the Time Travelers Shop!</string>
|
||||
<string name="subscribe_listitem3_description">Subscribe now to get an exclusive set now and receive new items every month!</string>
|
||||
<string name="subscribe_listitem3_description_new">Subscribe now to get this %s and receive new items every month!</string>
|
||||
<string name="subscribe_listitem3_description_alt">Stay decked out in the latest exclusive gear. Subscribe now to get %1$s’s %2$s!</string>
|
||||
<string name="subscribe_listitem4_description">Receive the Royal Purple Jackalope pet when you become a new subscriber.</string>
|
||||
<string name="subscribe_listitemFaint_description">Avoid losing your progress with an instant heal when you run out of HP once a day!</string>
|
||||
<string name="subscribe_listitem5_description">Get a Royal Purple Jackalope plus double the Eggs, Hatching Potions, and Food each day to grow your Pet collection!</string>
|
||||
|
|
@ -1550,6 +1551,8 @@
|
|||
<string name="gem_cap">Gem Cap</string>
|
||||
<string name="get_12_mystic_hourglasses">Get 12 Mystic Hourglasses immediately after your first 12 month subscription!</string>
|
||||
<string name="twelve_mystic_hourglasses">12 Mystic Hourglasses</string>
|
||||
<string name="thanks_for_subscribing">Thanks for subscribing</string>
|
||||
<string name="set">Set</string>
|
||||
|
||||
<plurals name="you_x_others">
|
||||
<item quantity="zero">You</item>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.data
|
|||
|
||||
import com.habitrpg.android.habitica.models.inventory.Egg
|
||||
import com.habitrpg.android.habitica.models.inventory.Equipment
|
||||
import com.habitrpg.android.habitica.models.inventory.EquipmentSet
|
||||
import com.habitrpg.android.habitica.models.inventory.Food
|
||||
import com.habitrpg.android.habitica.models.inventory.HatchingPotion
|
||||
import com.habitrpg.android.habitica.models.inventory.Item
|
||||
|
|
@ -153,6 +154,7 @@ interface InventoryRepository : BaseRepository {
|
|||
fun getItems(itemClass: Class<out Item>): Flow<List<Item>>
|
||||
|
||||
fun getLatestMysteryItem(): Flow<Equipment>
|
||||
fun getLatestMysteryItemAndSet(): Flow<Pair<Equipment, EquipmentSet?>>
|
||||
|
||||
fun getItem(
|
||||
type: String,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.habitrpg.android.habitica.data.local.InventoryLocalRepository
|
|||
import com.habitrpg.android.habitica.helpers.AppConfigManager
|
||||
import com.habitrpg.android.habitica.models.inventory.Egg
|
||||
import com.habitrpg.android.habitica.models.inventory.Equipment
|
||||
import com.habitrpg.android.habitica.models.inventory.EquipmentSet
|
||||
import com.habitrpg.android.habitica.models.inventory.Food
|
||||
import com.habitrpg.android.habitica.models.inventory.HatchingPotion
|
||||
import com.habitrpg.android.habitica.models.inventory.Item
|
||||
|
|
@ -197,6 +198,10 @@ class InventoryRepositoryImpl(
|
|||
return localRepository.getLatestMysteryItem()
|
||||
}
|
||||
|
||||
override fun getLatestMysteryItemAndSet(): Flow<Pair<Equipment, EquipmentSet?>> {
|
||||
return localRepository.getLatestMysteryItemAndSet()
|
||||
}
|
||||
|
||||
override fun getItem(
|
||||
type: String,
|
||||
key: String,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.habitrpg.android.habitica.data.local
|
||||
|
||||
import com.habitrpg.android.habitica.models.inventory.Equipment
|
||||
import com.habitrpg.android.habitica.models.inventory.EquipmentSet
|
||||
import com.habitrpg.android.habitica.models.inventory.Item
|
||||
import com.habitrpg.android.habitica.models.inventory.Mount
|
||||
import com.habitrpg.android.habitica.models.inventory.Pet
|
||||
|
|
@ -118,6 +119,7 @@ interface InventoryLocalRepository : ContentLocalRepository {
|
|||
)
|
||||
|
||||
fun getLatestMysteryItem(): Flow<Equipment>
|
||||
fun getLatestMysteryItemAndSet(): Flow<Pair<Equipment, EquipmentSet?>>
|
||||
|
||||
fun soldItem(
|
||||
userID: String,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.habitrpg.android.habitica.data.local.implementation
|
|||
import com.habitrpg.android.habitica.data.local.InventoryLocalRepository
|
||||
import com.habitrpg.android.habitica.models.inventory.Egg
|
||||
import com.habitrpg.android.habitica.models.inventory.Equipment
|
||||
import com.habitrpg.android.habitica.models.inventory.EquipmentSet
|
||||
import com.habitrpg.android.habitica.models.inventory.Food
|
||||
import com.habitrpg.android.habitica.models.inventory.HatchingPotion
|
||||
import com.habitrpg.android.habitica.models.inventory.Item
|
||||
|
|
@ -455,12 +456,33 @@ class RealmInventoryLocalRepository(realm: Realm) :
|
|||
.filter { it.isLoaded && it.size > 0 }
|
||||
.map {
|
||||
val format = SimpleDateFormat("yyyyMM", Locale.US)
|
||||
it.first {
|
||||
it.key?.contains(format.format(Date())) == true
|
||||
it.first { equipment ->
|
||||
equipment.key?.contains(format.format(Date())) == true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLatestMysterySet(): Flow<EquipmentSet?> {
|
||||
return realm.where(EquipmentSet::class.java)
|
||||
.equalTo("pinType", "mystery_set")
|
||||
.sort("key", Sort.DESCENDING)
|
||||
.findAll()
|
||||
.toFlow()
|
||||
.filter { it.isLoaded }
|
||||
.map {
|
||||
val format = SimpleDateFormat("yyyyMM", Locale.US)
|
||||
it.firstOrNull() { set ->
|
||||
set.key.contains(format.format(Date()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLatestMysteryItemAndSet(): Flow<Pair<Equipment, EquipmentSet?>> {
|
||||
return getLatestMysteryItem().combine(getLatestMysterySet()) { item, set ->
|
||||
Pair(item, set)
|
||||
}
|
||||
}
|
||||
|
||||
override fun soldItem(
|
||||
userID: String,
|
||||
updatedUser: User,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package com.habitrpg.android.habitica.models.inventory
|
||||
|
||||
import io.realm.RealmObject
|
||||
import io.realm.annotations.PrimaryKey
|
||||
|
||||
open class EquipmentSet: RealmObject() {
|
||||
@PrimaryKey
|
||||
var key: String = ""
|
||||
var text: String = ""
|
||||
var pinType: String = ""
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ open class SubscriptionPlan : RealmObject(), BaseObject {
|
|||
val totalNumberOfGems: Int
|
||||
get() {
|
||||
return if (isActive) {
|
||||
25 + (consecutive?.gemCapExtra ?: 0)
|
||||
24 + (consecutive?.gemCapExtra ?: 0)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@ import androidx.appcompat.widget.Toolbar
|
|||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.extensions.updateStatusBarColor
|
||||
import com.habitrpg.android.habitica.ui.fragments.purchases.GemsPurchaseFragment
|
||||
import com.habitrpg.android.habitica.ui.fragments.purchases.SubscriptionFragment
|
||||
import com.habitrpg.android.habitica.ui.helpers.ToolbarColorHelper
|
||||
import com.habitrpg.common.habitica.extensions.getThemeColor
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
|
|
@ -25,7 +27,11 @@ class GemPurchaseActivity : PurchaseActivity() {
|
|||
showSubscription = !(intent.extras?.containsKey("openSubscription") == true && intent.extras?.getBoolean("openSubscription") == false)
|
||||
|
||||
val toolbar = findViewById<Toolbar>(R.id.toolbar)
|
||||
setupToolbar(toolbar, Color.WHITE, ContextCompat.getColor(this, R.color.brand_300))
|
||||
if (showSubscription) {
|
||||
setupToolbar(toolbar, Color.WHITE, ContextCompat.getColor(this, R.color.brand_300))
|
||||
} else {
|
||||
setupToolbar(toolbar)
|
||||
}
|
||||
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
|
@ -39,10 +45,10 @@ class GemPurchaseActivity : PurchaseActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (showSubscription) {
|
||||
toolbar?.let { ToolbarColorHelper.colorizeToolbar(it, this,) }
|
||||
window.updateStatusBarColor(ContextCompat.getColor(this, R.color.brand_300), false)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,12 @@ open class SubscriptionBottomSheetFragment : BottomSheetDialogFragment() {
|
|||
user?.let { setUser(it) }
|
||||
}
|
||||
}
|
||||
|
||||
binding.content.subscriptionDetails.visibility = View.GONE
|
||||
binding.content.subscribeBenefitsFooter.visibility = View.GONE
|
||||
binding.content.giftSegmentSubscribed.root.visibility = View.GONE
|
||||
binding.content.giftSegmentUnsubscribed.root.visibility = View.VISIBLE
|
||||
binding.content.subscriptionDisclaimerView.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
|
|
|
|||
|
|
@ -172,10 +172,12 @@ class SubscriptionFragment : BaseFragment<FragmentSubscriptionBinding>() {
|
|||
val subscriptions = purchaseHandler.getAllSubscriptionProducts()
|
||||
skus = subscriptions
|
||||
withContext(Dispatchers.Main) {
|
||||
binding?.content?.loadingIndicator?.visibility = View.GONE
|
||||
if (subscriptions.isEmpty()) {
|
||||
binding?.content?.loadingIndicator?.visibility = View.GONE
|
||||
binding?.content?.noBillingSubscriptions?.visibility = View.VISIBLE
|
||||
binding?.content?.visitHabiticaWebsiteButton?.visibility = View.VISIBLE
|
||||
if (user?.isSubscribed != true) {
|
||||
binding?.content?.noBillingSubscriptions?.visibility = View.VISIBLE
|
||||
binding?.content?.visitHabiticaWebsiteButton?.visibility = View.VISIBLE
|
||||
}
|
||||
return@withContext
|
||||
}
|
||||
binding?.content?.noBillingSubscriptions?.visibility = View.GONE
|
||||
|
|
@ -187,7 +189,7 @@ class SubscriptionFragment : BaseFragment<FragmentSubscriptionBinding>() {
|
|||
?: "",
|
||||
)
|
||||
}
|
||||
subscriptions.minByOrNull {
|
||||
subscriptions.maxByOrNull {
|
||||
it.subscriptionOfferDetails?.firstOrNull()?.pricingPhases?.pricingPhaseList?.firstOrNull()?.priceAmountMicros
|
||||
?: 0
|
||||
}?.let { selectSubscription(it) }
|
||||
|
|
@ -273,6 +275,7 @@ class SubscriptionFragment : BaseFragment<FragmentSubscriptionBinding>() {
|
|||
binding?.content?.giftSegmentUnsubscribed?.root?.visibility = View.GONE
|
||||
binding?.content?.giftSegmentSubscribed?.root?.visibility = View.VISIBLE
|
||||
binding?.content?.subscribeBenefitsTitle?.visibility = View.GONE
|
||||
binding?.content?.subscriptionDisclaimerView?.visibility = View.GONE
|
||||
} else {
|
||||
binding?.content?.headerImageView?.setImageResource(R.drawable.subscribe_header_dark)
|
||||
if (!hasLoadedSubscriptionOptions) {
|
||||
|
|
@ -280,9 +283,11 @@ class SubscriptionFragment : BaseFragment<FragmentSubscriptionBinding>() {
|
|||
}
|
||||
binding?.content?.subscriptionDetails?.visibility = View.GONE
|
||||
binding?.content?.subscribeBenefitsTitle?.setText(R.string.subscribe_prompt)
|
||||
binding?.content?.subscribeBenefitsTitle?.visibility = View.VISIBLE
|
||||
binding?.content?.subscribeBenefitsFooter?.visibility = View.GONE
|
||||
binding?.content?.giftSegmentSubscribed?.root?.visibility = View.GONE
|
||||
binding?.content?.giftSegmentUnsubscribed?.root?.visibility = View.VISIBLE
|
||||
binding?.content?.subscriptionDisclaimerView?.visibility = View.VISIBLE
|
||||
|
||||
binding?.content?.subscription12month?.showHourglassPromo(user?.purchased?.plan?.isEligableForHourglassPromo == true)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ import dagger.hilt.android.EntryPointAccessors
|
|||
import dagger.hilt.components.SingletonComponent
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
|
||||
class SubscriberBenefitView
|
||||
|
|
@ -27,6 +30,8 @@ class SubscriberBenefitView
|
|||
) : LinearLayout(context, attrs) {
|
||||
private val binding: SubscriptionBenefitsBinding = SubscriptionBenefitsBinding.inflate(context.layoutInflater, this)
|
||||
|
||||
val monthFormatter = SimpleDateFormat("MMMM", Locale.getDefault())
|
||||
|
||||
@Inject
|
||||
lateinit var configManager: AppConfigManager
|
||||
|
||||
|
|
@ -49,7 +54,9 @@ class SubscriberBenefitView
|
|||
inventoryRepository = hiltEntryPoint.inventoryRepository()
|
||||
|
||||
MainScope().launchCatching {
|
||||
val item = inventoryRepository.getLatestMysteryItem().firstOrNull()
|
||||
val pair = inventoryRepository.getLatestMysteryItemAndSet().firstOrNull()
|
||||
val item = pair?.first
|
||||
val set = pair?.second
|
||||
binding.subBenefitsMysteryItemIcon.loadImage(
|
||||
"shop_set_mystery_${
|
||||
item?.key?.split(
|
||||
|
|
@ -58,8 +65,10 @@ class SubscriberBenefitView
|
|||
}",
|
||||
)
|
||||
binding.subBenefitsMysteryItemText.text =
|
||||
context.getString(R.string.subscribe_listitem3_description_new, item?.text)
|
||||
context.getString(R.string.subscribe_listitem3_description_alt, monthFormatter.format(Date()), set?.text ?: context.getString(R.string.set))
|
||||
}
|
||||
binding.subBenefitsMysteryItemText.text =
|
||||
context.getString(R.string.subscribe_listitem3_description_alt, monthFormatter.format(Date()), context.getString(R.string.set))
|
||||
|
||||
binding.benefitArmoireWrapper.isVisible = configManager.enableArmoireSubs()
|
||||
binding.benefitFaintWrapper.isVisible = configManager.enableFaintSubs()
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class SubscriptionDetailsView : LinearLayout {
|
|||
private fun setupView() {
|
||||
binding = SubscriptionDetailsBinding.inflate(context.layoutInflater, this, true)
|
||||
binding.changeSubscriptionButton.setOnClickListener { changeSubscriptionButtonTapped() }
|
||||
binding.heartIcon.setImageBitmap(HabiticaIconsHelper.imageOfHeartLarge())
|
||||
}
|
||||
|
||||
fun setPlan(plan: SubscriptionPlan) {
|
||||
|
|
@ -147,9 +148,9 @@ class SubscriptionDetailsView : LinearLayout {
|
|||
if (plan.isActive && (terminatedLocalDate == null || nextHourglassDate.isBefore(terminatedLocalDate))) {
|
||||
val format =
|
||||
if (now.year != nextHourglassDate.year) {
|
||||
"dd MMM yyyy"
|
||||
"MMM yyyy"
|
||||
} else {
|
||||
"dd MMMM"
|
||||
"MMMM"
|
||||
}
|
||||
val nextHourglassMonth = nextHourglassDate.format(DateTimeFormatter.ofPattern(format))
|
||||
nextHourglassMonth?.let { binding.nextHourglassTextview.text = it }
|
||||
|
|
|
|||