mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-19 20:29:02 +00:00
subscriber benefit improvements
This commit is contained in:
parent
f77c5374b1
commit
18a665ca89
8 changed files with 344 additions and 450 deletions
|
|
@ -117,180 +117,10 @@
|
|||
android:src="@drawable/separator_fancy" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/benefit_armoire_wrapper"
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriberBenefitView
|
||||
android:id="@+id/subscriber_benefits"
|
||||
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_2"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
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" />
|
||||
|
||||
<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_2"
|
||||
android:textColor="@color/text_primary" />
|
||||
</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"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem3_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/benefit_faint_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_faint" />
|
||||
|
||||
<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"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitemFaint_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
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_drops" />
|
||||
|
||||
<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_listitem5"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem5_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -319,6 +149,15 @@
|
|||
app:gemCapText="@string/subscribe1month_gemcap"
|
||||
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:flagText="@string/save_20"
|
||||
app:gemCapText="@string/subscribe3month_gemcap"
|
||||
app:hourGlassCount="1"
|
||||
app:recurringText="@string/three_months" />
|
||||
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriptionOptionView
|
||||
android:id="@+id/subscription12month"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -142,247 +142,10 @@
|
|||
android:layout_marginBottom="20dp"
|
||||
android:src="@drawable/separator_fancy" />
|
||||
|
||||
<LinearLayout
|
||||
<com.habitrpg.android.habitica.ui.views.subscriptions.SubscriberBenefitView
|
||||
android:id="@+id/subscriber_benefits"
|
||||
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_gems" />
|
||||
|
||||
<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_listitem1"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem1_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</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/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
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" />
|
||||
|
||||
<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/text_primary" />
|
||||
</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"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem3_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
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" />
|
||||
|
||||
<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: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:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/benefit_faint_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_faint" />
|
||||
|
||||
<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"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitemFaint_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
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_drops" />
|
||||
|
||||
<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_listitem5"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem5_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
253
Habitica/res/layout/subscription_benefits.xml
Normal file
253
Habitica/res/layout/subscription_benefits.xml
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:parentTag="android.widget.LinearLayout"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
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_gems"
|
||||
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_listitem1"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem1_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</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/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
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/text_primary" />
|
||||
</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"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem3_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
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: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: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:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/benefit_faint_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_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"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitemFaint_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
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_drops"
|
||||
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_listitem5"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<TextView
|
||||
style="@style/Caption2.Regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/subscribe_listitem5_description"
|
||||
android:textColor="@color/text_primary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
|
|
@ -351,7 +351,6 @@ class PurchaseHandler(
|
|||
try {
|
||||
apiClient.validateSubscription(validationRequest)
|
||||
processedPurchase(purchase)
|
||||
Analytics.sendEvent("user_subscribed", EventCategory.BEHAVIOUR, HitType.EVENT, mapOf("sku" to (sku ?: "")))
|
||||
CoroutineScope(Dispatchers.IO).launch(ExceptionHandler.coroutine()) {
|
||||
acknowledgePurchase(purchase)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,11 +20,13 @@ class EventOutcomeSubscriptionBottomSheetFragment : SubscriptionBottomSheetFragm
|
|||
private fun setArmoireEventSubscriptionViews() {
|
||||
binding.subscriberBenefitBanner.visibility = View.GONE
|
||||
binding.subscribeBenefits.text = getString(R.string.subscribe_second_armoire_open_text)
|
||||
binding.subscriberBenefits.hideArmoireBenefit()
|
||||
}
|
||||
|
||||
private fun setDeathScreenEventSubscriptionViews() {
|
||||
binding.subscriberBenefitBanner.visibility = View.GONE
|
||||
binding.subscribeBenefits.text = getString(R.string.subscribe_second_chance_incentive_text)
|
||||
binding.subscriberBenefits.hideDeathBenefit()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
@ -32,4 +34,4 @@ class EventOutcomeSubscriptionBottomSheetFragment : SubscriptionBottomSheetFragm
|
|||
const val EVENT_ARMOIRE_OPENED = "armoire_opened"
|
||||
const val EVENT_DEATH_SCREEN = "death_screen"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,24 +77,6 @@ open class SubscriptionBottomSheetFragment : BottomSheetDialogFragment() {
|
|||
user?.let { setUser(it) }
|
||||
}
|
||||
}
|
||||
|
||||
lifecycleScope.launchCatching {
|
||||
inventoryRepository.getLatestMysteryItem().collect {
|
||||
binding.subBenefitsMysteryItemIcon.loadImage(
|
||||
"shop_set_mystery_${
|
||||
it.key?.split(
|
||||
"_"
|
||||
)?.last()
|
||||
}"
|
||||
)
|
||||
binding.subBenefitsMysteryItemText.text =
|
||||
context?.getString(R.string.subscribe_listitem3_description_new, it.text)
|
||||
}
|
||||
}
|
||||
|
||||
binding.benefitFaintWrapper.isVisible = appConfigManager.enableFaintSubs()
|
||||
|
||||
Analytics.sendNavigationEvent("subscription screen")
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
|
|
|
|||
|
|
@ -120,23 +120,6 @@ class SubscriptionFragment : BaseFragment<FragmentSubscriptionBinding>() {
|
|||
|
||||
binding?.refreshLayout?.setOnRefreshListener { refresh() }
|
||||
|
||||
lifecycleScope.launchCatching {
|
||||
inventoryRepository.getLatestMysteryItem().collect {
|
||||
binding?.subBenefitsMysteryItemIcon?.loadImage(
|
||||
"shop_set_mystery_${
|
||||
it.key?.split(
|
||||
"_"
|
||||
)?.last()
|
||||
}"
|
||||
)
|
||||
binding?.subBenefitsMysteryItemText?.text =
|
||||
context?.getString(R.string.subscribe_listitem3_description_new, it.text)
|
||||
}
|
||||
}
|
||||
|
||||
binding?.benefitArmoireWrapper?.isVisible = appConfigManager.enableArmoireSubs()
|
||||
binding?.benefitFaintWrapper?.isVisible = appConfigManager.enableFaintSubs()
|
||||
|
||||
Analytics.sendNavigationEvent("subscription screen")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.habitrpg.android.habitica.ui.views.subscriptions
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.data.InventoryRepository
|
||||
import com.habitrpg.android.habitica.databinding.SubscriptionBenefitsBinding
|
||||
import com.habitrpg.android.habitica.helpers.AppConfigManager
|
||||
import com.habitrpg.android.habitica.helpers.PurchaseHandler
|
||||
import com.habitrpg.android.habitica.interactors.InsufficientGemsUseCase
|
||||
import com.habitrpg.common.habitica.extensions.layoutInflater
|
||||
import com.habitrpg.common.habitica.extensions.loadImage
|
||||
import com.habitrpg.common.habitica.helpers.launchCatching
|
||||
import dagger.hilt.EntryPoint
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.EntryPointAccessors
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import javax.inject.Inject
|
||||
|
||||
class SubscriberBenefitView @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null
|
||||
) : LinearLayout(context, attrs) {
|
||||
private val binding: SubscriptionBenefitsBinding
|
||||
|
||||
@Inject
|
||||
lateinit var configManager: AppConfigManager
|
||||
@Inject
|
||||
lateinit var inventoryRepository: InventoryRepository
|
||||
|
||||
@EntryPoint
|
||||
@InstallIn(SingletonComponent::class)
|
||||
interface ThisEntryPoint {
|
||||
fun configManager(): AppConfigManager
|
||||
fun inventoryRepository(): InventoryRepository
|
||||
}
|
||||
|
||||
init {
|
||||
binding = SubscriptionBenefitsBinding.inflate(context.layoutInflater, this)
|
||||
orientation = VERTICAL
|
||||
val hiltEntryPoint = EntryPointAccessors.fromApplication(context, ThisEntryPoint::class.java)
|
||||
configManager = hiltEntryPoint.configManager()
|
||||
inventoryRepository = hiltEntryPoint.inventoryRepository()
|
||||
|
||||
MainScope().launchCatching {
|
||||
val item = inventoryRepository.getLatestMysteryItem().firstOrNull()
|
||||
binding.subBenefitsMysteryItemIcon.loadImage(
|
||||
"shop_set_mystery_${
|
||||
item?.key?.split(
|
||||
"_"
|
||||
)?.last()
|
||||
}"
|
||||
)
|
||||
binding.subBenefitsMysteryItemText.text =
|
||||
context.getString(R.string.subscribe_listitem3_description_new, item?.text)
|
||||
}
|
||||
|
||||
binding.benefitArmoireWrapper.isVisible = configManager.enableArmoireSubs()
|
||||
binding.benefitFaintWrapper.isVisible = configManager.enableFaintSubs()
|
||||
}
|
||||
|
||||
fun hideDeathBenefit() {
|
||||
binding.benefitFaintWrapper.isVisible = false
|
||||
}
|
||||
|
||||
fun hideArmoireBenefit() {
|
||||
binding.benefitArmoireWrapper.isVisible = false
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue