侧边栏修改
This commit is contained in:
parent
81763110d7
commit
da3398f1f9
@ -17,10 +17,10 @@ import java.util.List;
|
|||||||
|
|
||||||
public class FunGamesAdapter extends RecyclerView.Adapter {
|
public class FunGamesAdapter extends RecyclerView.Adapter {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private boolean rigts ;
|
private boolean rigts;
|
||||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||||
|
|
||||||
public FunGamesAdapter(Context mContext,boolean rigts) {
|
public FunGamesAdapter(Context mContext, boolean rigts) {
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
this.rigts = rigts;
|
this.rigts = rigts;
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ public class FunGamesAdapter extends RecyclerView.Adapter {
|
|||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
FunGamesChildViewHolder childViewHolder = (FunGamesChildViewHolder) holder;
|
FunGamesChildViewHolder childViewHolder = (FunGamesChildViewHolder) holder;
|
||||||
childViewHolder.setData(child.get(position),rigts);
|
childViewHolder.setData(child.get(position), rigts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -44,6 +44,18 @@ public class FunGamesAdapter extends RecyclerView.Adapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
public void updateData(List<CustomSidebarChildModel> 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<CustomSidebarChildModel> mChild){
|
||||||
child.clear();
|
child.clear();
|
||||||
child.addAll(mChild);
|
child.addAll(mChild);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.yunbao.common.views;
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -12,24 +12,32 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.adapter.FunGamesAdapter;
|
import com.yunbao.common.adapter.FunGamesAdapter;
|
||||||
|
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.event.CustomDrawerPopupEvent;
|
import com.yunbao.common.event.CustomDrawerPopupEvent;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
||||||
private FunGamesAdapter funGamesAdapter;
|
private FunGamesAdapter funGamesAdapter;
|
||||||
private TextView sendGoodGift, subtitle;
|
private TextView sendGoodGift, subtitle, selectMore;
|
||||||
private RecyclerView childList;
|
private RecyclerView childList;
|
||||||
|
private ImageView selectMoreIcon;
|
||||||
|
boolean isShowMore = true;
|
||||||
|
|
||||||
public FunGamesViewHolder(@NonNull View itemView) {
|
public FunGamesViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
|
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
|
||||||
subtitle = itemView.findViewById(R.id.subtitle);
|
subtitle = itemView.findViewById(R.id.subtitle);
|
||||||
childList = itemView.findViewById(R.id.child_list);
|
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);
|
funGamesAdapter = new FunGamesAdapter(itemView.getContext(), true);
|
||||||
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
|
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
|
||||||
childList.setAdapter(funGamesAdapter);
|
childList.setAdapter(funGamesAdapter);
|
||||||
@ -37,9 +45,14 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setData(CustomSidebarInfoModel model) {
|
public void setData(CustomSidebarInfoModel model) {
|
||||||
|
|
||||||
|
List<CustomSidebarChildModel> 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());
|
sendGoodGift.setText(model.getTitle());
|
||||||
subtitle.setText(model.getSubtitle());
|
subtitle.setText(model.getSubtitle());
|
||||||
funGamesAdapter.updateData(model.getChild());
|
funGamesAdapter.updateData(sidebarChildModels);
|
||||||
ViewClicksAntiShake.clicksAntiShake(subtitle, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(subtitle, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
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;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,4 +43,30 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:layout_marginBottom="16dp" />
|
android:layout_marginBottom="16dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/select_more_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:padding="14dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/select_more"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="@string/moer"
|
||||||
|
android:textColor="#EEF1FF"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/select_more_icon"
|
||||||
|
android:layout_width="8dp"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:layout_marginStart="3dp"
|
||||||
|
android:src="@mipmap/icon_more_down" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
BIN
common/src/main/res/mipmap-xxhdpi/icon_more_down.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_more_down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 584 B |
BIN
common/src/main/res/mipmap-xxhdpi/icon_more_up.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_more_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 589 B |
@ -781,6 +781,7 @@
|
|||||||
<string name="encourage_dynamic_list">鼓勵記錄</string>
|
<string name="encourage_dynamic_list">鼓勵記錄</string>
|
||||||
<string name="encourage_list_nodata">暫時還沒有人給予作者鼓勵T_T</string>
|
<string name="encourage_list_nodata">暫時還沒有人給予作者鼓勵T_T</string>
|
||||||
<string name="click_moer">點擊查看更多</string>
|
<string name="click_moer">點擊查看更多</string>
|
||||||
|
|
||||||
<string name="customer_service">客服</string>
|
<string name="customer_service">客服</string>
|
||||||
<string name="set_up">設定</string>
|
<string name="set_up">設定</string>
|
||||||
<string name="kefu_time">每日13:00PM-1:00AM</string>
|
<string name="kefu_time">每日13:00PM-1:00AM</string>
|
||||||
@ -960,4 +961,5 @@
|
|||||||
<string name="already_collected" translatable="false">已領取</string>
|
<string name="already_collected" translatable="false">已領取</string>
|
||||||
<string name="image_quality_selection" translatable="false">畫質選擇</string>
|
<string name="image_quality_selection" translatable="false">畫質選擇</string>
|
||||||
<string name="more_settings" translatable="false">更多設置</string>
|
<string name="more_settings" translatable="false">更多設置</string>
|
||||||
|
<string name="moer">查看更多</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user