diff --git a/common/src/main/java/com/yunbao/common/bean/NobleRankHideUserListModel.java b/common/src/main/java/com/yunbao/common/bean/NobleRankHideUserListModel.java new file mode 100644 index 000000000..f94c50172 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/NobleRankHideUserListModel.java @@ -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 inRankHide = new ArrayList<>(); + @SerializedName("out_rank_hide")//目前客户端只使用这个字段 + private List outRankHide = new ArrayList<>(); + @SerializedName("week_rank_hide") + private List weekRankHide = new ArrayList<>(); + @SerializedName("active_rank_hide") + private List activeRankHide = new ArrayList<>(); + + public List getInRankHide() { + return inRankHide; + } + + public NobleRankHideUserListModel setInRankHide(List inRankHide) { + this.inRankHide = inRankHide; + return this; + } + + public List getOutRankHide() { + return outRankHide; + } + + public NobleRankHideUserListModel setOutRankHide(List outRankHide) { + this.outRankHide = outRankHide; + return this; + } + + public List getWeekRankHide() { + return weekRankHide; + } + + public NobleRankHideUserListModel setWeekRankHide(List weekRankHide) { + this.weekRankHide = weekRankHide; + return this; + } + + public List getActiveRankHide() { + return activeRankHide; + } + + public NobleRankHideUserListModel setActiveRankHide(List activeRankHide) { + this.activeRankHide = activeRankHide; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 8145c8ee4..acaf1a8a9 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -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>> getUserInstructor(); + + /** + * 获取隐藏榜单的用户id + */ + @GET("/api/public/?service=Noble.getNobleRankHideUserList") + Observable> getNobleRankHideUserList(); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 58a5c0393..46fae1840 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -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 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(); + } } diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index a36380085..908ddca52 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -875,4 +875,6 @@ Limited ride And limited avatar frame Pay attention to the channel that suits you. What do you say to everyone LiveConfig + No access to the mystery man\'s personal home page。 + The Mystery Man diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 1c8f3f578..e67596f74 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -901,5 +901,7 @@ 国王 皇帝 超皇 + 無法前往神秘人的個人主頁。 + 神秘人 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 6856e207f..a5bb51a47 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -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; diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 5e7a0c81f..31cbbc916 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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) { diff --git a/main/src/main/java/com/yunbao/main/activity/MainListActivity.java b/main/src/main/java/com/yunbao/main/activity/MainListActivity.java index 653573be5..6840dd6af 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainListActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainListActivity.java @@ -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 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() { + @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) { diff --git a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java index 6d4f58960..6339f159f 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java @@ -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 { private List mTopList; private HeadVh mHeadVh; private int mType; + private List outRankHide = new ArrayList<>(); public MainListAdapter(Context context, int type) { @@ -69,7 +71,13 @@ public class MainListAdapter extends RefreshAdapter { 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 { @Override public void refreshData(List 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 { 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 { 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 { 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 { 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 { 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 { } 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 { } } + /** + * 设置隐藏数据 + * + * @param outRankHide + */ + public void setHide(List outRankHide) { + this.outRankHide = outRankHide; + for (ListBean model : mList) { + for (String hideId : outRankHide) { + model.setHide(TextUtils.equals(model.getUid(), hideId)); + } + } + notifyDataSetChanged(); + } } diff --git a/main/src/main/java/com/yunbao/main/bean/ListBean.java b/main/src/main/java/com/yunbao/main/bean/ListBean.java index 83b8851c3..9434a52a0 100644 --- a/main/src/main/java/com/yunbao/main/bean/ListBean.java +++ b/main/src/main/java/com/yunbao/main/bean/ListBean.java @@ -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; diff --git a/main/src/main/java/com/yunbao/main/views/MainListContributeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainListContributeViewHolder.java index 774369346..9d163a9ac 100644 --- a/main/src/main/java/com/yunbao/main/views/MainListContributeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainListContributeViewHolder.java @@ -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 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 outRankHide) { + this.outRankHide = outRankHide; + if (mAdapter != null) + mAdapter.setHide(outRankHide); + } + @Override public void onDestroy() { super.onDestroy(); diff --git a/main/src/main/res/layout/item_main_list_head.xml b/main/src/main/res/layout/item_main_list_head.xml index cb4887455..0fb7abd0e 100644 --- a/main/src/main/res/layout/item_main_list_head.xml +++ b/main/src/main/res/layout/item_main_list_head.xml @@ -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" /> diff --git a/main/src/main/res/mipmap-xxxhdpi/hide.png b/main/src/main/res/mipmap-xxxhdpi/hide.png new file mode 100644 index 000000000..35dfadbaa Binary files /dev/null and b/main/src/main/res/mipmap-xxxhdpi/hide.png differ