侧边栏:权益
This commit is contained in:
parent
60453c756c
commit
f74a01efc0
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,12 @@ import java.util.List;
|
||||
|
||||
public class FunGamesAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private boolean rigts ;
|
||||
private List<CustomSidebarChildModel> 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<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
child.addAll(mChild);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -21,8 +21,14 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
|
||||
funGameName = itemView.findViewById(R.id.fun_game_name);
|
||||
}
|
||||
|
||||
public void setData(CustomSidebarChildModel model) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 {
|
||||
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<CustomSidebarChildModel> generateData() {
|
||||
List<CustomSidebarChildModel> 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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fun_game_pic"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:src="@mipmap/live_more_icon_guard" />
|
||||
|
||||
<TextView
|
||||
@ -20,6 +19,6 @@
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/guard_guard"
|
||||
android:textColor="#9A9A9A"
|
||||
android:textSize="12sp" />
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
@ -1,6 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
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">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/send_good_gift"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="任務中心"
|
||||
android:textColor="#F6F7FB"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</FrameLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/child_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginBottom="16dp" />
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user