From da3398f1f9fccd8733fa802332ef6c56225dfcdf Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 14 Nov 2022 16:54:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/adapter/FunGamesAdapter.java | 18 +++++++-- .../common/views/FunGamesViewHolder.java | 35 ++++++++++++++++-- .../main/res/layout/view_fun_games_view.xml | 26 +++++++++++++ .../main/res/mipmap-xxhdpi/icon_more_down.png | Bin 0 -> 584 bytes .../main/res/mipmap-xxhdpi/icon_more_up.png | Bin 0 -> 589 bytes common/src/main/res/values/strings.xml | 2 + 6 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 common/src/main/res/mipmap-xxhdpi/icon_more_down.png create mode 100644 common/src/main/res/mipmap-xxhdpi/icon_more_up.png 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 6624a20e2..52a0bc0a8 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,10 @@ import java.util.List; public class FunGamesAdapter extends RecyclerView.Adapter { private Context mContext; - private boolean rigts ; + private boolean rigts; private List child = new ArrayList<>(); - public FunGamesAdapter(Context mContext,boolean rigts) { + public FunGamesAdapter(Context mContext, boolean rigts) { this.mContext = mContext; this.rigts = rigts; } @@ -35,7 +35,7 @@ public class FunGamesAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { FunGamesChildViewHolder childViewHolder = (FunGamesChildViewHolder) holder; - childViewHolder.setData(child.get(position),rigts); + childViewHolder.setData(child.get(position), rigts); } @Override @@ -44,6 +44,18 @@ public class FunGamesAdapter extends RecyclerView.Adapter { } public void updateData(List mChild) { + child.clear(); + if (mChild.size() > 8) { + for (int i = 0; i < 8; i++) { + child.add(mChild.get(i)); + } + } else { + child.addAll(mChild); + } + notifyDataSetChanged(); + } + + public void selectAll(List mChild){ child.clear(); child.addAll(mChild); notifyDataSetChanged(); 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 1d644ef21..93304d88c 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java @@ -1,8 +1,8 @@ package com.yunbao.common.views; -import android.os.Bundle; import android.text.TextUtils; import android.view.View; +import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; @@ -12,24 +12,32 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.adapter.FunGamesAdapter; +import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.event.CustomDrawerPopupEvent; +import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; +import java.util.List; + public class FunGamesViewHolder extends RecyclerView.ViewHolder { private FunGamesAdapter funGamesAdapter; - private TextView sendGoodGift, subtitle; + private TextView sendGoodGift, subtitle, selectMore; private RecyclerView childList; + private ImageView selectMoreIcon; + boolean isShowMore = true; public FunGamesViewHolder(@NonNull View itemView) { super(itemView); sendGoodGift = itemView.findViewById(R.id.send_good_gift); subtitle = itemView.findViewById(R.id.subtitle); childList = itemView.findViewById(R.id.child_list); + selectMoreIcon = itemView.findViewById(R.id.select_more_icon); + selectMore = itemView.findViewById(R.id.select_more); funGamesAdapter = new FunGamesAdapter(itemView.getContext(), true); childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4)); childList.setAdapter(funGamesAdapter); @@ -37,9 +45,14 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder { } public void setData(CustomSidebarInfoModel model) { + + List sidebarChildModels = model.getChild(); +// sidebarChildModels.addAll(model.getChild()); +// sidebarChildModels.addAll(model.getChild()); + itemView.findViewById(R.id.select_more_layout).setVisibility(sidebarChildModels.size() >= 8 ? View.VISIBLE : View.GONE); sendGoodGift.setText(model.getTitle()); subtitle.setText(model.getSubtitle()); - funGamesAdapter.updateData(model.getChild()); + funGamesAdapter.updateData(sidebarChildModels); ViewClicksAntiShake.clicksAntiShake(subtitle, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { @@ -64,5 +77,21 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder { } }); + ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.select_more_layout), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (isShowMore) { + funGamesAdapter.selectAll(sidebarChildModels); + + selectMore.setText(R.string.video_comment_collapsed); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_up, selectMoreIcon); + } else { + funGamesAdapter.updateData(sidebarChildModels); + selectMore.setText(R.string.moer); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_down, selectMoreIcon); + } + isShowMore = !isShowMore; + } + }); } } diff --git a/common/src/main/res/layout/view_fun_games_view.xml b/common/src/main/res/layout/view_fun_games_view.xml index 10d52e99e..6da8f3b5a 100644 --- a/common/src/main/res/layout/view_fun_games_view.xml +++ b/common/src/main/res/layout/view_fun_games_view.xml @@ -43,4 +43,30 @@ android:layout_height="wrap_content" android:layout_marginBottom="16dp" /> + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/icon_more_down.png b/common/src/main/res/mipmap-xxhdpi/icon_more_down.png new file mode 100644 index 0000000000000000000000000000000000000000..2296877ce96482192a7784e0b45be3eaa37d5a9c GIT binary patch literal 584 zcmV-O0=NB%P)Px%0!c(cR7gwhls#({VHAa*vpc(!n2^X8u{4M%*jrhMf|Y2crNqKC7Qv|ag(CP# zf*&D;jVX++X)LS+wXyLB2#QMVl150-?9T4Y9GP*0G1(-jY`4?BFz(hQf)bMS?Ffbi0aksx;-~Okog#}l_EnEhM1dkQP{_K<;c~LP#!qu)WefSqht>)bn zxrI5_y#GbD*hic)B^Uq_#9IdpbxX5<1F71BikZgj1B!@w#IS6uo^X_u3BzEs=*O^> zzv8{5WFwI6BCscFFazxRB?PmW(Q=vR`H(Y69J4<)pFUCGe7VRANpUNP?Vz4; z*eUmbo%ucSE`>{70dFMv4;N(`7K%Jd&B2VDwW*YmFx0bFfGF~D!z5x`{&4Y%gwrc$ zxW=Ycd%I$$Fb6U%B@&yFu*4HdOBrZx&OKWz3`tDdWD;ewdmRRxlJs@uV_NQk?SZJl zP2dF34g8Rp_`b+^r2_Ss3pQtf9-s<5jq6Px%2T4RhR7gwhl)Y;dQ5400XJ)dSM3aDprZb2r_y^e7s9+^x6I){u8;cM>h$w2| zx1vS@RjQ!FMBv$Hd^M`qoSxY=Y)5wO_TJ>KQ~IQQOn#1PCV>Y9}wj2z+Ok%G0^k}XTvIby#cbxJZa|8$_GMkZ~ zC8qlOwOAXn-5n>Kk(jUvfebO@h~X~jdqXQ%uH~}#2O-Z4N9|mRAA*r$QLmcWk7J*5 zzyxNOl$SF@#<|W;eOj)sIk2sA%HaU++Z?Pveo?@sLdY9QX)}QBsFHD_5nsZU@gbDQ;E zzIVh>mo(ez6RmzEdVU;WX3hb$`-!vK5R`+l-kbH)O+{QKcDBzpo z#CHs5fvNZx_xk!&+Kgyp?fkrV6uY?s3<)M%Mn!!I+F7)=>+LN1D=L;R?JR0%(LY60 bV;21e|2~O1fy4$a00000NkvXXu0mjf295_< literal 0 HcmV?d00001 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 29d0472e3..1ba3b46b0 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -781,6 +781,7 @@ 鼓勵記錄 暫時還沒有人給予作者鼓勵T_T 點擊查看更多 + 客服 設定 每日13:00PM-1:00AM @@ -960,4 +961,5 @@ 已領取 畫質選擇 更多設置 + 查看更多