From f74a01efc0558d2cf77166cb0e1a3b8b9c644ed1 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 9 Nov 2022 17:02:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F:=E6=9D=83=E7=9B=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/CustomDrawerPopupAdapter.java | 3 ++ .../common/adapter/FunGamesAdapter.java | 7 ++- .../common/bean/CustomSidebarChildModel.java | 11 +++++ .../common/views/FunGamesChildViewHolder.java | 10 +++- .../common/views/FunGamesViewHolder.java | 2 +- .../views/RigtsInterestsViewHolder.java | 48 +++++++++++++++++-- .../res/layout/view_fun_games_child_view.xml | 11 ++--- .../main/res/layout/view_rights_interests.xml | 33 +++++++++++-- 8 files changed, 108 insertions(+), 17 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java b/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java index 1ff46d624..d1c6c4847 100644 --- a/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java @@ -70,6 +70,9 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter { }else if (holder instanceof FunGamesViewHolder) { FunGamesViewHolder funGamesViewHolder = (FunGamesViewHolder) holder; funGamesViewHolder.setData(infoModels.get(position)); + }else if (holder instanceof RigtsInterestsViewHolder) { + RigtsInterestsViewHolder rigtsInterestsViewHolder = (RigtsInterestsViewHolder) holder; + rigtsInterestsViewHolder.setData(infoModels.get(position)); } } diff --git a/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java index 5c55d6aa0..6624a20e2 100644 --- a/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java @@ -17,10 +17,12 @@ import java.util.List; public class FunGamesAdapter extends RecyclerView.Adapter { private Context mContext; + private boolean rigts ; private List child = new ArrayList<>(); - public FunGamesAdapter(Context mContext) { + public FunGamesAdapter(Context mContext,boolean rigts) { this.mContext = mContext; + this.rigts = rigts; } @NonNull @@ -33,13 +35,14 @@ public class FunGamesAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { FunGamesChildViewHolder childViewHolder = (FunGamesChildViewHolder) holder; - ((FunGamesChildViewHolder) holder).setData(child.get(position)); + childViewHolder.setData(child.get(position),rigts); } @Override public int getItemCount() { return child.size(); } + public void updateData(List mChild) { child.clear(); child.addAll(mChild); diff --git a/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java b/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java index 4a5324e1a..ff382aedd 100644 --- a/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java +++ b/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java @@ -29,6 +29,17 @@ public class CustomSidebarChildModel extends BaseModel { @SerializedName("now_num") private String nowNum; + private int resIcon; + + public int getResIcon() { + return resIcon; + } + + public CustomSidebarChildModel setResIcon(int resIcon) { + this.resIcon = resIcon; + return this; + } + public String getId() { return id; } diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java index 033733abb..7ada96f47 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java @@ -21,8 +21,14 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { funGameName = itemView.findViewById(R.id.fun_game_name); } - public void setData(CustomSidebarChildModel model) { - ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic); + public void setData(CustomSidebarChildModel model, boolean rigts) { + if (rigts) { + ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic); + } else { + ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); + } + + funGameName.setText(model.getTitle()); } } diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java index a971eebe1..4a7494997 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java @@ -21,7 +21,7 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder { sendGoodGift = itemView.findViewById(R.id.send_good_gift); subtitle = itemView.findViewById(R.id.subtitle); childList = itemView.findViewById(R.id.child_list); - funGamesAdapter = new FunGamesAdapter(itemView.getContext()); + funGamesAdapter = new FunGamesAdapter(itemView.getContext(), true); childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4)); childList.setAdapter(funGamesAdapter); } diff --git a/common/src/main/java/com/yunbao/common/views/RigtsInterestsViewHolder.java b/common/src/main/java/com/yunbao/common/views/RigtsInterestsViewHolder.java index 9c381da96..0edee2dc5 100644 --- a/common/src/main/java/com/yunbao/common/views/RigtsInterestsViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/RigtsInterestsViewHolder.java @@ -1,13 +1,55 @@ package com.yunbao.common.views; import android.view.View; +import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.yunbao.common.R; +import com.yunbao.common.adapter.FunGamesAdapter; +import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.bean.CustomSidebarInfoModel; + +import java.util.ArrayList; +import java.util.List; + public class RigtsInterestsViewHolder extends RecyclerView.ViewHolder { - public RigtsInterestsViewHolder(@NonNull View itemView) { - super(itemView); - } + private FunGamesAdapter funGamesAdapter; + private TextView sendGoodGift; + private RecyclerView childList; + + public RigtsInterestsViewHolder(@NonNull View itemView) { + super(itemView); + sendGoodGift = itemView.findViewById(R.id.send_good_gift); + childList = itemView.findViewById(R.id.child_list); + sendGoodGift = itemView.findViewById(R.id.send_good_gift); + childList = itemView.findViewById(R.id.child_list); + funGamesAdapter = new FunGamesAdapter(itemView.getContext(), false); + childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 3)); + childList.setAdapter(funGamesAdapter); + } + + public void setData(CustomSidebarInfoModel model) { + + sendGoodGift.setText(model.getTitle()); + funGamesAdapter.updateData(generateData()); + } + + private List generateData() { + List child = new ArrayList<>(); + child.add(new CustomSidebarChildModel() + .setTitle(itemView.getContext().getString(R.string.noble)) + .setResIcon(R.mipmap.live_more_icon_aristocrat)); + child.add(new CustomSidebarChildModel() + .setTitle(itemView.getContext().getString(R.string.guard_guard)) + .setResIcon(R.mipmap.live_more_icon_guard)); + child.add(new CustomSidebarChildModel() + .setTitle(itemView.getContext().getString(R.string.fan_club)) + .setResIcon(R.mipmap.live_more_icon_fans)); + return child; + + } } diff --git a/common/src/main/res/layout/view_fun_games_child_view.xml b/common/src/main/res/layout/view_fun_games_child_view.xml index af4505e8a..eebec3aef 100644 --- a/common/src/main/res/layout/view_fun_games_child_view.xml +++ b/common/src/main/res/layout/view_fun_games_child_view.xml @@ -1,16 +1,15 @@ + android:textSize="10sp" /> \ No newline at end of file diff --git a/common/src/main/res/layout/view_rights_interests.xml b/common/src/main/res/layout/view_rights_interests.xml index 77d9ef65f..002af5892 100644 --- a/common/src/main/res/layout/view_rights_interests.xml +++ b/common/src/main/res/layout/view_rights_interests.xml @@ -1,6 +1,33 @@ - + android:layout_height="wrap_content" + android:layout_marginStart="10dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="10dp" + android:background="@drawable/bg_drawer_popup" + android:orientation="vertical"> - \ No newline at end of file + + + + + + + \ No newline at end of file