直播间贡献榜添加隐身

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;
private List<String> outRankHide = new ArrayList<>();
public UserMoreInfoAdapter(Context context, LiveUserMoreDialogFragment fragment) { 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,7 +77,6 @@ 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);
@ -118,6 +106,7 @@ 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);
@ -141,9 +130,14 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
itemView.setOnClickListener(new View.OnClickListener() { itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (bean.isHide() && (type.equals("5") || type.equals("4"))) {
ToastUtil.show(R.string.can_not_go);
} else {
((LiveActivity) mContext).showUserDialog(bean.getId()); ((LiveActivity) mContext).showUserDialog(bean.getId());
fragments.dismiss(); fragments.dismiss();
} }
}
}); });
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
@ -215,6 +209,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
ivIcon.setImageDrawable(drawable); ivIcon.setImageDrawable(drawable);
tvName.setText(bean.getMedal_name()); tvName.setText(bean.getMedal_name());
} }
@Override @Override
public void onLoadFailed() { public void onLoadFailed() {
} }
@ -226,9 +221,15 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
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"));
@ -242,7 +243,13 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
mRanksIcon.addView(rankImage, 0); mRanksIcon.addView(rankImage, 0);
} }
} }
if (bean.isHide() && (type.equals("5") || type.equals("4"))) {
mName.setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, mAvatar);
} else {
ImgLoader.display(mContext, bean.getAvatar(), mAvatar); ImgLoader.display(mContext, bean.getAvatar(), mAvatar);
mName.setText(bean.getUserNiceName());
}
if (bean.getDress() != null && bean.getDress().getAvatar_frame() != null) { 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")) {
@ -276,7 +283,6 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
} 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,6 +292,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
/** /**
* 设置在榜单模式下头像的位置 * 设置在榜单模式下头像的位置
*
* @param isRank 是否为榜单模式 * @param isRank 是否为榜单模式
*/ */
private void setRankModel(boolean isRank) { private void setRankModel(boolean isRank) {
@ -301,5 +308,28 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
} }
} }
/**
* 设置隐藏数据
*
* @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;
@ -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,25 +108,6 @@ 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);
@ -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);
} }
} }
}); });
@ -268,13 +251,12 @@ 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) {
@ -299,6 +281,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
} }
return data; return data;
} }
private List<LiveUserRankBean> processRankData(JSONObject json) { private List<LiveUserRankBean> processRankData(JSONObject json) {
JSONArray rank = Integer.parseInt(Tips) == 4 ? json.getJSONArray("listDay") : json.getJSONArray("listWeek"); JSONArray rank = Integer.parseInt(Tips) == 4 ? json.getJSONArray("listDay") : json.getJSONArray("listWeek");
List<LiveUserRankBean> data = new ArrayList<>(); List<LiveUserRankBean> data = new ArrayList<>();
@ -329,6 +312,23 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
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,6 +345,9 @@ 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);
@ -403,6 +406,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
/** /**
* 设置文本按钮颜色 * 设置文本按钮颜色
*
* @param light 高亮的文本 * @param light 高亮的文本
* @param dark 暗淡的文本 * @param dark 暗淡的文本
*/ */
@ -412,6 +416,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
textView.setTextColor(Color.parseColor("#ff646464")); textView.setTextColor(Color.parseColor("#ff646464"));
} }
} }
private boolean isRank() { private boolean isRank() {
return Integer.parseInt(Tips) > 3; return Integer.parseInt(Tips) > 3;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB