diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 8d08fa345..046653d28 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -32,8 +32,10 @@ import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; +import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.API; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.utils.Bus; @@ -60,6 +62,9 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.Locale; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + /** * Created by cxf on 2018/10/9. * 观众直播间逻辑 @@ -458,7 +463,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { */ public void openNewPeopleDialog() { if (newPeopleUrl == null) { -// getNewPeopleInfo(true); + getNewPeopleInfo(true); return; } Bundle bundle = new Bundle(); @@ -474,6 +479,30 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); } + public void getNewPeopleInfo(boolean show) { + API.get().pdLiveApi(mContext) + .getNewPeopleInfo() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(stringResponseModel -> { + NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo(); + if (peopleInfo.getIsShow()) { + liveNewPeople.setVisibility(View.VISIBLE); + if (peopleInfo.getLink().startsWith("http")) { + newPeopleUrl = peopleInfo.getLink() + "?"; + } else { + newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink(); + } + setUserPreferentialRedDot(peopleInfo.getShowRed() == 1); + if (show) { + openNewPeopleDialog(); + } + } else { + liveNewPeople.setVisibility(View.GONE); + } + }, Throwable::printStackTrace).isDisposed(); + } + /** * 观众打开主播的整蛊惑单窗口 */