6.7.0用户端更新:更改数据类型
This commit is contained in:
parent
d66f098692
commit
cd8b58a0ec
@ -0,0 +1,77 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseAdapter<T> extends RecyclerView.Adapter<BaseAdapter.BaseViewHolder> {
|
||||
private Context context;
|
||||
public List<T> data;
|
||||
|
||||
public BaseAdapter(Context context, List<T> data) {
|
||||
this.context = context;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(getItemLayoutId(), parent, false);
|
||||
return new BaseViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(BaseAdapter.BaseViewHolder holder, int position) {
|
||||
T t = data.get(position);
|
||||
bindData(holder, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return data == null ? 0 : data.size();
|
||||
}
|
||||
|
||||
public abstract void bindData(BaseViewHolder holder, T t);
|
||||
|
||||
public abstract int getItemLayoutId();
|
||||
|
||||
class BaseViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private HashMap<Integer,View> views;
|
||||
|
||||
public BaseViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
views = new HashMap<>();
|
||||
}
|
||||
|
||||
public View getView(int id) {
|
||||
View view = views.get(id);
|
||||
if (view == null) {
|
||||
view = itemView.findViewById(id);
|
||||
views.put(id, view);
|
||||
if (onItemClickListener != null){
|
||||
view.setOnClickListener(v -> {
|
||||
onItemClickListener.onItemClick(getAdapterPosition());
|
||||
onItemClickListener.onItemChildClick(v, getAdapterPosition());
|
||||
});
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
private void setOnItemClickListener(OnItemClickListener onItemClickListener){
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
public interface OnItemClickListener{
|
||||
default void onItemClick(int position){}
|
||||
|
||||
default void onItemChildClick(View view,int position){}
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ public class PrankProgressBean extends BaseModel {
|
||||
private int prank_turntable_status;// 转盘整蛊状态 0=关闭 1=开启
|
||||
private int prank_type;// 整蛊类型 1.礼物整蛊 2.连击整蛊
|
||||
private List<PrankList> prank_list;// 整蛊进度
|
||||
private JsonElement completed_list;// 待完成的整蛊
|
||||
private List<PrankList> completed_list;// 待完成的整蛊
|
||||
|
||||
public PrankProgressBean(){
|
||||
}
|
||||
@ -147,11 +147,11 @@ public class PrankProgressBean extends BaseModel {
|
||||
this.prank_list = prank_list;
|
||||
}
|
||||
|
||||
public JsonElement getCompleted_list() {
|
||||
public List<PrankList> getCompleted_list() {
|
||||
return completed_list;
|
||||
}
|
||||
|
||||
public void setCompleted_list(JsonElement completed_list) {
|
||||
public void setCompleted_list(List<PrankList> completed_list) {
|
||||
this.completed_list = completed_list;
|
||||
}
|
||||
|
||||
|
@ -197,6 +197,7 @@ import com.yunbao.live.presenter.LiveLightAnimPresenter;
|
||||
import com.yunbao.live.utils.LiveRoomVoteManager;
|
||||
import com.yunbao.live.utils.LiveTextRender;
|
||||
import com.yunbao.live.utils.LoadDian9TuUtil;
|
||||
import com.yunbao.live.utils.ZeusKt;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -1770,6 +1771,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
if (Integer.parseInt(ctString.getString("prank_turntable_status")) == 0){
|
||||
prank_group_turntable_icon.setVisibility(View.GONE);
|
||||
}else {
|
||||
ZeusKt.visible(prank_group_turntable_icon);
|
||||
}
|
||||
}else {
|
||||
//送整蛊礼物更新
|
||||
|
Loading…
Reference in New Issue
Block a user