From 8e225c6da7527204fae58f75da9fa04a3e16b459 Mon Sep 17 00:00:00 2001
From: Taras Smakula <tarassmakula@gmail.com>
Date: Wed, 13 Dec 2023 14:32:10 +0200
Subject: [PATCH] Create ui for manage subscription screen

---
 .../dialog_fragment_manage_subscription.xml   | 129 ++++++++++++++++++
 .../res/layout/list_item_subscription.xml     |   3 +-
 auth/src/main/res/values/strings.xml          |  10 ++
 3 files changed, 140 insertions(+), 2 deletions(-)

diff --git a/auth/src/main/res/layout/dialog_fragment_manage_subscription.xml b/auth/src/main/res/layout/dialog_fragment_manage_subscription.xml
index 9c6417039..6d9a01aaa 100644
--- a/auth/src/main/res/layout/dialog_fragment_manage_subscription.xml
+++ b/auth/src/main/res/layout/dialog_fragment_manage_subscription.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
@@ -29,14 +30,142 @@
 
     <TextView
         android:id="@+id/tvEmptyMessage"
+        style="@style/subheadline"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:gravity="center"
+        android:paddingHorizontal="16dp"
         android:text="@string/you_don_t_have_any_active_subscriptions"
+        android:textSize="22sp"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/toolbarDivider"
+        tools:visibility="visible" />
+
+    <ProgressBar
+        android:id="@+id/vLoading"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/toolbarDivider" />
 
 
+    <LinearLayout
+        android:id="@+id/lSubscriptionInfo"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_marginTop="36dp"
+        android:layout_marginBottom="24dp"
+        android:gravity="center_horizontal"
+        android:orientation="vertical"
+        android:paddingHorizontal="16dp"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/toolbarDivider"
+        tools:visibility="visible">
+
+        <com.google.android.material.imageview.ShapeableImageView
+            android:id="@+id/ivCover"
+            style="@style/AuthLogoStyle"
+            android:layout_width="@dimen/group_icon_size"
+            android:layout_height="@dimen/group_icon_size"
+
+            android:scaleType="centerCrop"
+            app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.GroupIconRadius" />
+
+
+        <TextView
+            android:id="@+id/tvName"
+            style="@style/title2"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="36dp"
+            android:gravity="center"
+            tools:text="Aasdsadasdsaf" />
+
+        <TextView
+            android:id="@+id/tvDescription"
+            style="@style/body"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:gravity="center"
+            tools:text="Aasdsadasdsaf" />
+
+        <TextView
+            android:id="@+id/tvStatus"
+            style="@style/body"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:gravity="center"
+            android:text="@string/status_active" />
+
+        <TextView
+            android:id="@+id/tvPrice"
+            style="@style/body"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:gravity="center"
+            tools:text="Price: " />
+
+        <TextView
+            android:id="@+id/tvDuration"
+            style="@style/body"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:gravity="center"
+            tools:text="Duration" />
+
+        <TextView
+            android:id="@+id/tvPurchasedAt"
+            style="@style/body"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:gravity="center"
+            tools:text="Purchased at" />
+
+        <TextView
+            android:id="@+id/tvProductId"
+            style="@style/body"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:gravity="center"
+            android:textSize="14sp"
+            tools:text="ProductId: " />
+
+        <TextView
+            android:id="@+id/tvAutoRenewMessage"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="16dp"
+            android:gravity="center"
+            android:textSize="17sp"
+            tools:text="AutoRenew" />
+
+        <Space
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1" />
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btnManageGp"
+            style="@style/AccentButtonStyle"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom"
+            android:text="@string/manage_on_google_play" />
+    </LinearLayout>
+
+
 </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/auth/src/main/res/layout/list_item_subscription.xml b/auth/src/main/res/layout/list_item_subscription.xml
index 24d9a48ab..624f83c15 100644
--- a/auth/src/main/res/layout/list_item_subscription.xml
+++ b/auth/src/main/res/layout/list_item_subscription.xml
@@ -14,9 +14,8 @@
         android:id="@+id/ivIcon"
         style="@style/AuthLogoStyle"
         android:layout_width="@dimen/group_icon_size"
-        android:layout_height="0dp"
+        android:layout_height="@dimen/group_icon_size"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintDimensionRatio="W,1:1"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
diff --git a/auth/src/main/res/values/strings.xml b/auth/src/main/res/values/strings.xml
index 6726c3a87..cd4e34c60 100644
--- a/auth/src/main/res/values/strings.xml
+++ b/auth/src/main/res/values/strings.xml
@@ -159,6 +159,16 @@ Or, think about all of your friends across all of the places you\'ve ever lived.
     <string name="configure">Configure</string>
     <string name="receive_email_updates">Receive email updates</string>
     <string name="you_don_t_have_any_active_subscriptions">You don\'t have any active subscriptions</string>
+    <string name="manage_on_google_play">Manage on Google Play</string>
+    <string name="status_active">Status: Active</string>
+    <string name="price_format">Price: %s</string>
+    <string name="duration_format">Duration: %s</string>
+    <string name="purchase_time_format">Purchase time: %s</string>
+    <string name="product_id_format">Product id: %s</string>
+    <string name="is_auto_renew_message">Subscription will renew automatically</string>
+    <string name="is_not_auto_renew_message">Subscription will not renew automatically</string>
+    <string name="can_not_open_google_play">Can not open Google Play</string>
+
 
     <plurals name="days">
         <item quantity="one">%1$d day</item>
-- 
GitLab