Sub page improvements
|
|
@ -151,7 +151,7 @@ android {
|
|||
multiDexEnabled true
|
||||
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
|
||||
|
||||
versionCode 2304
|
||||
versionCode 2307
|
||||
versionName "2.4"
|
||||
}
|
||||
|
||||
|
|
|
|||
BIN
Habitica/res/drawable-hdpi/flag_flap.png
Normal file
|
After Width: | Height: | Size: 561 B |
BIN
Habitica/res/drawable-hdpi/payment_paypal.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
Habitica/res/drawable-mdpi/flag_flap.png
Normal file
|
After Width: | Height: | Size: 436 B |
BIN
Habitica/res/drawable-mdpi/payment_paypal.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
Habitica/res/drawable-xhdpi/flag_flap.png
Normal file
|
After Width: | Height: | Size: 678 B |
BIN
Habitica/res/drawable-xhdpi/payment_paypal.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
Habitica/res/drawable-xxhdpi/flag_flap.png
Normal file
|
After Width: | Height: | Size: 902 B |
BIN
Habitica/res/drawable-xxhdpi/payment_paypal.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
Habitica/res/drawable-xxxhdpi/flag_flap.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<!-- view background color -->
|
||||
<solid
|
||||
android:color="@color/brand_300" >
|
||||
android:color="@color/brand_400" >
|
||||
</solid>
|
||||
|
||||
<!-- Here is the corner radius -->
|
||||
|
|
|
|||
|
|
@ -154,7 +154,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/sub_benefits_mystery_item_icon"
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:scaleType="center"/>
|
||||
|
|
@ -171,6 +172,7 @@
|
|||
android:textColor="@color/black"
|
||||
style="@style/Body1"/>
|
||||
<TextView
|
||||
android:id="@+id/sub_benefits_mystery_item_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem3_description"
|
||||
|
|
@ -316,7 +318,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:recurringText="@string/twelve_months"
|
||||
app:gemCapText="@string/subscribe12month_gemcap"
|
||||
app:hourGlassCount="4" />
|
||||
app:hourGlassCount="4"
|
||||
app:flagText="@string/save_20"/>
|
||||
|
||||
<Button
|
||||
android:text="@string/subscribe"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/wrapper"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/wrapper"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="horizontal" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -29,15 +29,37 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/priceLabel"
|
||||
android:textColor="@color/gray_50"
|
||||
android:textSize="24sp"
|
||||
android:fontFamily="@string/font_family_medium"
|
||||
tools:text="$ 21" />
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/priceLabel"
|
||||
android:textColor="@color/gray_50"
|
||||
android:textSize="24sp"
|
||||
android:fontFamily="@string/font_family_medium"
|
||||
tools:text="$ 21" />
|
||||
<ImageView
|
||||
android:id="@+id/flag_flap"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/flag_flap"
|
||||
android:layout_gravity="center_vertical" />
|
||||
<TextView
|
||||
android:id="@+id/flag_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="24dp"
|
||||
android:paddingEnd="@dimen/spacing_medium"
|
||||
android:background="@color/green_50"
|
||||
android:textColor="@color/white"
|
||||
style="@style/Caption1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="Save 20%"/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
<attr name="gemCapText" format="string" />
|
||||
<attr name="isNonRecurring" format="boolean" />
|
||||
<attr name="hourGlassCount" format="integer" />
|
||||
<attr name="flagText" format="string" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="SpeechBubbleView">
|
||||
<attr name="namePlate" format="string" />
|
||||
|
|
|
|||
|
|
@ -394,7 +394,8 @@
|
|||
<string name="subscribe">Subscribe</string>
|
||||
<string name="subscribe_listitem1_description">You’ll be able to buy Gems from the Market for 20 gold each!</string>
|
||||
<string name="subscribe_listitem2_description">Earn Mystic Hourglasses to purchase items in the Time Traveler’s 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">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_listitem4_description">Receive the Royal Purple Jackalope pet when you become a new subscriber.</string>
|
||||
<string name="subscribe_listitem5_description">Discover even more items in Habitica with a 2x bonus daily drop rate.</string>
|
||||
<string name="subscribe1month_gemcap">25 Gem cap</string>
|
||||
|
|
@ -902,4 +903,5 @@
|
|||
<string name="resubscribe">Resubscribe</string>
|
||||
<string name="resubscribe_description">Want to continue your benefits? You can start a new subscription before this one runs out to keep your benefits active.</string>
|
||||
<string name="gifted">Gifted</string>
|
||||
<string name="save_20">Save 20%</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -352,7 +352,8 @@
|
|||
</style>
|
||||
|
||||
<style name="Pill">
|
||||
<item name="android:textSize">10sp</item>
|
||||
<item name="android:textSize">11sp</item>
|
||||
<item name="android:fontFamily">@string/font_family_medium</item>
|
||||
<item name="android:background">@drawable/pill_bg_gray</item>
|
||||
<item name="android:paddingRight">@dimen/pill_horizontal_padding</item>
|
||||
<item name="android:paddingLeft">@dimen/pill_horizontal_padding</item>
|
||||
|
|
|
|||
|
|
@ -64,5 +64,9 @@
|
|||
<key>minimumPasswordLength</key>
|
||||
<value>8</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>useNewMysteryBenefits</key>
|
||||
<value>false</value>
|
||||
</entry>
|
||||
</defaultsMap>
|
||||
<!-- END xml_defaults -->
|
||||
|
|
@ -74,4 +74,5 @@ interface InventoryRepository : BaseRepository {
|
|||
|
||||
fun togglePinnedItem(item: ShopItem): Flowable<List<ShopItem>>
|
||||
fun getItems(itemClass: Class<out Item>, keys: Array<String>, user: User?): Flowable<out RealmResults<out Item>>
|
||||
fun getLatestMysteryItem(): Flowable<Equipment>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ class InventoryRepositoryImpl(localRepository: InventoryLocalRepository, apiClie
|
|||
.flatMap { item -> sellItem(user, item, ownedItem) }
|
||||
}
|
||||
|
||||
override fun getLatestMysteryItem(): Flowable<Equipment> {
|
||||
return localRepository.getLatestMysteryItem()
|
||||
}
|
||||
|
||||
private fun sellItem(user: User?, item: Item, ownedItem: OwnedItem): Flowable<User> {
|
||||
if (user != null && appConfigManager.enableLocalChanges()) {
|
||||
localRepository.executeTransaction {
|
||||
|
|
@ -282,4 +286,6 @@ class InventoryRepositoryImpl(localRepository: InventoryLocalRepository, apiClie
|
|||
} else apiClient.togglePinnedItem(item.pinType ?: "", item.path ?: "")
|
||||
.flatMap { retrieveInAppRewards() }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,4 +53,5 @@ interface InventoryLocalRepository : ContentLocalRepository {
|
|||
fun hatchPet(eggKey: String, potionKey: String, userID: String)
|
||||
fun unhatchPet(eggKey: String, potionKey: String, userID: String)
|
||||
fun feedPet(foodKey: String, petKey: String, feedValue: Int, userID: String)
|
||||
fun getLatestMysteryItem(): Flowable<Equipment>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -312,4 +312,14 @@ class RealmInventoryLocalRepository(realm: Realm, private val context: Context)
|
|||
it.insertOrUpdate(newPet)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLatestMysteryItem(): Flowable<Equipment> {
|
||||
return realm.where(Equipment::class.java)
|
||||
.beginsWith("key", "armor_mystery_2")
|
||||
.sort("key", Sort.DESCENDING)
|
||||
.findAll()
|
||||
.asFlowable()
|
||||
.filter { it.isLoaded && it.size > 0}
|
||||
.map { it.first() }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,4 +78,8 @@ class AppConfigManager {
|
|||
fun minimumPasswordLength(): Long {
|
||||
return remoteConfig.getLong("minimumPasswordLength")
|
||||
}
|
||||
|
||||
fun useNewMysteryBenefits(): Boolean {
|
||||
return remoteConfig.getBoolean("useNewMysteryBenefits")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import android.widget.EditText
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.UserComponent
|
||||
import com.habitrpg.android.habitica.data.InventoryRepository
|
||||
import com.habitrpg.android.habitica.data.UserRepository
|
||||
import com.habitrpg.android.habitica.databinding.FragmentSubscriptionBinding
|
||||
import com.habitrpg.android.habitica.events.UserSubscribedEvent
|
||||
import com.habitrpg.android.habitica.extensions.addCancelButton
|
||||
import com.habitrpg.android.habitica.helpers.AppConfigManager
|
||||
|
|
@ -23,13 +24,11 @@ import com.habitrpg.android.habitica.proxy.CrashlyticsProxy
|
|||
import com.habitrpg.android.habitica.ui.activities.GemPurchaseActivity
|
||||
import com.habitrpg.android.habitica.ui.activities.GiftSubscriptionActivity
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseFragment
|
||||
import com.habitrpg.android.habitica.ui.helpers.bindOptionalView
|
||||
import com.habitrpg.android.habitica.ui.helpers.bindView
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils
|
||||
import com.habitrpg.android.habitica.ui.helpers.dismissKeyboard
|
||||
import com.habitrpg.android.habitica.ui.helpers.resetViews
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
|
||||
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
|
||||
import com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionDetailsView
|
||||
import com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionOptionView
|
||||
import io.reactivex.functions.Consumer
|
||||
import kotlinx.android.synthetic.main.fragment_subscription.*
|
||||
|
|
@ -40,32 +39,15 @@ import javax.inject.Inject
|
|||
|
||||
class SubscriptionFragment : BaseFragment(), GemPurchaseActivity.CheckoutFragment {
|
||||
|
||||
private lateinit var binding: FragmentSubscriptionBinding
|
||||
@Inject
|
||||
lateinit var crashlyticsProxy: CrashlyticsProxy
|
||||
@Inject
|
||||
lateinit var userRepository: UserRepository
|
||||
@Inject
|
||||
lateinit var appConfigManager: AppConfigManager
|
||||
|
||||
private val scrollView: NestedScrollView? by bindView(R.id.scroll_view)
|
||||
|
||||
private val giftOneGetOneContainer: ViewGroup? by bindView(R.id.gift_subscription_container)
|
||||
private val giftSubscriptionButton: Button? by bindView(R.id.gift_subscription_button)
|
||||
|
||||
private val headerImageView: ImageView? by bindView(R.id.header_image_view)
|
||||
|
||||
private val loadingIndicator: ProgressBar? by bindOptionalView(R.id.loadingIndicator)
|
||||
private val subscriptionOptions: View? by bindView(R.id.subscriptionOptions)
|
||||
|
||||
private val subscription1MonthView: SubscriptionOptionView? by bindView(R.id.subscription1month)
|
||||
private val subscription3MonthView: SubscriptionOptionView? by bindView(R.id.subscription3month)
|
||||
private val subscription6MonthView: SubscriptionOptionView? by bindView(R.id.subscription6month)
|
||||
private val subscription12MonthView: SubscriptionOptionView? by bindView(R.id.subscription12month)
|
||||
|
||||
private val subscriptionButton: Button? by bindOptionalView(R.id.subscribeButton)
|
||||
private val subscriptionDetailsView: SubscriptionDetailsView? by bindView(R.id.subscriptionDetails)
|
||||
private val subscribeBenefitsTitle: TextView? by bindView(R.id.subscribeBenefitsTitle)
|
||||
private val supportTextView: TextView? by bindView(R.id.supportTextView)
|
||||
@Inject
|
||||
lateinit var inventoryRepository: InventoryRepository
|
||||
|
||||
private var selectedSubscriptionSku: Sku? = null
|
||||
private var skus: List<Sku> = emptyList()
|
||||
|
|
@ -82,7 +64,9 @@ class SubscriptionFragment : BaseFragment(), GemPurchaseActivity.CheckoutFragmen
|
|||
|
||||
fetchUser(null)
|
||||
|
||||
return inflater.inflate(R.layout.fragment_subscription, container, false)
|
||||
binding = FragmentSubscriptionBinding.inflate(inflater, container, false)
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
@ -96,23 +80,30 @@ class SubscriptionFragment : BaseFragment(), GemPurchaseActivity.CheckoutFragmen
|
|||
resetViews()
|
||||
|
||||
subscriptionOptions?.visibility = View.GONE
|
||||
subscriptionDetailsView?.visibility = View.GONE
|
||||
subscriptionDetailsView?.onShowSubscriptionOptions = { showSubscriptionOptions() }
|
||||
binding.subscriptionDetails.visibility = View.GONE
|
||||
binding.subscriptionDetails.onShowSubscriptionOptions = { showSubscriptionOptions() }
|
||||
|
||||
giftOneGetOneContainer?.setOnClickListener { showGiftSubscriptionDialog() }
|
||||
giftSubscriptionButton?.setOnClickListener { showGiftSubscriptionDialog() }
|
||||
binding.giftSubscriptionContainer.setOnClickListener { showGiftSubscriptionDialog() }
|
||||
binding.giftSubscriptionButton.setOnClickListener { showGiftSubscriptionDialog() }
|
||||
|
||||
this.subscription1MonthView?.setOnPurchaseClickListener(View.OnClickListener { selectSubscription(PurchaseTypes.Subscription1Month) })
|
||||
this.subscription3MonthView?.setOnPurchaseClickListener(View.OnClickListener { selectSubscription(PurchaseTypes.Subscription3Month) })
|
||||
this.subscription6MonthView?.setOnPurchaseClickListener(View.OnClickListener { selectSubscription(PurchaseTypes.Subscription6Month) })
|
||||
this.subscription12MonthView?.setOnPurchaseClickListener(View.OnClickListener { selectSubscription(PurchaseTypes.Subscription12Month) })
|
||||
binding.subscription1month.setOnPurchaseClickListener(View.OnClickListener { selectSubscription(PurchaseTypes.Subscription1Month) })
|
||||
binding.subscription3month.setOnPurchaseClickListener(View.OnClickListener { selectSubscription(PurchaseTypes.Subscription3Month) })
|
||||
binding.subscription6month.setOnPurchaseClickListener(View.OnClickListener { selectSubscription(PurchaseTypes.Subscription6Month) })
|
||||
binding.subscription12month.setOnPurchaseClickListener(View.OnClickListener { selectSubscription(PurchaseTypes.Subscription12Month) })
|
||||
|
||||
val heartDrawable = BitmapDrawable(resources, HabiticaIconsHelper.imageOfHeartLarge())
|
||||
supportTextView?.setCompoundDrawablesWithIntrinsicBounds(null, null, null, heartDrawable)
|
||||
|
||||
subscribeButton.setOnClickListener { subscribeUser() }
|
||||
|
||||
giftOneGetOneContainer?.isVisible = appConfigManager.enableGiftOneGetOne()
|
||||
binding.giftSubscriptionContainer?.isVisible = appConfigManager.enableGiftOneGetOne()
|
||||
|
||||
if (appConfigManager.useNewMysteryBenefits()) {
|
||||
compositeSubscription.add(inventoryRepository.getLatestMysteryItem().subscribe(Consumer {
|
||||
DataBindingUtils.loadImage(binding.subBenefitsMysteryItemIcon, "shop_set_mystery_${it.key?.split("_")?.last()}")
|
||||
binding.subBenefitsMysteryItemText.text = context?.getString(R.string.subscribe_listitem3_description_new, it.text)
|
||||
}, RxErrorHandler.handleEmptyError()))
|
||||
}
|
||||
}
|
||||
|
||||
override fun injectFragment(component: UserComponent) {
|
||||
|
|
@ -157,8 +148,8 @@ class SubscriptionFragment : BaseFragment(), GemPurchaseActivity.CheckoutFragmen
|
|||
this.selectedSubscriptionSku = sku
|
||||
val subscriptionOptionButton = buttonForSku(this.selectedSubscriptionSku)
|
||||
subscriptionOptionButton?.setIsPurchased(true)
|
||||
if (this.subscriptionButton != null) {
|
||||
this.subscriptionButton?.isEnabled = true
|
||||
if (binding.subscribeButton != null) {
|
||||
binding.subscribeButton?.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -168,10 +159,10 @@ class SubscriptionFragment : BaseFragment(), GemPurchaseActivity.CheckoutFragmen
|
|||
|
||||
private fun buttonForSku(sku: String?): SubscriptionOptionView? {
|
||||
return when (sku) {
|
||||
PurchaseTypes.Subscription1Month -> subscription1MonthView
|
||||
PurchaseTypes.Subscription3Month -> subscription3MonthView
|
||||
PurchaseTypes.Subscription6Month -> subscription6MonthView
|
||||
PurchaseTypes.Subscription12Month -> subscription12MonthView
|
||||
PurchaseTypes.Subscription1Month -> binding.subscription1month
|
||||
PurchaseTypes.Subscription3Month -> binding.subscription3month
|
||||
PurchaseTypes.Subscription6Month -> binding.subscription6month
|
||||
PurchaseTypes.Subscription12Month -> binding.subscription12month
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
|
@ -197,23 +188,23 @@ class SubscriptionFragment : BaseFragment(), GemPurchaseActivity.CheckoutFragmen
|
|||
if (user != null) {
|
||||
val isSubscribed = user?.isSubscribed ?: false
|
||||
|
||||
if (subscriptionDetailsView == null) {
|
||||
if (binding.subscriptionDetails == null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isSubscribed) {
|
||||
headerImageView?.setImageResource(R.drawable.subscriber_header)
|
||||
subscriptionDetailsView?.visibility = View.VISIBLE
|
||||
user?.purchased?.plan?.let { this.subscriptionDetailsView?.setPlan(it) }
|
||||
binding.headerImageView?.setImageResource(R.drawable.subscriber_header)
|
||||
binding.subscriptionDetails.visibility = View.VISIBLE
|
||||
user?.purchased?.plan?.let { binding.subscriptionDetails.setPlan(it) }
|
||||
subscribeBenefitsTitle?.setText(R.string.subscribe_prompt_thanks)
|
||||
subscriptionOptions?.visibility = View.GONE
|
||||
} else {
|
||||
headerImageView?.setImageResource(R.drawable.subscribe_header)
|
||||
binding.headerImageView.setImageResource(R.drawable.subscribe_header)
|
||||
if (!hasLoadedSubscriptionOptions) {
|
||||
return
|
||||
}
|
||||
subscriptionOptions?.visibility = View.VISIBLE
|
||||
subscriptionDetailsView?.visibility = View.GONE
|
||||
binding.subscriptionDetails.visibility = View.GONE
|
||||
}
|
||||
loadingIndicator?.visibility = View.GONE
|
||||
}
|
||||
|
|
@ -222,7 +213,7 @@ class SubscriptionFragment : BaseFragment(), GemPurchaseActivity.CheckoutFragmen
|
|||
private fun showSubscriptionOptions() {
|
||||
subscriptionOptions?.visibility = View.VISIBLE
|
||||
subscriptionOptions?.postDelayed({
|
||||
scrollView?.smoothScrollTo(0, subscriptionOptions?.top ?: 0)
|
||||
binding.scrollView.smoothScrollTo(0, subscriptionOptions?.top ?: 0)
|
||||
}, 500)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,9 +83,10 @@ class SubscriptionDetailsView : LinearLayout {
|
|||
}
|
||||
|
||||
when (plan.paymentMethod) {
|
||||
"Amazon" -> binding.paymentProcessorImageView.setImageResource(R.drawable.payment_amazon)
|
||||
"Amazon Payments" -> binding.paymentProcessorImageView.setImageResource(R.drawable.payment_amazon)
|
||||
"Apple" -> binding.paymentProcessorImageView.setImageResource(R.drawable.payment_apple)
|
||||
"Google" -> binding.paymentProcessorImageView.setImageResource(R.drawable.payment_google)
|
||||
"PayPal" -> binding.paymentProcessorImageView.setImageResource(R.drawable.payment_paypal)
|
||||
"Stripe" -> binding.paymentProcessorImageView.setImageResource(R.drawable.payment_stripe)
|
||||
else -> {
|
||||
if (plan.customerId == "Gift") {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class SubscriptionOptionView(context: Context, attrs: AttributeSet) : FrameLayou
|
|||
}
|
||||
|
||||
binding.gemCapTextView.text = a.getText(R.styleable.SubscriptionOptionView_gemCapText)
|
||||
setFlagText(a.getText(R.styleable.SubscriptionOptionView_flagText))
|
||||
val hourGlassCount = a.getInteger(R.styleable.SubscriptionOptionView_hourGlassCount, 0)
|
||||
if (hourGlassCount != 0) {
|
||||
binding.hourglassTextView.text = context.getString(R.string.subscription_hourglasses, hourGlassCount)
|
||||
|
|
@ -47,6 +48,17 @@ class SubscriptionOptionView(context: Context, attrs: AttributeSet) : FrameLayou
|
|||
binding.priceLabel.text = text
|
||||
}
|
||||
|
||||
fun setFlagText(text: CharSequence?) {
|
||||
if (text?.length ?: 0 == 0) {
|
||||
binding.flagFlap.visibility = View.GONE
|
||||
binding.flagTextview.visibility = View.GONE
|
||||
} else {
|
||||
binding.flagFlap.visibility = View.VISIBLE
|
||||
binding.flagTextview.visibility = View.VISIBLE
|
||||
binding.flagTextview.text = text
|
||||
}
|
||||
}
|
||||
|
||||
fun setIsPurchased(purchased: Boolean) {
|
||||
if (purchased) {
|
||||
binding.wrapper.setBackgroundResource(R.drawable.subscription_box_bg_selected)
|
||||
|
|
|
|||