Explorar o código

feat: 新人陪玩师标签

DoggyZhang hai 3 semanas
pai
achega
0dfd3b203a

+ 9 - 0
app/src/main/res/drawable/common_new_playmate_tag_bg.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <gradient
+        android:centerColor="#66FFD35B"
+        android:endColor="#66FFFFFF"
+        android:startColor="#66FFD35B" />
+    <corners android:radius="30dp" />
+</shape>

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

@@ -367,5 +367,8 @@
     <string name="common_expand">perluas</string>
     <string name="common_select_photo">Pilih foto</string>
     <string name="common_select_video">Pilih video</string>
-    <string name="order_discount">Diskon</string>
+    <string name="common_price_discount">%s%% Diskon</string>
+    <string name="common_price_discount_new_only">Newbie Only | %s%% Diskon</string>
+    <string name="common_discount">Diskon</string>
+    <string name="common_newbie">Newbie</string>
 </resources>

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

@@ -369,5 +369,6 @@
     <string name="common_select_video">选择视频</string>
     <string name="common_price_discount">%s%% 折扣</string>
     <string name="common_price_discount_new_only">仅限新用户|%s%% 折扣</string>
-    <string name="order_discount">折扣</string>
+    <string name="common_discount">折扣</string>
+    <string name="common_newbie">新人</string>
 </resources>

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

@@ -1213,4 +1213,5 @@
     <color name="color_80B1EF5D">#80B1EF5D</color>
     <color name="color_FFC4C4C4">#FFC4C4C4</color>
     <color name="color_FFFF6F32">#FFFF6F32</color>
+    <color name="color_FFDE9D2E">#FFDE9D2E</color>
 </resources>

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

@@ -376,5 +376,6 @@
     <string name="common_select_video">Select video</string>
     <string name="common_price_discount">%s%% OFF</string>
     <string name="common_price_discount_new_only">New Only | %s%% OFF</string>
-    <string name="order_discount">Discount</string>
+    <string name="common_discount">Discount</string>
+    <string name="common_newbie">Newbie</string>
 </resources>

+ 1 - 1
module/order/src/main/res/layout/activity_create_order.xml

@@ -236,7 +236,7 @@
                         android:fontFamily="@font/poppins_semibold"
                         android:includeFontPadding="false"
                         android:singleLine="true"
-                        android:text="@string/order_discount"
+                        android:text="@string/common_discount"
                         android:textColor="@color/color_FF1D2129"
                         android:textSize="12sp"
                         app:layout_constrainedWidth="true"

+ 1 - 1
module/order/src/main/res/layout/activity_order_detail.xml

@@ -332,7 +332,7 @@
                         android:layout_width="0dp"
                         android:layout_height="wrap_content"
                         android:includeFontPadding="false"
-                        android:text="@string/order_discount"
+                        android:text="@string/common_discount"
                         android:textColor="@color/color_FF1D2129"
                         android:textSize="12sp"
                         app:layout_constraintBottom_toBottomOf="parent"

+ 1 - 1
module/order/src/main/res/layout/activity_qrcode_order.xml

@@ -263,7 +263,7 @@
                         android:fontFamily="@font/poppins_semibold"
                         android:includeFontPadding="false"
                         android:singleLine="true"
-                        android:text="@string/order_discount"
+                        android:text="@string/common_discount"
                         android:textColor="@color/color_FF1D2129"
                         android:textSize="12sp"
                         app:layout_constrainedWidth="true"

+ 1 - 1
module/order/src/main/res/layout/dialog_create_order.xml

@@ -154,7 +154,7 @@
                 android:gravity="center"
                 android:includeFontPadding="false"
                 android:singleLine="true"
-                android:text="@string/order_discount"
+                android:text="@string/common_discount"
                 android:textColor="@color/color_FF1D2129"
                 android:textSize="14sp"
                 app:layout_constrainedWidth="true"

+ 1 - 1
module/order/src/main/res/layout/dialog_qrcode_create_order.xml

@@ -142,7 +142,7 @@
                 android:gravity="center"
                 android:includeFontPadding="false"
                 android:singleLine="true"
-                android:text="@string/order_discount"
+                android:text="@string/common_discount"
                 android:textColor="@color/color_FF1D2129"
                 android:textSize="14sp"
                 app:layout_constrainedWidth="true"

+ 1 - 1
module/order/src/main/res/layout/layout_playmate_order_list_item.xml

@@ -125,7 +125,7 @@
                 style="@style/CommonDiscountPriceView"
                 android:layout_width="wrap_content"
                 android:layout_marginEnd="4dp"
-                android:text="@string/order_discount"
+                android:text="@string/common_discount"
                 android:visibility="gone"
                 app:layout_constraintBottom_toBottomOf="@id/tv_price"
                 app:layout_constraintEnd_toStartOf="@id/tv_price"

+ 1 - 1
module/order/src/main/res/layout/layout_user_order_list_item.xml

@@ -262,7 +262,7 @@
             style="@style/CommonDiscountPriceView"
             android:layout_width="wrap_content"
             android:layout_marginEnd="4dp"
-            android:text="@string/order_discount"
+            android:text="@string/common_discount"
             android:visibility="gone"
             app:layout_constraintBottom_toBottomOf="@id/tv_order_all_cost"
             app:layout_constraintEnd_toStartOf="@id/tv_order_all_cost"

+ 5 - 0
module/playmate/src/main/java/com/adealink/weparty/playmate/data/PlaymateListData.kt

@@ -107,6 +107,11 @@ data class PlaymateListData(
     @SerializedName("orderCount") val commentCount: Int, //评价数
     @SerializedName("online") val online: Boolean, //是否在线
     @SerializedName("distance") val distance: Float, //距离(单位:km)
+
+    @GsonNullable
+    @SerializedName("playmateCreatedAt") val playmateCreatedAt: Long?, //成为陪玩师时间
+    @GsonNullable
+    @SerializedName("newcomer") val newcomer: Boolean?, //是否新人陪玩师
 )
 
 data class PlaymateListItemData(

+ 15 - 3
module/playmate/src/main/java/com/adealink/weparty/playmate/list/adapter/PlaymateListItemViewBinder.kt

@@ -100,9 +100,21 @@ class PlaymateListItemViewBinder(
             binding.vGender.setAge(item.data.age)
             binding.vGender.setGender(item.data.gender)
             binding.tvLocation.text = formatDistanceStr(item.data.distance)
-            binding.tvStar.text = formatStar(item.data.star)
-            binding.tvComment.text =
-                getCompatString(R.string.playmate_comment_count, item.data.commentCount.toString())
+
+            if (item.data.newcomer == true) {
+                binding.clNew.show()
+                binding.clComment.gone()
+            } else {
+                binding.clNew.gone()
+                binding.clComment.show()
+                binding.tvStar.text = formatStar(item.data.star)
+                binding.tvComment.text =
+                    getCompatString(
+                        R.string.playmate_comment_count,
+                        item.data.commentCount.toString()
+                    )
+            }
+
             binding.ivCategory.setImageUrl(item.data.categoryIcon)
             binding.tvCategory.text = item.data.categoryName
             if (item.data.summary.isEmpty()) {

+ 61 - 31
module/playmate/src/main/res/layout/item_playmate_home_list.xml

@@ -137,43 +137,73 @@
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <!--评分-->
-    <androidx.appcompat.widget.AppCompatImageView
-        android:id="@+id/iv_star"
-        android:layout_width="14dp"
-        android:layout_height="14dp"
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/cl_comment"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         android:layout_marginStart="12dp"
-        android:layout_marginTop="5dp"
+        android:layout_marginTop="3dp"
         app:layout_constraintStart_toEndOf="@id/v_barrier_start"
-        app:layout_constraintTop_toBottomOf="@id/tv_name"
-        app:srcCompat="@drawable/common_evaluate_star_selected_ic" />
+        app:layout_constraintTop_toBottomOf="@id/tv_name">
 
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_star"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="3dp"
-        android:includeFontPadding="false"
-        android:singleLine="true"
-        android:textColor="@color/color_FF1D2129"
-        android:textSize="12sp"
-        android:textStyle="bold"
-        app:layout_constraintBottom_toBottomOf="@id/iv_star"
-        app:layout_constraintStart_toEndOf="@id/iv_star"
-        app:layout_constraintTop_toTopOf="@id/iv_star"
-        tools:text="4.2" />
+        <androidx.appcompat.widget.AppCompatImageView
+            android:id="@+id/iv_star"
+            android:layout_width="14dp"
+            android:layout_height="14dp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:srcCompat="@drawable/common_evaluate_star_selected_ic" />
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tv_star"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="3dp"
+            android:includeFontPadding="false"
+            android:singleLine="true"
+            android:textColor="@color/color_FF1D2129"
+            android:textSize="12sp"
+            android:textStyle="bold"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toEndOf="@id/iv_star"
+            app:layout_constraintTop_toTopOf="parent"
+            tools:text="4.2" />
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tv_comment"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="3dp"
+            android:includeFontPadding="false"
+            android:singleLine="true"
+            android:textColor="@color/color_FF86909C"
+            android:textSize="11sp"
+            app:layout_constraintBaseline_toBaselineOf="@id/tv_star"
+            app:layout_constraintStart_toEndOf="@id/tv_star"
+            tools:text="(234评价)" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
 
     <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_comment"
+        android:id="@+id/cl_new"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="3dp"
+        android:layout_height="15dp"
+        android:layout_marginStart="12dp"
+        android:layout_marginTop="3dp"
+        android:background="@drawable/common_new_playmate_tag_bg"
+        android:gravity="center"
         android:includeFontPadding="false"
+        android:paddingStart="6dp"
+        android:paddingEnd="14dp"
         android:singleLine="true"
-        android:textColor="@color/color_FF86909C"
+        android:text="@string/common_newbie"
+        android:textColor="@color/color_FFDE9D2E"
         android:textSize="11sp"
-        app:layout_constraintBaseline_toBaselineOf="@id/tv_star"
-        app:layout_constraintStart_toEndOf="@id/tv_star"
-        tools:text="(234评价)" />
+        android:visibility="gone"
+        app:layout_constraintStart_toEndOf="@id/v_barrier_start"
+        app:layout_constraintTop_toBottomOf="@id/cl_comment"
+        tools:visibility="visible" />
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/cl_category"
@@ -182,10 +212,10 @@
         android:layout_marginTop="3dp"
         android:background="@drawable/playmate_list_item_category_bg"
         android:paddingVertical="2dp"
-        android:paddingStart="2dp"
+        android:paddingStart="12dp"
         android:paddingEnd="6dp"
-        app:layout_constraintStart_toStartOf="@id/iv_star"
-        app:layout_constraintTop_toBottomOf="@id/iv_star">
+        app:layout_constraintStart_toEndOf="@id/v_barrier_start"
+        app:layout_constraintTop_toBottomOf="@id/cl_new">
 
         <com.adealink.frame.image.view.NetworkImageView
             android:id="@+id/iv_category"