直播间贡献榜添加隐身
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;
|
||||
public UserMoreInfoAdapter(Context context,LiveUserMoreDialogFragment fragment) {
|
||||
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,14 +77,13 @@ 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);
|
||||
}else{
|
||||
((Vh)vh).setRankModel(false);
|
||||
}
|
||||
((Vh) vh).setData(mList.get(position), position);
|
||||
//type 3、4为日榜和周榜模式,数据与观众有差距,分开处理
|
||||
if (Integer.parseInt(type) > 3) {
|
||||
((Vh) vh).setRankModel(true);
|
||||
} else {
|
||||
((Vh) vh).setRankModel(false);
|
||||
}
|
||||
((Vh) vh).setData(mList.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,10 +93,10 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
TextView title,title1;
|
||||
TextView title, title1;
|
||||
ImageView mIcon;
|
||||
ImageView mAvatar;
|
||||
TextView mName,tvName;
|
||||
TextView mName, tvName;
|
||||
ImageView mNoble;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
@ -118,43 +106,49 @@ 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);
|
||||
title = (TextView)itemView.findViewById(R.id.title);
|
||||
title1 = (TextView) itemView.findViewById(R.id.title1);
|
||||
title = (TextView) itemView.findViewById(R.id.title);
|
||||
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);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
gift_svga = (SVGAImageView)itemView.findViewById(R.id.gift_svga);
|
||||
mUserIcon = (RelativeLayout)itemView.findViewById(R.id.userIcon);
|
||||
mRanksIcon = (LinearLayout)itemView.findViewById(R.id.ranks);
|
||||
rankImage=new ImageView(mContext);
|
||||
rankText=new TextView(mContext);
|
||||
gift_svga = (SVGAImageView) itemView.findViewById(R.id.gift_svga);
|
||||
mUserIcon = (RelativeLayout) itemView.findViewById(R.id.userIcon);
|
||||
mRanksIcon = (LinearLayout) itemView.findViewById(R.id.ranks);
|
||||
rankImage = new ImageView(mContext);
|
||||
rankText = new TextView(mContext);
|
||||
}
|
||||
|
||||
void setData(final UserBean bean,int position) {
|
||||
void setData(final UserBean bean, int position) {
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((LiveActivity) mContext).showUserDialog(bean.getId());
|
||||
fragments.dismiss();
|
||||
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());
|
||||
|
||||
title.setVisibility(View.GONE);
|
||||
title1.setVisibility(View.GONE);
|
||||
Log.i("tag",""+num);
|
||||
if(position==0&&type.equals("1")){
|
||||
Log.i("tag", "" + num);
|
||||
if (position == 0 && type.equals("1")) {
|
||||
title1.setText(R.string.noble);
|
||||
title1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if(position== num&&type.equals("1")){
|
||||
if (position == num && type.equals("1")) {
|
||||
title.setText(R.string.live_audience);
|
||||
title.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@ -165,11 +159,11 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
tvName.setVisibility(View.GONE);
|
||||
tvName.setTextSize(12);
|
||||
tvName.setTextColor(mContext.getResources().getColor(R.color.white));
|
||||
if(type.equals("1")) {
|
||||
if (type.equals("1")) {
|
||||
if (!bean.getDress().getMedal().equals("")) {
|
||||
ImgLoader.display(mContext, bean.getDress().getMedal(), mIcon);
|
||||
} else {
|
||||
int guardType = ((LiveUserGiftBean)bean).getGuardType();
|
||||
int guardType = ((LiveUserGiftBean) bean).getGuardType();
|
||||
if (guardType == Constants.GUARD_TYPE_NONE) {
|
||||
if (mIcon.getVisibility() != View.VISIBLE) {
|
||||
mIcon.setVisibility(View.INVISIBLE);
|
||||
@ -187,8 +181,8 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(type.equals("2")){
|
||||
int guardType = ((LiveUserGiftBean)bean).getGuardType();
|
||||
} else if (type.equals("2")) {
|
||||
int guardType = ((LiveUserGiftBean) bean).getGuardType();
|
||||
if (guardType == Constants.GUARD_TYPE_NONE) {
|
||||
if (mIcon.getVisibility() != View.VISIBLE) {
|
||||
mIcon.setVisibility(View.INVISIBLE);
|
||||
@ -205,7 +199,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
mIcon.setImageDrawable(mGuardDrawable2);
|
||||
}
|
||||
}
|
||||
}else if(type.equals("3")){
|
||||
} else if (type.equals("3")) {
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
tvName.setVisibility(View.VISIBLE);
|
||||
|
||||
@ -213,39 +207,52 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
ivIcon.setImageDrawable(drawable);
|
||||
tvName.setText( bean.getMedal_name());
|
||||
tvName.setText(bean.getMedal_name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed() {
|
||||
}
|
||||
});
|
||||
|
||||
}else if(type.equals("4")||type.equals("5")){//日、周榜
|
||||
} else if (type.equals("4") || type.equals("5")) {//日、周榜
|
||||
tvName.setVisibility(View.VISIBLE);
|
||||
tvName.setText(((LiveUserRankBean)bean).getTotal()+"");
|
||||
tvName.setText(((LiveUserRankBean) bean).getTotal() + "");
|
||||
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;
|
||||
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;
|
||||
default:
|
||||
rankText.setText((position+1)+"");
|
||||
rankText.setText((position + 1) + "");
|
||||
rankText.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
rankText.setTextSize(20);
|
||||
rankText.setGravity(Gravity.CENTER);
|
||||
}
|
||||
mRanksIcon.removeAllViews();
|
||||
if (position>2){
|
||||
mRanksIcon.addView(rankText,0);
|
||||
}else{
|
||||
mRanksIcon.addView(rankImage,0);
|
||||
if (position > 2) {
|
||||
mRanksIcon.addView(rankText, 0);
|
||||
} else {
|
||||
mRanksIcon.addView(rankImage, 0);
|
||||
}
|
||||
}
|
||||
ImgLoader.display(mContext, bean.getAvatar(), mAvatar);
|
||||
if(bean.getDress()!=null&&bean.getDress().getAvatar_frame()!=null){
|
||||
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")) {
|
||||
if (bean.getDress().getAvatar_frame().contains("svga")) {
|
||||
try {
|
||||
new SVGAParser(mContext).parse(new URL(bean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
@ -262,21 +269,20 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
ImgLoader.display(mContext,bean.getDress().getAvatar_frame(), gift_svga);
|
||||
} else {
|
||||
ImgLoader.display(mContext, bean.getDress().getAvatar_frame(), gift_svga);
|
||||
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
gift_svga.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);
|
||||
}else{
|
||||
} else {
|
||||
mNoble.setVisibility(View.GONE);
|
||||
}
|
||||
mName.setText(bean.getUserNiceName());
|
||||
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
if (levelBean != null) {
|
||||
@ -286,20 +292,44 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
|
||||
/**
|
||||
* 设置在榜单模式下,头像的位置
|
||||
*
|
||||
* @param isRank 是否为榜单模式
|
||||
*/
|
||||
private void setRankModel(boolean isRank){
|
||||
private void setRankModel(boolean isRank) {
|
||||
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mUserIcon.getLayoutParams();
|
||||
if(isRank){
|
||||
if (isRank) {
|
||||
mRanksIcon.setVisibility(View.VISIBLE);
|
||||
params.leftMargin= DpUtil.dp2px(16);
|
||||
}else{
|
||||
params.leftMargin = DpUtil.dp2px(16);
|
||||
} else {
|
||||
mRanksIcon.setVisibility(View.GONE);
|
||||
params.leftMargin= DpUtil.dp2px(27);
|
||||
params.leftMargin = DpUtil.dp2px(27);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -57,7 +59,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
public static LiveActivity activity = null;
|
||||
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 ConstraintLayout noMoreLayout;
|
||||
private TextView noMoreText;
|
||||
@ -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,28 +108,9 @@ 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);
|
||||
isOnly = bundle.getBoolean("only", false);
|
||||
title = mRootView.findViewById(R.id.title);
|
||||
tabs = mRootView.findViewById(R.id.tabs);
|
||||
audience_btn = mRootView.findViewById(R.id.audience_btn);
|
||||
@ -152,7 +136,6 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
} else if (Tips.equals("3")) {
|
||||
dismiss();
|
||||
((LiveActivity) mContext).openFansWindow();
|
||||
// LiveRoomViewHolder.showFansMedalDialog(mLiveUid);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -189,17 +172,17 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
no_more.setImageResource(R.mipmap.bixin);
|
||||
}
|
||||
});
|
||||
dayRank.setOnClickListener(View->{
|
||||
Tips="4";
|
||||
dayRank.setOnClickListener(View -> {
|
||||
Tips = "4";
|
||||
Up();
|
||||
type="dayRank";
|
||||
type = "dayRank";
|
||||
mRefreshView.initData();
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
});
|
||||
weekRank.setOnClickListener(View->{
|
||||
Tips="5";
|
||||
weekRank.setOnClickListener(View -> {
|
||||
Tips = "5";
|
||||
Up();
|
||||
type="weekRank";
|
||||
type = "weekRank";
|
||||
mRefreshView.initData();
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
});
|
||||
@ -219,7 +202,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
@Override
|
||||
public void loadData(int p, HttpCallback callback) {
|
||||
Log.i("tag111", p + "ssss");
|
||||
if(isRank()){
|
||||
if (isRank()) {
|
||||
/**
|
||||
* 榜单接口的uid为直播间ID,并不是也不需要用户uid
|
||||
*/
|
||||
@ -229,12 +212,12 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
.subscribe(listResponseModel -> {
|
||||
UserRankModel data = listResponseModel.getData().getData();
|
||||
//获取到参数后手动调用成功方法
|
||||
callback.onSuccess(0,"",new String[]{JSONObject.toJSONString(data)});
|
||||
callback.onSuccess(0, "", new String[]{JSONObject.toJSONString(data)});
|
||||
}, throwable -> {
|
||||
throwable.printStackTrace();
|
||||
callback.onError();
|
||||
}).isDisposed();
|
||||
}else {
|
||||
} else {
|
||||
LiveHttpUtil.getUserList(mLiveUid, stream, type, p, callback);
|
||||
pg = p;
|
||||
if (p == 1) {
|
||||
@ -246,11 +229,11 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
}
|
||||
|
||||
@Override
|
||||
public List processData(String[] info) {
|
||||
public List processData(String[] info) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if(isRank()){
|
||||
if (isRank()) {
|
||||
return processRankData(obj);
|
||||
}else {
|
||||
} else {
|
||||
return processUserData(obj);
|
||||
}
|
||||
}
|
||||
@ -268,16 +251,15 @@ 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){
|
||||
|
||||
private List<LiveUserGiftBean> processUserData(JSONObject json) {
|
||||
List<LiveUserGiftBean> data = JSON.parseArray(json.getString("userlist"), LiveUserGiftBean.class);
|
||||
if(data==null){
|
||||
if (data == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Log.i("tag222", "ssss");
|
||||
@ -299,25 +281,26 @@ 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<>();
|
||||
|
||||
private List<LiveUserRankBean> processRankData(JSONObject json) {
|
||||
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;
|
||||
}
|
||||
for (Object o : rank) {
|
||||
JSONObject item= (JSONObject) o;
|
||||
LiveUserRankBean bean=JSON.parseObject(item.getString("userinfo"),LiveUserRankBean.class);
|
||||
JSONObject item = (JSONObject) o;
|
||||
LiveUserRankBean bean = JSON.parseObject(item.getString("userinfo"), LiveUserRankBean.class);
|
||||
bean.setTotal(item.getLong("total"));
|
||||
data.add(bean);
|
||||
}
|
||||
if(data.size()==0){
|
||||
if (data.size() == 0) {
|
||||
noMoreLayout.setVisibility(View.VISIBLE);
|
||||
mRefreshView.setVisibility(View.GONE);
|
||||
}else{
|
||||
} else {
|
||||
noMoreLayout.setVisibility(View.GONE);
|
||||
}
|
||||
mRefreshView.setNotLoadMore();
|
||||
@ -325,10 +308,27 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
}
|
||||
});
|
||||
mRefreshView.initData();
|
||||
if(isOnly){
|
||||
if (isOnly) {
|
||||
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,17 +345,20 @@ 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);
|
||||
noMoreText.setVisibility(View.GONE);
|
||||
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mRefreshView.getLayoutParams();
|
||||
params.bottomMargin=DpUtil.dp2px(65);
|
||||
params.bottomMargin = DpUtil.dp2px(65);
|
||||
if (Tips.equals("1")) {
|
||||
tags.setText("開通貴族,尊享超多特權!");
|
||||
btn.setBackgroundResource(R.mipmap.btn_openvip);
|
||||
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);
|
||||
userMoreInfoAdapter.type = "1";
|
||||
type = "guanzhong";
|
||||
@ -363,7 +366,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
tags.setText("快為您喜歡的主播開通守護吧");
|
||||
btn.setBackgroundResource(R.mipmap.btn_openprotection);
|
||||
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);
|
||||
userMoreInfoAdapter.type = "2";
|
||||
no_more.setImageResource(R.mipmap.grayicon);
|
||||
@ -372,30 +375,30 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
tags.setText("快加入您喜歡的主播粉絲團吧");
|
||||
btn.setText("加入粉絲團");
|
||||
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);
|
||||
userMoreInfoAdapter.type = "3";
|
||||
type = "fans";
|
||||
no_more.setImageResource(R.mipmap.bixin);
|
||||
}else if(Tips.equals("4")){
|
||||
params.bottomMargin=DpUtil.dp2px(0);
|
||||
} else if (Tips.equals("4")) {
|
||||
params.bottomMargin = DpUtil.dp2px(0);
|
||||
userMoreInfoAdapter.type = "4";
|
||||
bottom_msg.setVisibility(View.GONE);
|
||||
type="dayRank";
|
||||
setTextColor(dayRank,audience_btn,guard_btn,fans_btn,gz_view,weekRank);
|
||||
type = "dayRank";
|
||||
setTextColor(dayRank, audience_btn, guard_btn, fans_btn, gz_view, weekRank);
|
||||
gz_view.setVisibility(View.GONE);
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
noMoreText.setText(R.string.no_more_day_rank);
|
||||
noMoreText.setVisibility(View.VISIBLE);
|
||||
}else if (Tips.equals("5")){
|
||||
params.bottomMargin=DpUtil.dp2px(0);
|
||||
} else if (Tips.equals("5")) {
|
||||
params.bottomMargin = DpUtil.dp2px(0);
|
||||
userMoreInfoAdapter.type = "5";
|
||||
bottom_msg.setVisibility(View.GONE);
|
||||
type="weekRank";
|
||||
type = "weekRank";
|
||||
gz_view.setVisibility(View.GONE);
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
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);
|
||||
}
|
||||
mRefreshView.setLayoutParams(params);
|
||||
@ -403,16 +406,18 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
|
||||
/**
|
||||
* 设置文本按钮颜色
|
||||
*
|
||||
* @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"));
|
||||
for (TextView textView : dark) {
|
||||
textView.setTextColor(Color.parseColor("#ff646464"));
|
||||
}
|
||||
}
|
||||
private boolean isRank(){
|
||||
return Integer.parseInt(Tips)>3;
|
||||
|
||||
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