首页贡献榜添加隐身

This commit is contained in:
18401019693 2022-09-16 17:04:45 +08:00
parent 5e581dd65e
commit bebf19215e
13 changed files with 198 additions and 55 deletions

View File

@ -0,0 +1,56 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.List;
/**
* 隐藏
*/
public class NobleRankHideUserListModel extends BaseModel {
@SerializedName("in_rank_hide")
private List<String> inRankHide = new ArrayList<>();
@SerializedName("out_rank_hide")//目前客户端只使用这个字段
private List<String> outRankHide = new ArrayList<>();
@SerializedName("week_rank_hide")
private List<String> weekRankHide = new ArrayList<>();
@SerializedName("active_rank_hide")
private List<String> activeRankHide = new ArrayList<>();
public List<String> getInRankHide() {
return inRankHide;
}
public NobleRankHideUserListModel setInRankHide(List<String> inRankHide) {
this.inRankHide = inRankHide;
return this;
}
public List<String> getOutRankHide() {
return outRankHide;
}
public NobleRankHideUserListModel setOutRankHide(List<String> outRankHide) {
this.outRankHide = outRankHide;
return this;
}
public List<String> getWeekRankHide() {
return weekRankHide;
}
public NobleRankHideUserListModel setWeekRankHide(List<String> weekRankHide) {
this.weekRankHide = weekRankHide;
return this;
}
public List<String> getActiveRankHide() {
return activeRankHide;
}
public NobleRankHideUserListModel setActiveRankHide(List<String> activeRankHide) {
this.activeRankHide = activeRankHide;
return this;
}
}

View File

@ -10,6 +10,7 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.MsgSwitchDetailModel;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.bean.NobleTrumpetModel;
import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.bean.SetAttentsModel;
@ -225,4 +226,10 @@ public interface PDLiveApi {
*/
@GET("/api/public/?service=User.getUserInstructor")
Observable<ResponseModel<List<VipModel>>> getUserInstructor();
/**
* 获取隐藏榜单的用户id
*/
@GET("/api/public/?service=Noble.getNobleRankHideUserList")
Observable<ResponseModel<NobleRankHideUserListModel>> getNobleRankHideUserList();
}

View File

@ -5,6 +5,7 @@ import android.content.Context;
import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.bean.NobleTrumpetModel;
import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.VipModel;
@ -189,4 +190,20 @@ public class LiveNetManager {
callback.onError(throwable.getMessage());
}).isDisposed();
}
/**
* 获取隐藏榜单的用户id
*/
public void getNobleRankHideUserList(HttpCallback<NobleRankHideUserListModel> callback) {
API.get().pdLiveApi(mContext).getNobleRankHideUserList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
if (callback != null)
callback.onSuccess(listResponseModel.getData().getInfo());
}, throwable -> {
if (callback != null)
callback.onError(throwable.getMessage());
}).isDisposed();
}
}

View File

@ -875,4 +875,6 @@ Limited ride And limited avatar frame</string>
<string name="live_class_tip_title">Pay attention to the channel that suits you.</string>
<string name="live_anchor_send">What do you say to everyone</string>
<string name="live_config">LiveConfig</string>
<string name="can_not_go">No access to the mystery man\'s personal home page。</string>
<string name="mystery_man">The Mystery Man</string>
</resources>

View File

@ -901,5 +901,7 @@
<string name="king">国王</string>
<string name="emperor">皇帝</string>
<string name="better_emperor">超皇</string>
<string name="can_not_go">無法前往神秘人的個人主頁。</string>
<string name="mystery_man">神秘人</string>
</resources>

View File

@ -688,6 +688,8 @@ public class LiveAudienceActivity extends LiveActivity {
String nobleUrl = CommonAppConfig.HOST + "/h5/Nobility.html?nickname=" + userInfo.getUserNicename()
+ "&usernobId=" + userInfo.getNobleId()
+ "&token=" + userInfo.getToken()
+ "&anchorUid=" + mLiveBean.getUid()
+ "&ancherName=" + mLiveBean.getUserNiceName()
+ "&uid=" + userInfo.getId();
ZhuangBanActivity.forward(mContext, nobleUrl, false);
break;

View File

@ -2253,11 +2253,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveGiftAnimPresenter.showBuyLiangNameGiftAnim(bean);
}
/**
* 开通贵族的全服通知
* @param bean
*/
public void showBuyVipMessage(LiveReceiveGiftBean bean) {
if (mLiveGiftAnimPresenter == null) {
mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager);
}
mLiveGiftAnimPresenter.showBuyVipGiftAnim(bean);
// if (mLiveGiftAnimPresenter == null) {
// mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager);
// }
// mLiveGiftAnimPresenter.showBuyVipGiftAnim(bean);
}
public void showSysMessage(LiveReceiveGiftBean bean) {

View File

@ -3,15 +3,19 @@ package com.yunbao.main.activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.viewpager.widget.ViewPager;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.adapter.ViewPagerAdapter;
import com.yunbao.common.bean.NobleRankHideUserListModel;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R;
import com.yunbao.main.views.AbsMainListChildViewHolder;
@ -43,19 +47,20 @@ public class MainListActivity extends AbsActivity {
private MainListContributeViewHolder mContributeViewHolder;//贡献榜
private MagicIndicator mIndicator;
private ViewPager mViewPager;
private List<String> outRankHide = new ArrayList<>();
public static void forward(Context context,int p) {
context.startActivity(new Intent(context, MainListActivity.class).putExtra("p",p));
public static void forward(Context context, int p) {
context.startActivity(new Intent(context, MainListActivity.class).putExtra("p", p));
}
@Override
protected void onResume() {
super.onResume();
if(mProfitViewHolder!=null && mProfitViewHolder.mAdapter!=null) {
if (mProfitViewHolder != null && mProfitViewHolder.mAdapter != null) {
mProfitViewHolder.mAdapter.notifyDataSetChanged();
}
if(mContributeViewHolder!=null && mContributeViewHolder.mAdapter!=null) {
if (mContributeViewHolder != null && mContributeViewHolder.mAdapter != null) {
mContributeViewHolder.mAdapter.notifyDataSetChanged();
}
}
@ -140,11 +145,27 @@ public class MainListActivity extends AbsActivity {
mIndicator.setNavigator(commonNavigator);
ViewPagerHelper.bind(mIndicator, mViewPager);
//默认选择第几个
mIndicator.onPageSelected(getIntent().getIntExtra("p",0));
mViewPager.setCurrentItem(getIntent().getIntExtra("p",0));
mIndicator.onPageSelected(getIntent().getIntExtra("p", 0));
mViewPager.setCurrentItem(getIntent().getIntExtra("p", 0));
//加载数据
loadData();
EventBus.getDefault().register(MainListActivity.this);
//获取隐身的用户的ID
LiveNetManager.get(mContext)
.getNobleRankHideUserList(new HttpCallback<NobleRankHideUserListModel>() {
@Override
public void onSuccess(NobleRankHideUserListModel data) {
outRankHide = data.getOutRankHide();
if (mContributeViewHolder != null) {
mContributeViewHolder.setHide(data.getOutRankHide());
}
}
@Override
public void onError(String error) {
Log.e("MainListActivity", error);
}
});
}
private void loadPageData(int position) {
@ -163,6 +184,7 @@ public class MainListActivity extends AbsActivity {
vh = mProfitViewHolder;
} else if (position == 1) {
mContributeViewHolder = new MainListContributeViewHolder(mContext, parent);
mContributeViewHolder.setHide(outRankHide);
vh = mContributeViewHolder;
}
if (vh == null) {

View File

@ -23,6 +23,7 @@ import com.yunbao.common.custom.MyRadioButton;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.main.R;
@ -53,6 +54,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
private List<ListBean> mTopList;
private HeadVh mHeadVh;
private int mType;
private List<String> outRankHide = new ArrayList<>();
public MainListAdapter(Context context, int type) {
@ -69,7 +71,13 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
ViewClicksAntiShake.clicksAntiShake(v, () -> {
Object tag = v.getTag();
if (tag != null && mOnItemClickListener != null) {
mOnItemClickListener.onItemClick((ListBean) tag, 0);
ListBean model = (ListBean) tag;
if (model.isHide()) {
ToastUtil.show(R.string.can_not_go);
} else {
mOnItemClickListener.onItemClick(model, 0);
}
}
});
@ -136,7 +144,13 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
@Override
public void refreshData(List<ListBean> list) {
for (ListBean model : list) {
for (String hideId : outRankHide) {
model.setHide(TextUtils.equals(model.getUid(), hideId));
}
}
mTopList.clear();
int size = list.size();
if (size > 0) {
mTopList.add(list.get(0));
@ -219,11 +233,6 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
SVGAImageView svga2;
SVGAImageView svga3;
// View mDataGroup2;
// View mDataGroup3;
// View mNoData2;
// View mNoData3;
public HeadVh(View itemView) {
super(itemView);
mItem1 = itemView.findViewById(R.id.item_1);
@ -259,11 +268,6 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
svga1 = (SVGAImageView) itemView.findViewById(R.id.svga1);
svga2 = (SVGAImageView) itemView.findViewById(R.id.svga2);
svga3 = (SVGAImageView) itemView.findViewById(R.id.svga3);
// mDataGroup2 = itemView.findViewById(R.id.data_group_2);
// mDataGroup3 = itemView.findViewById(R.id.data_group_3);
// mNoData2 = itemView.findViewById(R.id.no_data_2);
// mNoData3 = itemView.findViewById(R.id.no_data_3);
}
void setData(Object payload) {
@ -301,8 +305,14 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
if (payload == null) {
mItem1.setTag(bean);
mItem1.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar1);
mName1.setText(bean.getUserNiceName());
if (bean.isHide()) {
mName1.setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, mAvatar1);
} else {
ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar1);
mName1.setText(bean.getUserNiceName());
}
mVotes1.setText(bean.getTotalCoinFormat());
mSex1.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
LevelBean levelBean = null;
@ -399,19 +409,6 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
mBtnFollow2.setBackgroundResource(R.drawable.background_yellow);
mBtnFollow2.setTextColor(Color.parseColor("#FFFFFF"));
}
// if (mNoData2.getVisibility() == View.VISIBLE) {
// mNoData2.setVisibility(View.INVISIBLE);
// }
// if (mDataGroup2.getVisibility() != View.VISIBLE) {
// mDataGroup2.setVisibility(View.VISIBLE);
// }
} else {
// if (mDataGroup2.getVisibility() == View.VISIBLE) {
// mDataGroup2.setVisibility(View.INVISIBLE);
// }
// if (mNoData2.getVisibility() != View.VISIBLE) {
// mNoData2.setVisibility(View.VISIBLE);
// }
}
if (topSize > 2) {
ListBean bean = mTopList.get(2);
@ -478,19 +475,6 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
mBtnFollow3.setBackgroundResource(R.drawable.background_yellow);
mBtnFollow3.setTextColor(Color.parseColor("#FFFFFF"));
}
// if (mNoData3.getVisibility() == View.VISIBLE) {
// mNoData3.setVisibility(View.INVISIBLE);
// }
// if (mDataGroup3.getVisibility() != View.VISIBLE) {
// mDataGroup3.setVisibility(View.VISIBLE);
// }
} else {
// if (mDataGroup3.getVisibility() == View.VISIBLE) {
// mDataGroup3.setVisibility(View.INVISIBLE);
// }
// if (mNoData3.getVisibility() != View.VISIBLE) {
// mNoData3.setVisibility(View.VISIBLE);
// }
}
}
}
@ -551,8 +535,15 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
}
itemView.setTag(bean);
mOrder.setText("" + (position + 4));
ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar);
mName.setText(bean.getUserNiceName());
if (bean.isHide()) {
mName.setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, mAvatar);
} else {
ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar);
mName.setText(bean.getUserNiceName());
}
mVotes.setText(bean.getTotalCoinFormat() + " ");
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
LevelBean levelBean = null;
@ -607,4 +598,18 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
}
}
/**
* 设置隐藏数据
*
* @param outRankHide
*/
public void setHide(List<String> outRankHide) {
this.outRankHide = outRankHide;
for (ListBean model : mList) {
for (String hideId : outRankHide) {
model.setHide(TextUtils.equals(model.getUid(), hideId));
}
}
notifyDataSetChanged();
}
}

View File

@ -19,11 +19,23 @@ public class ListBean {
private int attention;
private int islive;
private String dress_head;
//是否隐藏
private boolean isHide = false;
public boolean isHide() {
return isHide;
}
public ListBean setHide(boolean hide) {
isHide = hide;
return this;
}
@JSONField(name = "dress_head")
public String getDress_head() {
return dress_head;
}
@JSONField(name = "dress_head")
public void setDress_head(String dress_head) {
this.dress_head = dress_head;

View File

@ -12,6 +12,7 @@ import com.yunbao.main.bean.ListBean;
import com.yunbao.main.http.MainHttpConsts;
import com.yunbao.main.http.MainHttpUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -21,6 +22,7 @@ import java.util.List;
*/
public class MainListContributeViewHolder extends AbsMainListChildViewHolder {
private List<String> outRankHide = new ArrayList<>();
public MainListContributeViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
@ -36,12 +38,13 @@ public class MainListContributeViewHolder extends AbsMainListChildViewHolder {
mAdapter = new MainListAdapter(mContext, MainListAdapter.TYPE_CONTRIBUTE);
mAdapter.setOnItemClickListener(MainListContributeViewHolder.this);
}
mAdapter.setHide(outRankHide);
return mAdapter;
}
@Override
public void loadData(int p, HttpCallback callback) {
if(!mType.isEmpty()){
if (!mType.isEmpty()) {
MainHttpUtil.consumeList(mType, p, callback);
}
}
@ -73,6 +76,17 @@ public class MainListContributeViewHolder extends AbsMainListChildViewHolder {
});
}
/**
* 设置隐藏数据
*
* @param outRankHide
*/
public void setHide(List<String> outRankHide) {
this.outRankHide = outRankHide;
if (mAdapter != null)
mAdapter.setHide(outRankHide);
}
@Override
public void onDestroy() {
super.onDestroy();

View File

@ -140,7 +140,7 @@
android:background="@drawable/background_dbdbdb"
android:button="@null"
android:gravity="center"
android:text="已关注"
android:text="@string/shield_gift_effect"
android:textColor="@color/white"
android:textSize="11sp" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB