浏览代码

添加老师端首页热门专辑付费tag

Pq 2 年之前
父节点
当前提交
f1e936f90e

+ 13 - 0
teacher/src/main/java/com/cooleshow/teacher/adapter/HomeHotAlbumAdapter.java

@@ -1,5 +1,7 @@
 package com.cooleshow.teacher.adapter;
 
+import android.text.TextUtils;
+import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
 
@@ -30,5 +32,16 @@ public class HomeHotAlbumAdapter extends BaseQuickAdapter<HomeHotAlbumListBean.R
         TextView tv_collect_num = helper.getView(R.id.tv_collect_num);
         tv_collect_num.setText(String.format("%d人", item.albumFavoriteCount));
         helper.setText(R.id.album_name, item.albumName);
+
+        TextView tv_payment_type = helper.getView(R.id.tv_payment_type);
+        if (!TextUtils.isEmpty(item.paymentType) && TextUtils.equals(item.paymentType, "CHARGE")) {
+            //收费
+            tv_payment_type.setVisibility(View.VISIBLE);
+            tv_payment_type.setText("付费");
+        } else {
+            //免费
+            tv_payment_type.setVisibility(View.GONE);
+            tv_payment_type.setText("免费");
+        }
     }
 }

+ 1 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/HomeHotAlbumListBean.java

@@ -75,5 +75,6 @@ public class HomeHotAlbumListBean {
         public String topFlag;
         public int updateBy;
         public String updateTime;
+        public String paymentType;//FREE免费 CHARGE付费
     }
 }

+ 10 - 0
teacher/src/main/res/drawable/shape_home_album_tag_bg.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient
+        android:angle="270"
+        android:endColor="@color/color_ff5100"
+        android:startColor="@color/color_ff8900" />
+
+    <corners android:topLeftRadius="6dp"
+        android:bottomRightRadius="6dp"/>
+</shape>

+ 17 - 1
teacher/src/main/res/layout/layout_home_hot_album_item.xml

@@ -2,7 +2,8 @@
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="wrap_content"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    xmlns:tools="http://schemas.android.com/tools">
 
     <com.cooleshow.base.widgets.QMUIRadiusImageView
         android:id="@+id/im_pic"
@@ -12,6 +13,21 @@
         app:layout_constraintTop_toTopOf="parent"
         app:qmui_corner_radius="10dp" />
 
+    <TextView
+        android:id="@+id/tv_payment_type"
+        app:layout_constraintLeft_toLeftOf="@+id/im_pic"
+        app:layout_constraintTop_toTopOf="@+id/im_pic"
+        android:layout_width="wrap_content"
+        android:layout_height="14dp"
+        android:background="@drawable/shape_home_album_tag_bg"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:paddingStart="6dp"
+        android:paddingEnd="6dp"
+        tools:text="付费"
+        android:textColor="@color/white"
+        android:textSize="@dimen/sp_9" />
+
     <LinearLayout
         android:id="@+id/img_root"
         android:layout_width="wrap_content"