Просмотр исходного кода

添加首页列表配置中的自定义

zengjiebin лет назад: 7
Родитель
Сommit
bc6cc36751

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/HomeListEntity.java

@@ -62,6 +62,9 @@ public class HomeListEntity implements IJumpWeb, IHomeList {
     private int IsNeedJsInteract;
 //    ChildList        []HomeList `orm:"-" description:"子集列表,如果为空可直接点击,不为空点击展示子列表" json:"child_list"`
     private List<HomeListEntity> child_list;
+//    CustomTag        string `orm:"column(custom_tag);size(20);null" description:"自定义标签"`
+
+    private String CustomTag;
 
     public int getTag() {
         return Tag;
@@ -200,6 +203,13 @@ public class HomeListEntity implements IJumpWeb, IHomeList {
         return child_list;
     }
 
+    public void setCustomTag(String customTag) {
+        CustomTag = customTag;
+    }
+
+    public String getCustomTag() {
+        return CustomTag;
+    }
 
 
 

+ 6 - 0
app/src/main/java/com/sheep/gamegroup/module/home/adapter/AdpHomeList.java

@@ -1,6 +1,7 @@
 package com.sheep.gamegroup.module.home.adapter;
 
 import android.support.annotation.Nullable;
+import android.view.View;
 import android.widget.ImageView;
 
 import com.bumptech.glide.Glide;
@@ -33,6 +34,11 @@ public class AdpHomeList<T extends IHomeList> extends BaseQuickAdapter<T, BaseVi
     @Override
     protected void convert(BaseViewHolder helper, final T item) {
         helper.setText(R.id.my_item_text, item.getTitle());
+        View my_item_text2 = helper.getView(R.id.my_item_text2);
+        ViewUtil.setVisibility(my_item_text2, item instanceof HomeListEntity);
+        if(item instanceof HomeListEntity) {
+            helper.setText(R.id.my_item_text2, ((HomeListEntity) item).getCustomTag());
+        }
         ViewUtil.updateTag(helper.getView(R.id.my_item_tag), item);
         Glide.with(SheepApp.getInstance()).load(item.getIcon()).into((ImageView) helper.getView(R.id.my_item_img));
     }

+ 13 - 0
app/src/main/res/layout/item_my_list_but.xml

@@ -26,6 +26,19 @@
         android:text="试玩赚钱"
         android:textColor="@color/black_6_3"
         android:textSize="13sp" />
+    <TextView
+        android:id="@+id/my_item_text2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="可赚151元"
+        android:textColor="#fff02155"
+        android:textSize="10sp"
+        android:layout_below="@id/my_item_text"
+        android:layout_marginTop="3dp"
+        android:layout_marginEnd="5dp"
+        android:singleLine="true"
+        android:gravity="center"
+        />
 
     <TextView
         android:id="@+id/my_item_tag"

+ 13 - 0
app/src/main/res/layout/item_my_list_but2.xml

@@ -26,6 +26,19 @@
         android:text="试玩赚钱"
         android:textColor="@color/white"
         android:textSize="13sp" />
+    <TextView
+        android:id="@+id/my_item_text2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="可赚151元"
+        android:textColor="#fff02155"
+        android:textSize="10sp"
+        android:layout_below="@id/my_item_text"
+        android:layout_marginTop="3dp"
+        android:layout_marginEnd="5dp"
+        android:singleLine="true"
+        android:gravity="center"
+        />
 
     <TextView
         android:id="@+id/my_item_tag"