Browse Source

订阅列表增加tag显示

zk 1 year ago
parent
commit
d6ecebf556

+ 14 - 0
app/src/main/java/com/atmob/voiceai/module/subscription/SubscriptionPageActivity.java

@@ -3,6 +3,7 @@ package com.atmob.voiceai.module.subscription;
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.Canvas;
 import android.graphics.Rect;
 import android.os.Bundle;
 import android.view.View;
@@ -87,6 +88,19 @@ public class SubscriptionPageActivity extends BaseActivity<ActivitySubscriptionP
         binding.rvGoodsList.setAdapter(subscriptionAdapter);
         binding.rvGoodsList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
         subscriptionAdapter.setActionHandler(goodsBean -> subscriptionPageViewModel.setCheckGoodsBean(goodsBean));
+        binding.rvGoodsList.addItemDecoration(new RecyclerView.ItemDecoration() {
+
+            @Override
+            public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
+
+                int childAdapterPosition = parent.getChildAdapterPosition(view);
+                if (childAdapterPosition == subscriptionAdapter.getItemCount() - 1) {
+                    outRect.set(0, 0, 0, 0);
+                } else {
+                    outRect.set(0, 0, 0, -(int) SizeUtil.dp2px(12.5f));
+                }
+            }
+        });
     }
 
     private void initScrollView() {

+ 2 - 2
app/src/main/java/com/atmob/voiceai/sdk/billing/GPBillingClient.java

@@ -88,7 +88,7 @@ public class GPBillingClient implements PurchasesUpdatedListener {
 
 
     /**
-     * 开启重要的尝试连接操作
+     * 开启间隔时间较短的连接操作
      */
     public void startUrgentConnection() {
         urgentConnectionRunnable = () -> {
@@ -101,7 +101,7 @@ public class GPBillingClient implements PurchasesUpdatedListener {
     }
 
     /**
-     * 关闭重要的尝试连接操作
+     * 关闭连接操作
      */
     public void endUrgentConnection() {
         AtmobLog.d(TAG, "End connection.——Urgent");

+ 18 - 4
app/src/main/res/layout/activity_subscription_page.xml

@@ -371,15 +371,29 @@
                     android:id="@+id/space4"
                     android:layout_width="match_parent"
                     android:layout_height="0dp"
-                    app:layout_constraintDimensionRatio="360:24"
+                    app:layout_constraintDimensionRatio="360:15"
                     app:layout_constraintTop_toBottomOf="@id/v_sub_card" />
 
+                <Space
+                    android:id="@+id/space_ry_top"
+                    android:layout_width="match_parent"
+                    android:layout_height="12.5dp"
+                    app:layout_constraintTop_toTopOf="@+id/rv_goods_list" />
+
+                <View
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:background="@drawable/bg_sub_goods_list"
+                    app:layout_constraintBottom_toBottomOf="@+id/rv_goods_list"
+                    app:layout_constraintEnd_toEndOf="@+id/rv_goods_list"
+                    app:layout_constraintStart_toStartOf="@+id/rv_goods_list"
+                    app:layout_constraintTop_toBottomOf="@+id/space_ry_top" />
+
                 <androidx.recyclerview.widget.RecyclerView
                     android:id="@+id/rv_goods_list"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginHorizontal="16dp"
-                    android:background="@drawable/bg_sub_goods_list"
                     android:overScrollMode="never"
                     app:layout_constraintTop_toBottomOf="@+id/space4"
                     tools:itemCount="3"
@@ -429,8 +443,8 @@
             app:layout_constraintTop_toTopOf="@+id/v_menu" />
 
         <ImageView
-            isGone="@{!subscriptionViewModel.isShowCloseBtn}"
             android:id="@+id/iv_back"
+            isGone="@{!subscriptionViewModel.isShowCloseBtn}"
             android:layout_width="0dp"
             android:layout_height="0dp"
             android:layout_marginStart="14dp"
@@ -463,12 +477,12 @@
             app:layout_constraintDimensionRatio="360:110" />
 
         <TextView
-            android:onClick="@{()-> subscriptionViewModel.onSubNowClick()}"
             android:id="@+id/tv_sub_now"
             android:layout_width="0dp"
             android:layout_height="0dp"
             android:background="@drawable/bg_voice_ai_btn"
             android:gravity="center"
+            android:onClick="@{()-> subscriptionViewModel.onSubNowClick()}"
             android:text="@string/sub_now"
             android:textColor="@color/colorPrimary"
             android:textSize="17sp"

+ 26 - 1
app/src/main/res/layout/item_sub_goods_list.xml

@@ -23,6 +23,13 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
+        <Space
+            android:id="@+id/space_top"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            app:layout_constraintDimensionRatio="360:12.5"
+            app:layout_constraintTop_toTopOf="parent" />
+
 
         <View
             android:id="@+id/v_goods_bg"
@@ -31,7 +38,25 @@
             android:background="@{goodsBean.select ? @drawable/bg_sub_goods_selected : null}"
             android:onClick="@{onItemClick}"
             app:layout_constraintDimensionRatio="328:72"
-            app:layout_constraintTop_toTopOf="parent" />
+            app:layout_constraintTop_toBottomOf="@+id/space_top" />
+
+
+        <TextView
+            isGone="@{!goodsBean.select || !goodsBean.popular}"
+            android:layout_width="wrap_content"
+            android:layout_height="25dp"
+            android:background="@drawable/bg_popular"
+            android:gravity="center"
+            android:paddingHorizontal="10dp"
+            android:text="@string/sub_most_popular"
+            android:textColor="@color/colorPrimary"
+            android:textSize="13sp"
+            android:textStyle="bold"
+            app:drawableEndCompat="@drawable/icon_sub_popular"
+            app:layout_constraintDimensionRatio="115:25"
+            app:layout_constraintEnd_toEndOf="@id/space_top"
+            app:layout_constraintStart_toStartOf="@+id/space_top"
+            app:layout_constraintTop_toTopOf="@+id/space_top" />
 
 
         <ImageView

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -108,4 +108,5 @@
     <string name="pay_success">Subscription Successful</string>
     <string name="member_restore_fail">Subscription restoration failed</string>
     <string name="member_restore_success">Subscription restoration successful</string>
+    <string name="sub_most_popular">Most Popular</string>
 </resources>