直播间贡献榜添加隐身
This commit is contained in:
parent
0cafd76035
commit
fc0c734261
@ -56,6 +56,17 @@ public class UserBean implements Parcelable {
|
||||
private String mobile;
|
||||
private String front_task;
|
||||
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() {
|
||||
return is_admin;
|
||||
|
@ -3,10 +3,7 @@ package com.yunbao.live.adapter;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@ -16,6 +13,10 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
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.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
@ -24,45 +25,36 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.LiveUserRankBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserRankBean;
|
||||
import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
|
||||
// private static final int HEAD = 1;
|
||||
// private static final int NORMAL = 0;
|
||||
private String mVotesName;
|
||||
public int num;
|
||||
public String type;
|
||||
private Drawable mGuardDrawable0;
|
||||
private Drawable mGuardDrawable1;
|
||||
private Drawable mGuardDrawable2;
|
||||
// private View.OnClickListener mOnClickListener;
|
||||
private LiveUserMoreDialogFragment fragments;
|
||||
private List<String> outRankHide = new ArrayList<>();
|
||||
|
||||
public UserMoreInfoAdapter(Context context, LiveUserMoreDialogFragment fragment) {
|
||||
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;
|
||||
mVotesName = CommonAppConfig.getInstance().getVotesName();
|
||||
mGuardDrawable0 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_0);
|
||||
@ -73,12 +65,9 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// if (position == 0) {
|
||||
// return HEAD;
|
||||
// }
|
||||
// return NORMAL;
|
||||
return position;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
@ -88,7 +77,6 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
// vh.setIsRecyclable(false);
|
||||
//type 3、4为日榜和周榜模式,数据与观众有差距,分开处理
|
||||
if (Integer.parseInt(type) > 3) {
|
||||
((Vh) vh).setRankModel(true);
|
||||
@ -118,6 +106,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
ImageView ivIcon;
|
||||
ImageView rankImage;
|
||||
TextView rankText;
|
||||
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
title1 = (TextView) itemView.findViewById(R.id.title1);
|
||||
@ -141,9 +130,14 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
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());
|
||||
fragments.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
|
||||
@ -215,6 +209,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
ivIcon.setImageDrawable(drawable);
|
||||
tvName.setText(bean.getMedal_name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed() {
|
||||
}
|
||||
@ -226,9 +221,15 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
tvName.setTextColor(Color.parseColor("#9E9E9E"));
|
||||
tvName.setTextSize(12);
|
||||
switch (position) {
|
||||
case 0:rankImage.setImageResource(R.mipmap.day_list_no_1);break;
|
||||
case 1:rankImage.setImageResource(R.mipmap.day_list_no_2);break;
|
||||
case 2:rankImage.setImageResource(R.mipmap.day_list_no_3);break;
|
||||
case 0:
|
||||
rankImage.setImageResource(R.mipmap.day_list_no_1);
|
||||
break;
|
||||
case 1:
|
||||
rankImage.setImageResource(R.mipmap.day_list_no_2);
|
||||
break;
|
||||
case 2:
|
||||
rankImage.setImageResource(R.mipmap.day_list_no_3);
|
||||
break;
|
||||
default:
|
||||
rankText.setText((position + 1) + "");
|
||||
rankText.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
@ -242,7 +243,13 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
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);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
}
|
||||
if (bean.getDress() != null && bean.getDress().getAvatar_frame() != null) {
|
||||
gift_svga.setVisibility(View.VISIBLE);
|
||||
if (bean.getDress().getAvatar_frame().contains("svga")) {
|
||||
@ -276,7 +283,6 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
} else {
|
||||
mNoble.setVisibility(View.GONE);
|
||||
}
|
||||
mName.setText(bean.getUserNiceName());
|
||||
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
if (levelBean != null) {
|
||||
@ -286,6 +292,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
|
||||
/**
|
||||
* 设置在榜单模式下,头像的位置
|
||||
*
|
||||
* @param 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);
|
||||
}
|
||||
}
|
||||
|
@ -23,12 +23,14 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.LiveUserRankBean;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.bean.UserRankModel;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
@ -66,6 +68,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
private String type = "guanzhong";
|
||||
private boolean isOnly;
|
||||
ImageView no_more;
|
||||
private List<String> outRankHide = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -105,25 +108,6 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
if (bundle == null) {
|
||||
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);
|
||||
stream = bundle.getString(Constants.STREAM);
|
||||
isOnly = bundle.getBoolean("only", false);
|
||||
@ -152,7 +136,6 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
} else if (Tips.equals("3")) {
|
||||
dismiss();
|
||||
((LiveActivity) mContext).openFansWindow();
|
||||
// LiveRoomViewHolder.showFansMedalDialog(mLiveUid);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -268,13 +251,12 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
@Override
|
||||
public void onLoadMoreSuccess(List<UserBean> loadItemList, int loadItemCount) {
|
||||
Log.i("tag333", "是" + nums);
|
||||
// userMoreInfoAdapter.num = nums;
|
||||
// userMoreInfoAdapter.insertList(loadItemList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreFailure() {
|
||||
}
|
||||
|
||||
private List<LiveUserGiftBean> processUserData(JSONObject json) {
|
||||
List<LiveUserGiftBean> data = JSON.parseArray(json.getString("userlist"), LiveUserGiftBean.class);
|
||||
if (data == null) {
|
||||
@ -299,6 +281,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<LiveUserRankBean> processRankData(JSONObject json) {
|
||||
JSONArray rank = Integer.parseInt(Tips) == 4 ? json.getJSONArray("listDay") : json.getJSONArray("listWeek");
|
||||
List<LiveUserRankBean> data = new ArrayList<>();
|
||||
@ -329,6 +312,23 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
tabs.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
|
||||
@ -345,6 +345,9 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
|
||||
void Up() {
|
||||
userMoreInfoAdapter.clearData();
|
||||
if (userMoreInfoAdapter != null) {
|
||||
userMoreInfoAdapter.setHide(outRankHide);
|
||||
}
|
||||
bottom_msg.setVisibility(View.VISIBLE);
|
||||
mRefreshView.setVisibility(View.VISIBLE);
|
||||
title.setVisibility(View.GONE);
|
||||
@ -403,6 +406,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
|
||||
/**
|
||||
* 设置文本按钮颜色
|
||||
*
|
||||
* @param light 高亮的文本
|
||||
* @param dark 暗淡的文本
|
||||
*/
|
||||
@ -412,6 +416,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
textView.setTextColor(Color.parseColor("#ff646464"));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isRank() {
|
||||
return Integer.parseInt(Tips) > 3;
|
||||
}
|
||||
|
BIN
live/src/main/res/mipmap-xxxhdpi/hide.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/hide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
Loading…
Reference in New Issue
Block a user