mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 11:46:32 +00:00
correct hourglass calculation
This commit is contained in:
parent
1abe8e86ff
commit
c263d27e7c
2 changed files with 20 additions and 7 deletions
|
|
@ -175,7 +175,7 @@
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="@string/months_subscribed"
|
android:text="@string/months_subscribed"
|
||||||
android:textAlignment="center"
|
android:gravity="center"
|
||||||
android:fontFamily="sans-serif-medium"/>
|
android:fontFamily="sans-serif-medium"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
@ -221,7 +221,7 @@
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:text="@string/monthly_gem_cap"
|
android:text="@string/monthly_gem_cap"
|
||||||
android:textAlignment="center"
|
android:gravity="center"
|
||||||
android:fontFamily="sans-serif-medium" />
|
android:fontFamily="sans-serif-medium" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
@ -239,7 +239,7 @@
|
||||||
android:id="@+id/next_hourglass_container"
|
android:id="@+id/next_hourglass_container"
|
||||||
style="@style/subscriptionBox"
|
style="@style/subscriptionBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/months_subscribed_layout">
|
android:layout_below="@id/months_subscribed_layout">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
|
||||||
|
|
@ -54,12 +54,25 @@ open class SubscriptionPlan : RealmObject(), BaseObject {
|
||||||
else receive on third month (subtract 1 from total consecutive count)
|
else receive on third month (subtract 1 from total consecutive count)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
val monthsUntilNextHourglass: Int?
|
val subMonthCount: Int
|
||||||
|
get() {
|
||||||
|
return when (planId) {
|
||||||
|
"basic_earned" -> 1
|
||||||
|
"basic_3mo" -> 3
|
||||||
|
"basic_6mo" -> 6
|
||||||
|
"google_6mo" -> 6
|
||||||
|
"basic_12mo" -> 12
|
||||||
|
"group_plan_auto" -> 1
|
||||||
|
else -> 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val monthsUntilNextHourglass: Int
|
||||||
get() {
|
get() {
|
||||||
return if (consecutive?.offset == 0) {
|
return if (subMonthCount > 0) {
|
||||||
(3 - (((consecutive?.count ?: 0)) % 3))
|
(consecutive?.offset ?: 0) + 1
|
||||||
} else {
|
} else {
|
||||||
consecutive?.offset
|
(3 - (((consecutive?.count ?: 0)) % 3))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue