mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
update subscription page
This commit is contained in:
parent
975b409023
commit
fd0fe172ec
8 changed files with 66 additions and 125 deletions
|
|
@ -155,24 +155,22 @@
|
|||
android:id="@+id/subscription1month"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:gemCapText="@string/subscribe1month_gemcap"
|
||||
app:gemCapText="25"
|
||||
app:recurringText="@string/month" />
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionOptionView
|
||||
android:id="@+id/subscription3month"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:gemCapText="@string/subscribe3month_gemcap"
|
||||
app:hourGlassCount="1"
|
||||
app:gemCapText="25"
|
||||
app:recurringText="@string/three_months" />
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionOptionView
|
||||
android:id="@+id/subscription12month"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:flagText="@string/save_20"
|
||||
app:gemCapText="@string/subscribe12month_gemcap"
|
||||
app:hourGlassCount="4"
|
||||
app:flagText="@string/popular"
|
||||
app:gemCapText="50"
|
||||
app:recurringText="@string/twelve_months" />
|
||||
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -205,34 +205,27 @@
|
|||
android:id="@+id/subscription1month"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:gemCapText="@string/subscribe1month_gemcap"
|
||||
app:gemCapText="25"
|
||||
app:recurringText="@string/month" />
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionOptionView
|
||||
android:id="@+id/subscription3month"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:gemCapText="@string/subscribe3month_gemcap"
|
||||
app:hourGlassCount="1"
|
||||
app:gemCapText="25"
|
||||
app:recurringText="@string/three_months" />
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionOptionView
|
||||
android:id="@+id/subscription6month"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:gemCapText="@string/subscribe6month_gemcap"
|
||||
app:hourGlassCount="2"
|
||||
app:gemCapText="25"
|
||||
app:recurringText="@string/six_months" />
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionOptionView
|
||||
android:id="@+id/subscription12month"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:flagText="@string/save_20"
|
||||
app:gemCapText="@string/subscribe12month_gemcap"
|
||||
app:hourGlassCount="4"
|
||||
app:flagText="@string/popular"
|
||||
app:gemCapText="50"
|
||||
app:recurringText="@string/twelve_months" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/subscribeButton"
|
||||
style="@style/HabiticaButton.Purple.Small"
|
||||
|
|
|
|||
|
|
@ -42,101 +42,26 @@
|
|||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/benefit_armoire_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.habitrpg.common.habitica.views.PixelArtView
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/sub_benefits_armoire" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitemArmoire"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitemArmoire_description"
|
||||
android:textColor="@color/gray100_gray400" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/benefit_hourglasses_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/sub_benefits_hourglasses"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem2"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem2_description"
|
||||
android:textColor="@color/gray100_gray400" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.habitrpg.common.habitica.views.PixelArtView
|
||||
android:id="@+id/sub_benefits_mystery_item_icon"
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:scaleType="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem3"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sub_benefits_mystery_item_text"
|
||||
style="@style/Caption2.Regular"
|
||||
|
|
@ -148,36 +73,33 @@
|
|||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/benefit_hourglasses_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/sub_benefits_pet"
|
||||
android:src="@drawable/sub_benefits_hourglasses"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem4"
|
||||
android:text="@string/subscribe_listitem2"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem4_description"
|
||||
android:text="@string/subscribe_listitem2_description"
|
||||
android:textColor="@color/gray100_gray400" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -187,28 +109,24 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/sub_benefits_faint"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitemFaint"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -218,6 +136,37 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/benefit_armoire_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<com.habitrpg.common.habitica.views.PixelArtView
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/sub_benefits_armoire" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
style="@style/Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitemArmoire"
|
||||
android:textColor="@color/text_primary" />
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitemArmoire_description"
|
||||
android:textColor="@color/gray100_gray400" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
<declare-styleable name="SubscriptionOptionView">
|
||||
<attr name="recurringText" format="string" />
|
||||
<attr name="gemCapText" format="string" />
|
||||
<attr name="gemCapText" format="integer" />
|
||||
<attr name="isNonRecurring" format="boolean" />
|
||||
<attr name="hourGlassCount" format="integer" />
|
||||
<attr name="flagText" format="string" />
|
||||
|
|
|
|||
|
|
@ -393,23 +393,23 @@
|
|||
<string name="has_tag">Has Tag</string>
|
||||
<string name="subscribe_title">Subscribing supports our small team and help keeps Habitica running, thank you!</string>
|
||||
<string name="subscribe_prompt">Become a subscriber to receive these exclusive benefits!</string>
|
||||
<string name="subscribe_listitem1">Gold for Gems</string>
|
||||
<string name="subscribe_listitem2">Mystic Hourglasses</string>
|
||||
<string name="subscribe_listitem3">Exclusive Monthly Gear Sets</string>
|
||||
<string name="subscribe_listitem1">Free Monthly Gems</string>
|
||||
<string name="subscribe_listitem2">Monthly Mystic Hourglass</string>
|
||||
<string name="subscribe_listitem3">Never miss an item with 1 Mystic Hourglass a month to use in the Time Travelers Shop!</string>
|
||||
<string name="subscribe_listitem4">Special Subscriber Pet</string>
|
||||
<string name="subscribe_listitemFaint">Hang on with 1 HP!</string>
|
||||
<string name="subscribe_listitem5">Double the Drops</string>
|
||||
<string name="subscribe_listitem5">Special Pet & More Drops</string>
|
||||
<string name="subscriptions">Subscriptions</string>
|
||||
<string name="subscription_duration">Recurring every %s</string>
|
||||
<string name="subscription_duration_norenew">For %s</string>
|
||||
<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_listitem1_description">Get up to 50 Gems in the Market to buy Quests, Customizations, Pets, and more!</string>
|
||||
<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_listitem4_description">Receive the Royal Purple Jackalope pet when you become a new subscriber.</string>
|
||||
<string name="subscribe_listitemFaint_description">You’ll have the option of a second chance when you run out of HP.</string>
|
||||
<string name="subscribe_listitem5_description">Discover even more items in Habitica with a 2x bonus daily drop cap.</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>
|
||||
<string name="subscribe1month_gemcap">25 Gems a month</string>
|
||||
<string name="subscribe3month_gemcap">30 Gems a month</string>
|
||||
<string name="subscribe6month_gemcap">35 Gems a month</string>
|
||||
|
|
@ -1533,6 +1533,10 @@
|
|||
<string name="error_loading_gems">There was an error loading gems</string>
|
||||
<string name="clear_database">Clear Database</string>
|
||||
<string name="clear_cache_settings">Clear Cache</string>
|
||||
<string name="best_deal">Best Deal</string>
|
||||
<string name="unlocks_x_gems_per_month">Unlocks %d Gold-purchasable Gems per month</string>
|
||||
<string name="two_gems_per_month">+2 Gems each month</string>
|
||||
<string name="popular">Popular</string>
|
||||
|
||||
<plurals name="you_x_others">
|
||||
<item quantity="zero">You</item>
|
||||
|
|
|
|||
|
|
@ -73,11 +73,7 @@ open class SubscriptionPlan : RealmObject(), BaseObject {
|
|||
|
||||
val monthsUntilNextHourglass: Int
|
||||
get() {
|
||||
return if (subMonthCount > 1) {
|
||||
(consecutive?.offset ?: 0) + 1
|
||||
} else {
|
||||
(3 - perkMonthCount)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -148,11 +148,12 @@ class SubscriptionDetailsView : LinearLayout {
|
|||
val now = LocalDate.now()
|
||||
val nextHourglassDate =
|
||||
LocalDate.now().plusMonths(plan.monthsUntilNextHourglass.toLong())
|
||||
.withDayOfMonth(1)
|
||||
val format =
|
||||
if (now.year != nextHourglassDate.year) {
|
||||
"MMM YYYY"
|
||||
"dd MMM yyyy"
|
||||
} else {
|
||||
"MMMM"
|
||||
"dd MMMM"
|
||||
}
|
||||
val nextHourglassMonth = nextHourglassDate.format(DateTimeFormatter.ofPattern(format))
|
||||
nextHourglassMonth?.let { binding.nextHourglassTextview.text = it }
|
||||
|
|
|
|||
|
|
@ -38,16 +38,16 @@ class SubscriptionOptionView(context: Context, attrs: AttributeSet) : FrameLayou
|
|||
)
|
||||
}
|
||||
|
||||
binding.gemCapTextView.text = a.getText(R.styleable.SubscriptionOptionView_gemCapText)
|
||||
val gemCap = a.getInteger(R.styleable.SubscriptionOptionView_gemCapText, 25)
|
||||
binding.gemCapTextView.text = context.getString(R.string.unlocks_x_gems_per_month, gemCap)
|
||||
setFlagText(a.getText(R.styleable.SubscriptionOptionView_flagText))
|
||||
val hourGlassCount = a.getInteger(R.styleable.SubscriptionOptionView_hourGlassCount, 0)
|
||||
binding.hourglassTextView.visibility = View.VISIBLE
|
||||
if (hourGlassCount != 0) {
|
||||
if (gemCap < 50) {
|
||||
binding.hourglassTextView.visibility = View.VISIBLE
|
||||
binding.hourglassTextView.text =
|
||||
context.getString(R.string.subscription_hourglasses, hourGlassCount)
|
||||
context.getString(R.string.two_gems_per_month)
|
||||
} else {
|
||||
binding.hourglassTextView.text =
|
||||
context.getString(R.string.subscription_hourglasses_3month_timeframe)
|
||||
binding.hourglassTextView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue