直播间贡献榜添加隐身

This commit is contained in:
18401019693 2022-09-16 18:03:33 +08:00
parent 0cafd76035
commit fc0c734261
4 changed files with 189 additions and 143 deletions

View File

@ -56,6 +56,17 @@ public class UserBean implements Parcelable {
private String mobile; private String mobile;
private String front_task; private String front_task;
private String is_admin; private String is_admin;
//是否隐藏
private boolean isHide = false;
public boolean isHide() {
return isHide;
}
public UserBean setHide(boolean hide) {
isHide = hide;
return this;
}
public String getIs_admin() { public String getIs_admin() {
return is_admin; return is_admin;

View File

@ -3,10 +3,7 @@ package com.yunbao.live.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull; import android.text.TextUtils;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
@ -16,6 +13,10 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAParser;
@ -24,45 +25,36 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LiveUserRankBean;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.bean.LiveUserGiftBean;
import com.yunbao.common.bean.LiveUserRankBean;
import com.yunbao.live.dialog.LiveUserMoreDialogFragment; import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.List;
public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> { public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
// private static final int HEAD = 1;
// private static final int NORMAL = 0;
private String mVotesName; private String mVotesName;
public int num; public int num;
public String type; public String type;
private Drawable mGuardDrawable0; private Drawable mGuardDrawable0;
private Drawable mGuardDrawable1; private Drawable mGuardDrawable1;
private Drawable mGuardDrawable2; private Drawable mGuardDrawable2;
// private View.OnClickListener mOnClickListener;
private LiveUserMoreDialogFragment fragments; private LiveUserMoreDialogFragment fragments;
public UserMoreInfoAdapter(Context context,LiveUserMoreDialogFragment fragment) { private List<String> outRankHide = new ArrayList<>();
public UserMoreInfoAdapter(Context context, LiveUserMoreDialogFragment fragment) {
super(context); super(context);
// mOnClickListener = new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Object tag = v.getTag();
// if (tag != null) {
// int position = (int) tag;
// if (mOnItemClickListener != null) {
// mOnItemClickListener.onItemClick(mList.get(position), position);
// }
// }
// }
// };
this.fragments = fragment; this.fragments = fragment;
mVotesName = CommonAppConfig.getInstance().getVotesName(); mVotesName = CommonAppConfig.getInstance().getVotesName();
mGuardDrawable0 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_0); mGuardDrawable0 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_0);
@ -73,12 +65,9 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
// if (position == 0) {
// return HEAD;
// }
// return NORMAL;
return position; return position;
} }
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -88,14 +77,13 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
// vh.setIsRecyclable(false); //type 34为日榜和周榜模式数据与观众有差距分开处理
//type 34为日榜和周榜模式数据与观众有差距分开处理 if (Integer.parseInt(type) > 3) {
if(Integer.parseInt(type)>3){ ((Vh) vh).setRankModel(true);
((Vh)vh).setRankModel(true); } else {
}else{ ((Vh) vh).setRankModel(false);
((Vh)vh).setRankModel(false); }
} ((Vh) vh).setData(mList.get(position), position);
((Vh) vh).setData(mList.get(position), position);
} }
@Override @Override
@ -105,10 +93,10 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
class Vh extends RecyclerView.ViewHolder { class Vh extends RecyclerView.ViewHolder {
TextView title,title1; TextView title, title1;
ImageView mIcon; ImageView mIcon;
ImageView mAvatar; ImageView mAvatar;
TextView mName,tvName; TextView mName, tvName;
ImageView mNoble; ImageView mNoble;
ImageView mSex; ImageView mSex;
ImageView mLevel; ImageView mLevel;
@ -118,43 +106,49 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
ImageView ivIcon; ImageView ivIcon;
ImageView rankImage; ImageView rankImage;
TextView rankText; TextView rankText;
public Vh(@NonNull View itemView) { public Vh(@NonNull View itemView) {
super(itemView); super(itemView);
title1 = (TextView)itemView.findViewById(R.id.title1); title1 = (TextView) itemView.findViewById(R.id.title1);
title = (TextView)itemView.findViewById(R.id.title); title = (TextView) itemView.findViewById(R.id.title);
mNoble = (ImageView) itemView.findViewById(R.id.noble); mNoble = (ImageView) itemView.findViewById(R.id.noble);
tvName = (TextView)itemView.findViewById(R.id.tvName); tvName = (TextView) itemView.findViewById(R.id.tvName);
ivIcon = (ImageView) itemView.findViewById(R.id.ivIcon); ivIcon = (ImageView) itemView.findViewById(R.id.ivIcon);
mIcon = (ImageView) itemView.findViewById(R.id.icon); mIcon = (ImageView) itemView.findViewById(R.id.icon);
mAvatar = (ImageView) itemView.findViewById(R.id.avatar); mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
mName = (TextView) itemView.findViewById(R.id.name); mName = (TextView) itemView.findViewById(R.id.name);
mSex = (ImageView) itemView.findViewById(R.id.sex); mSex = (ImageView) itemView.findViewById(R.id.sex);
mLevel = (ImageView) itemView.findViewById(R.id.level); mLevel = (ImageView) itemView.findViewById(R.id.level);
gift_svga = (SVGAImageView)itemView.findViewById(R.id.gift_svga); gift_svga = (SVGAImageView) itemView.findViewById(R.id.gift_svga);
mUserIcon = (RelativeLayout)itemView.findViewById(R.id.userIcon); mUserIcon = (RelativeLayout) itemView.findViewById(R.id.userIcon);
mRanksIcon = (LinearLayout)itemView.findViewById(R.id.ranks); mRanksIcon = (LinearLayout) itemView.findViewById(R.id.ranks);
rankImage=new ImageView(mContext); rankImage = new ImageView(mContext);
rankText=new TextView(mContext); rankText = new TextView(mContext);
} }
void setData(final UserBean bean,int position) { void setData(final UserBean bean, int position) {
itemView.setOnClickListener(new View.OnClickListener() { itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
((LiveActivity) mContext).showUserDialog(bean.getId()); if (bean.isHide() && (type.equals("5") || type.equals("4"))) {
fragments.dismiss(); ToastUtil.show(R.string.can_not_go);
} else {
((LiveActivity) mContext).showUserDialog(bean.getId());
fragments.dismiss();
}
} }
}); });
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
title.setVisibility(View.GONE); title.setVisibility(View.GONE);
title1.setVisibility(View.GONE); title1.setVisibility(View.GONE);
Log.i("tag",""+num); Log.i("tag", "" + num);
if(position==0&&type.equals("1")){ if (position == 0 && type.equals("1")) {
title1.setText(R.string.noble); title1.setText(R.string.noble);
title1.setVisibility(View.VISIBLE); title1.setVisibility(View.VISIBLE);
} }
if(position== num&&type.equals("1")){ if (position == num && type.equals("1")) {
title.setText(R.string.live_audience); title.setText(R.string.live_audience);
title.setVisibility(View.VISIBLE); title.setVisibility(View.VISIBLE);
} }
@ -165,11 +159,11 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
tvName.setVisibility(View.GONE); tvName.setVisibility(View.GONE);
tvName.setTextSize(12); tvName.setTextSize(12);
tvName.setTextColor(mContext.getResources().getColor(R.color.white)); tvName.setTextColor(mContext.getResources().getColor(R.color.white));
if(type.equals("1")) { if (type.equals("1")) {
if (!bean.getDress().getMedal().equals("")) { if (!bean.getDress().getMedal().equals("")) {
ImgLoader.display(mContext, bean.getDress().getMedal(), mIcon); ImgLoader.display(mContext, bean.getDress().getMedal(), mIcon);
} else { } else {
int guardType = ((LiveUserGiftBean)bean).getGuardType(); int guardType = ((LiveUserGiftBean) bean).getGuardType();
if (guardType == Constants.GUARD_TYPE_NONE) { if (guardType == Constants.GUARD_TYPE_NONE) {
if (mIcon.getVisibility() != View.VISIBLE) { if (mIcon.getVisibility() != View.VISIBLE) {
mIcon.setVisibility(View.INVISIBLE); mIcon.setVisibility(View.INVISIBLE);
@ -187,8 +181,8 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
} }
} }
} }
}else if(type.equals("2")){ } else if (type.equals("2")) {
int guardType = ((LiveUserGiftBean)bean).getGuardType(); int guardType = ((LiveUserGiftBean) bean).getGuardType();
if (guardType == Constants.GUARD_TYPE_NONE) { if (guardType == Constants.GUARD_TYPE_NONE) {
if (mIcon.getVisibility() != View.VISIBLE) { if (mIcon.getVisibility() != View.VISIBLE) {
mIcon.setVisibility(View.INVISIBLE); mIcon.setVisibility(View.INVISIBLE);
@ -205,7 +199,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
mIcon.setImageDrawable(mGuardDrawable2); mIcon.setImageDrawable(mGuardDrawable2);
} }
} }
}else if(type.equals("3")){ } else if (type.equals("3")) {
ivIcon.setVisibility(View.VISIBLE); ivIcon.setVisibility(View.VISIBLE);
tvName.setVisibility(View.VISIBLE); tvName.setVisibility(View.VISIBLE);
@ -213,39 +207,52 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
@Override @Override
public void onLoadSuccess(Drawable drawable) { public void onLoadSuccess(Drawable drawable) {
ivIcon.setImageDrawable(drawable); ivIcon.setImageDrawable(drawable);
tvName.setText( bean.getMedal_name()); tvName.setText(bean.getMedal_name());
} }
@Override @Override
public void onLoadFailed() { public void onLoadFailed() {
} }
}); });
}else if(type.equals("4")||type.equals("5")){//周榜 } else if (type.equals("4") || type.equals("5")) {//周榜
tvName.setVisibility(View.VISIBLE); tvName.setVisibility(View.VISIBLE);
tvName.setText(((LiveUserRankBean)bean).getTotal()+""); tvName.setText(((LiveUserRankBean) bean).getTotal() + "");
tvName.setTextColor(Color.parseColor("#9E9E9E")); tvName.setTextColor(Color.parseColor("#9E9E9E"));
tvName.setTextSize(12); tvName.setTextSize(12);
switch (position){ switch (position) {
case 0:rankImage.setImageResource(R.mipmap.day_list_no_1);break; case 0:
case 1:rankImage.setImageResource(R.mipmap.day_list_no_2);break; rankImage.setImageResource(R.mipmap.day_list_no_1);
case 2:rankImage.setImageResource(R.mipmap.day_list_no_3);break; break;
case 1:
rankImage.setImageResource(R.mipmap.day_list_no_2);
break;
case 2:
rankImage.setImageResource(R.mipmap.day_list_no_3);
break;
default: default:
rankText.setText((position+1)+""); rankText.setText((position + 1) + "");
rankText.setTextColor(Color.parseColor("#FFFFFF")); rankText.setTextColor(Color.parseColor("#FFFFFF"));
rankText.setTextSize(20); rankText.setTextSize(20);
rankText.setGravity(Gravity.CENTER); rankText.setGravity(Gravity.CENTER);
} }
mRanksIcon.removeAllViews(); mRanksIcon.removeAllViews();
if (position>2){ if (position > 2) {
mRanksIcon.addView(rankText,0); mRanksIcon.addView(rankText, 0);
}else{ } else {
mRanksIcon.addView(rankImage,0); mRanksIcon.addView(rankImage, 0);
} }
} }
ImgLoader.display(mContext, bean.getAvatar(), mAvatar); if (bean.isHide() && (type.equals("5") || type.equals("4"))) {
if(bean.getDress()!=null&&bean.getDress().getAvatar_frame()!=null){ mName.setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, mAvatar);
} else {
ImgLoader.display(mContext, bean.getAvatar(), mAvatar);
mName.setText(bean.getUserNiceName());
}
if (bean.getDress() != null && bean.getDress().getAvatar_frame() != null) {
gift_svga.setVisibility(View.VISIBLE); gift_svga.setVisibility(View.VISIBLE);
if(bean.getDress().getAvatar_frame().contains("svga")) { if (bean.getDress().getAvatar_frame().contains("svga")) {
try { try {
new SVGAParser(mContext).parse(new URL(bean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() { new SVGAParser(mContext).parse(new URL(bean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
@Override @Override
@ -262,21 +269,20 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
} }
}else{ } else {
ImgLoader.display(mContext,bean.getDress().getAvatar_frame(), gift_svga); ImgLoader.display(mContext, bean.getDress().getAvatar_frame(), gift_svga);
} }
}else{ } else {
gift_svga.setVisibility(View.GONE); gift_svga.setVisibility(View.GONE);
} }
mNoble.setVisibility(View.GONE); mNoble.setVisibility(View.GONE);
if(bean.getDress()!=null&&bean.getDress().getMedal()!=null){ if (bean.getDress() != null && bean.getDress().getMedal() != null) {
ImgLoader.displayAvatar(mContext, bean.getDress().getMedal(), mNoble); ImgLoader.displayAvatar(mContext, bean.getDress().getMedal(), mNoble);
}else{ } else {
mNoble.setVisibility(View.GONE); mNoble.setVisibility(View.GONE);
} }
mName.setText(bean.getUserNiceName());
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
if (levelBean != null) { if (levelBean != null) {
@ -286,20 +292,44 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
/** /**
* 设置在榜单模式下头像的位置 * 设置在榜单模式下头像的位置
*
* @param isRank 是否为榜单模式 * @param isRank 是否为榜单模式
*/ */
private void setRankModel(boolean isRank){ private void setRankModel(boolean isRank) {
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mUserIcon.getLayoutParams(); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mUserIcon.getLayoutParams();
if(isRank){ if (isRank) {
mRanksIcon.setVisibility(View.VISIBLE); mRanksIcon.setVisibility(View.VISIBLE);
params.leftMargin= DpUtil.dp2px(16); params.leftMargin = DpUtil.dp2px(16);
}else{ } else {
mRanksIcon.setVisibility(View.GONE); mRanksIcon.setVisibility(View.GONE);
params.leftMargin= DpUtil.dp2px(27); params.leftMargin = DpUtil.dp2px(27);
} }
mUserIcon.setLayoutParams(params); mUserIcon.setLayoutParams(params);
} }
} }
/**
* 设置隐藏数据
*
* @param outRankHide
*/
public void setHide(List<String> outRankHide) {
this.outRankHide = outRankHide;
for (UserBean model : mList) {
for (String hideId : outRankHide) {
model.setHide(TextUtils.equals(model.getId(), hideId));
}
}
notifyDataSetChanged();
}
@Override
public void refreshData(List<UserBean> list) {
for (UserBean model : list) {
for (String hideId : outRankHide) {
model.setHide(TextUtils.equals(model.getId(), hideId));
}
}
super.refreshData(list);
}
} }

View File

@ -23,12 +23,14 @@ import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.LiveUserRankBean; import com.yunbao.common.bean.LiveUserRankBean;
import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.bean.UserRankModel; import com.yunbao.common.bean.UserRankModel;
import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.API; import com.yunbao.common.http.API;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
@ -57,7 +59,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
public static LiveActivity activity = null; public static LiveActivity activity = null;
public eightbitlab.com.blurview.BlurView blurView; public eightbitlab.com.blurview.BlurView blurView;
public TextView audience_btn, guard_btn, fans_btn, tags, btn, gz_view, dayRank, weekRank,title; public TextView audience_btn, guard_btn, fans_btn, tags, btn, gz_view, dayRank, weekRank, title;
private LinearLayout tabs; private LinearLayout tabs;
private ConstraintLayout noMoreLayout; private ConstraintLayout noMoreLayout;
private TextView noMoreText; private TextView noMoreText;
@ -66,6 +68,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
private String type = "guanzhong"; private String type = "guanzhong";
private boolean isOnly; private boolean isOnly;
ImageView no_more; ImageView no_more;
private List<String> outRankHide = new ArrayList<>();
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
@ -105,28 +108,9 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
if (bundle == null) { if (bundle == null) {
return; return;
} }
//毛玻璃
// final int radius = 16;
//
// blurView = mRootView.findViewById(R.id.blurView);
// View decorView = activity.getWindow().getDecorView();
// //ViewGroup you want to start blur from. Choose root as close to BlurView in hierarchy as possible.
// ViewGroup rootView = (ViewGroup) decorView.findViewById(android.R.id.content);
// //Set drawable to draw in the beginning of each blurred frame (Optional).
// //Can be used in case your layout has a lot of transparent space and your content
// //gets kinda lost after after blur is applied.
// Drawable windowBackground = decorView.getBackground();
//
// blurView.setupWith(rootView)
// .setFrameClearDrawable(windowBackground)
// .setBlurAlgorithm(new RenderScriptBlur(mContext))
// .setBlurRadius(radius)
// .setBlurAutoUpdate(true)
// .setHasFixedTransformationMatrix(true);
mLiveUid = bundle.getString(Constants.LIVE_UID); mLiveUid = bundle.getString(Constants.LIVE_UID);
stream = bundle.getString(Constants.STREAM); stream = bundle.getString(Constants.STREAM);
isOnly = bundle.getBoolean("only",false); isOnly = bundle.getBoolean("only", false);
title = mRootView.findViewById(R.id.title); title = mRootView.findViewById(R.id.title);
tabs = mRootView.findViewById(R.id.tabs); tabs = mRootView.findViewById(R.id.tabs);
audience_btn = mRootView.findViewById(R.id.audience_btn); audience_btn = mRootView.findViewById(R.id.audience_btn);
@ -152,7 +136,6 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
} else if (Tips.equals("3")) { } else if (Tips.equals("3")) {
dismiss(); dismiss();
((LiveActivity) mContext).openFansWindow(); ((LiveActivity) mContext).openFansWindow();
// LiveRoomViewHolder.showFansMedalDialog(mLiveUid);
} }
} }
}); });
@ -189,17 +172,17 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
no_more.setImageResource(R.mipmap.bixin); no_more.setImageResource(R.mipmap.bixin);
} }
}); });
dayRank.setOnClickListener(View->{ dayRank.setOnClickListener(View -> {
Tips="4"; Tips = "4";
Up(); Up();
type="dayRank"; type = "dayRank";
mRefreshView.initData(); mRefreshView.initData();
no_more.setImageResource(R.drawable.img_rank_empty); no_more.setImageResource(R.drawable.img_rank_empty);
}); });
weekRank.setOnClickListener(View->{ weekRank.setOnClickListener(View -> {
Tips="5"; Tips = "5";
Up(); Up();
type="weekRank"; type = "weekRank";
mRefreshView.initData(); mRefreshView.initData();
no_more.setImageResource(R.drawable.img_rank_empty); no_more.setImageResource(R.drawable.img_rank_empty);
}); });
@ -219,7 +202,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
@Override @Override
public void loadData(int p, HttpCallback callback) { public void loadData(int p, HttpCallback callback) {
Log.i("tag111", p + "ssss"); Log.i("tag111", p + "ssss");
if(isRank()){ if (isRank()) {
/** /**
* 榜单接口的uid为直播间ID并不是也不需要用户uid * 榜单接口的uid为直播间ID并不是也不需要用户uid
*/ */
@ -229,12 +212,12 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
.subscribe(listResponseModel -> { .subscribe(listResponseModel -> {
UserRankModel data = listResponseModel.getData().getData(); UserRankModel data = listResponseModel.getData().getData();
//获取到参数后手动调用成功方法 //获取到参数后手动调用成功方法
callback.onSuccess(0,"",new String[]{JSONObject.toJSONString(data)}); callback.onSuccess(0, "", new String[]{JSONObject.toJSONString(data)});
}, throwable -> { }, throwable -> {
throwable.printStackTrace(); throwable.printStackTrace();
callback.onError(); callback.onError();
}).isDisposed(); }).isDisposed();
}else { } else {
LiveHttpUtil.getUserList(mLiveUid, stream, type, p, callback); LiveHttpUtil.getUserList(mLiveUid, stream, type, p, callback);
pg = p; pg = p;
if (p == 1) { if (p == 1) {
@ -246,11 +229,11 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
} }
@Override @Override
public List processData(String[] info) { public List processData(String[] info) {
JSONObject obj = JSON.parseObject(info[0]); JSONObject obj = JSON.parseObject(info[0]);
if(isRank()){ if (isRank()) {
return processRankData(obj); return processRankData(obj);
}else { } else {
return processUserData(obj); return processUserData(obj);
} }
} }
@ -268,16 +251,15 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
@Override @Override
public void onLoadMoreSuccess(List<UserBean> loadItemList, int loadItemCount) { public void onLoadMoreSuccess(List<UserBean> loadItemList, int loadItemCount) {
Log.i("tag333", "" + nums); Log.i("tag333", "" + nums);
// userMoreInfoAdapter.num = nums;
// userMoreInfoAdapter.insertList(loadItemList);
} }
@Override @Override
public void onLoadMoreFailure() { public void onLoadMoreFailure() {
} }
private List<LiveUserGiftBean> processUserData(JSONObject json){
private List<LiveUserGiftBean> processUserData(JSONObject json) {
List<LiveUserGiftBean> data = JSON.parseArray(json.getString("userlist"), LiveUserGiftBean.class); List<LiveUserGiftBean> data = JSON.parseArray(json.getString("userlist"), LiveUserGiftBean.class);
if(data==null){ if (data == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
Log.i("tag222", "ssss"); Log.i("tag222", "ssss");
@ -299,25 +281,26 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
} }
return data; return data;
} }
private List<LiveUserRankBean> processRankData(JSONObject json){
JSONArray rank=Integer.parseInt(Tips)==4?json.getJSONArray("listDay"):json.getJSONArray("listWeek"); private List<LiveUserRankBean> processRankData(JSONObject json) {
List<LiveUserRankBean> data =new ArrayList<>(); JSONArray rank = Integer.parseInt(Tips) == 4 ? json.getJSONArray("listDay") : json.getJSONArray("listWeek");
List<LiveUserRankBean> data = new ArrayList<>();
/* /*
* 由于在线观众和粉丝列表实体结构与榜单结构不一致做个兼容操作 * 由于在线观众和粉丝列表实体结构与榜单结构不一致做个兼容操作
*/ */
if(rank==null){ if (rank == null) {
return data; return data;
} }
for (Object o : rank) { for (Object o : rank) {
JSONObject item= (JSONObject) o; JSONObject item = (JSONObject) o;
LiveUserRankBean bean=JSON.parseObject(item.getString("userinfo"),LiveUserRankBean.class); LiveUserRankBean bean = JSON.parseObject(item.getString("userinfo"), LiveUserRankBean.class);
bean.setTotal(item.getLong("total")); bean.setTotal(item.getLong("total"));
data.add(bean); data.add(bean);
} }
if(data.size()==0){ if (data.size() == 0) {
noMoreLayout.setVisibility(View.VISIBLE); noMoreLayout.setVisibility(View.VISIBLE);
mRefreshView.setVisibility(View.GONE); mRefreshView.setVisibility(View.GONE);
}else{ } else {
noMoreLayout.setVisibility(View.GONE); noMoreLayout.setVisibility(View.GONE);
} }
mRefreshView.setNotLoadMore(); mRefreshView.setNotLoadMore();
@ -325,10 +308,27 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
} }
}); });
mRefreshView.initData(); mRefreshView.initData();
if(isOnly){ if (isOnly) {
tabs.setVisibility(View.GONE); tabs.setVisibility(View.GONE);
title.setVisibility(View.GONE); title.setVisibility(View.GONE);
} }
//获取隐身的用户的ID
LiveNetManager.get(mContext)
.getNobleRankHideUserList(new com.yunbao.common.http.base.HttpCallback<NobleRankHideUserListModel>() {
@Override
public void onSuccess(NobleRankHideUserListModel data) {
outRankHide = data.getOutRankHide();
if (userMoreInfoAdapter != null) {
userMoreInfoAdapter.setHide(outRankHide);
}
}
@Override
public void onError(String error) {
Log.e("LiveUserMoreDialog", error);
}
});
} }
@Override @Override
@ -345,17 +345,20 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
void Up() { void Up() {
userMoreInfoAdapter.clearData(); userMoreInfoAdapter.clearData();
if (userMoreInfoAdapter != null) {
userMoreInfoAdapter.setHide(outRankHide);
}
bottom_msg.setVisibility(View.VISIBLE); bottom_msg.setVisibility(View.VISIBLE);
mRefreshView.setVisibility(View.VISIBLE); mRefreshView.setVisibility(View.VISIBLE);
title.setVisibility(View.GONE); title.setVisibility(View.GONE);
noMoreText.setVisibility(View.GONE); noMoreText.setVisibility(View.GONE);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mRefreshView.getLayoutParams(); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mRefreshView.getLayoutParams();
params.bottomMargin=DpUtil.dp2px(65); params.bottomMargin = DpUtil.dp2px(65);
if (Tips.equals("1")) { if (Tips.equals("1")) {
tags.setText("開通貴族,尊享超多特權!"); tags.setText("開通貴族,尊享超多特權!");
btn.setBackgroundResource(R.mipmap.btn_openvip); btn.setBackgroundResource(R.mipmap.btn_openvip);
btn.setText("開通貴族"); btn.setText("開通貴族");
setTextColor(audience_btn,guard_btn,fans_btn,weekRank,dayRank); setTextColor(audience_btn, guard_btn, fans_btn, weekRank, dayRank);
gz_view.setVisibility(View.GONE); gz_view.setVisibility(View.GONE);
userMoreInfoAdapter.type = "1"; userMoreInfoAdapter.type = "1";
type = "guanzhong"; type = "guanzhong";
@ -363,7 +366,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
tags.setText("快為您喜歡的主播開通守護吧"); tags.setText("快為您喜歡的主播開通守護吧");
btn.setBackgroundResource(R.mipmap.btn_openprotection); btn.setBackgroundResource(R.mipmap.btn_openprotection);
btn.setText("守護列表"); btn.setText("守護列表");
setTextColor(guard_btn,audience_btn,fans_btn,dayRank,weekRank); setTextColor(guard_btn, audience_btn, fans_btn, dayRank, weekRank);
gz_view.setVisibility(View.GONE); gz_view.setVisibility(View.GONE);
userMoreInfoAdapter.type = "2"; userMoreInfoAdapter.type = "2";
no_more.setImageResource(R.mipmap.grayicon); no_more.setImageResource(R.mipmap.grayicon);
@ -372,30 +375,30 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
tags.setText("快加入您喜歡的主播粉絲團吧"); tags.setText("快加入您喜歡的主播粉絲團吧");
btn.setText("加入粉絲團"); btn.setText("加入粉絲團");
btn.setBackgroundResource(R.mipmap.btn_joinfans); btn.setBackgroundResource(R.mipmap.btn_joinfans);
setTextColor(fans_btn,audience_btn,guard_btn,dayRank,weekRank); setTextColor(fans_btn, audience_btn, guard_btn, dayRank, weekRank);
gz_view.setVisibility(View.GONE); gz_view.setVisibility(View.GONE);
userMoreInfoAdapter.type = "3"; userMoreInfoAdapter.type = "3";
type = "fans"; type = "fans";
no_more.setImageResource(R.mipmap.bixin); no_more.setImageResource(R.mipmap.bixin);
}else if(Tips.equals("4")){ } else if (Tips.equals("4")) {
params.bottomMargin=DpUtil.dp2px(0); params.bottomMargin = DpUtil.dp2px(0);
userMoreInfoAdapter.type = "4"; userMoreInfoAdapter.type = "4";
bottom_msg.setVisibility(View.GONE); bottom_msg.setVisibility(View.GONE);
type="dayRank"; type = "dayRank";
setTextColor(dayRank,audience_btn,guard_btn,fans_btn,gz_view,weekRank); setTextColor(dayRank, audience_btn, guard_btn, fans_btn, gz_view, weekRank);
gz_view.setVisibility(View.GONE); gz_view.setVisibility(View.GONE);
no_more.setImageResource(R.drawable.img_rank_empty); no_more.setImageResource(R.drawable.img_rank_empty);
noMoreText.setText(R.string.no_more_day_rank); noMoreText.setText(R.string.no_more_day_rank);
noMoreText.setVisibility(View.VISIBLE); noMoreText.setVisibility(View.VISIBLE);
}else if (Tips.equals("5")){ } else if (Tips.equals("5")) {
params.bottomMargin=DpUtil.dp2px(0); params.bottomMargin = DpUtil.dp2px(0);
userMoreInfoAdapter.type = "5"; userMoreInfoAdapter.type = "5";
bottom_msg.setVisibility(View.GONE); bottom_msg.setVisibility(View.GONE);
type="weekRank"; type = "weekRank";
gz_view.setVisibility(View.GONE); gz_view.setVisibility(View.GONE);
no_more.setImageResource(R.drawable.img_rank_empty); no_more.setImageResource(R.drawable.img_rank_empty);
noMoreText.setText(R.string.no_more_day_rank); noMoreText.setText(R.string.no_more_day_rank);
setTextColor(weekRank,audience_btn,guard_btn,fans_btn,gz_view,dayRank); setTextColor(weekRank, audience_btn, guard_btn, fans_btn, gz_view, dayRank);
noMoreText.setVisibility(View.VISIBLE); noMoreText.setVisibility(View.VISIBLE);
} }
mRefreshView.setLayoutParams(params); mRefreshView.setLayoutParams(params);
@ -403,16 +406,18 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
/** /**
* 设置文本按钮颜色 * 设置文本按钮颜色
*
* @param light 高亮的文本 * @param light 高亮的文本
* @param dark 暗淡的文本 * @param dark 暗淡的文本
*/ */
private void setTextColor(TextView light,TextView... dark){ private void setTextColor(TextView light, TextView... dark) {
light.setTextColor(Color.parseColor("#fff6f7fb")); light.setTextColor(Color.parseColor("#fff6f7fb"));
for (TextView textView : dark) { for (TextView textView : dark) {
textView.setTextColor(Color.parseColor("#ff646464")); textView.setTextColor(Color.parseColor("#ff646464"));
} }
} }
private boolean isRank(){
return Integer.parseInt(Tips)>3; private boolean isRank() {
return Integer.parseInt(Tips) > 3;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB