优化:
进入直播间的时间,筛选
This commit is contained in:
parent
15bb24fa83
commit
cff66d234d
@ -115,6 +115,17 @@ public interface PDLiveApi {
|
||||
@Query("num") String num
|
||||
);
|
||||
|
||||
/**
|
||||
* 直播间上下滚动列表
|
||||
*
|
||||
* @param num 请求数量
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Home.anchorRecommend ")
|
||||
Observable<ResponseModel<AnchorRecommendModel>> anchorRecommend(
|
||||
@Query("num") String num, @Query("type") String type
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取直播间信息
|
||||
*
|
||||
@ -150,6 +161,7 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@GET("/api/public/?service=Active.getActiveList")
|
||||
Observable<ResponseModel<List<ActiveModel>>> getActiveList();
|
||||
|
||||
/**
|
||||
* 获取活动
|
||||
*/
|
||||
@ -158,14 +170,16 @@ public interface PDLiveApi {
|
||||
|
||||
/**
|
||||
* 获取日榜、周榜数据
|
||||
*
|
||||
* @param uid 直播间id,并非用户uid
|
||||
* @return 榜单结构
|
||||
*/
|
||||
@GET("/api/public/?service=Contribute.index")
|
||||
Observable<ResponseModel<ContributeModel>> getRanksList(@Query("uid")String uid);
|
||||
Observable<ResponseModel<ContributeModel>> getRanksList(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 直播间新人特惠信息
|
||||
*
|
||||
* @return 新人特惠数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.newUserPreferential")
|
||||
|
@ -112,6 +112,28 @@ public class MainNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 猜你喜欢
|
||||
*
|
||||
* @param num 请求数量
|
||||
* @return
|
||||
*/
|
||||
public void anchorRecommendType(String num, HttpCallback<AnchorRecommendModel> httpCallback) {
|
||||
API.get().pdLiveApi(mContext).anchorRecommend(num, "1")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(anchorRecommendModelResponseModel -> {
|
||||
if (httpCallback != null) {
|
||||
AnchorRecommendModel model = anchorRecommendModelResponseModel.getData().getInfo();
|
||||
httpCallback.onSuccess(model);
|
||||
}
|
||||
}, throwable -> {
|
||||
if (httpCallback != null) {
|
||||
httpCallback.onError(throwable.getMessage());
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*
|
||||
|
@ -71,7 +71,6 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
@ -187,38 +186,12 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
* 初始化数据
|
||||
*/
|
||||
private void initData() {
|
||||
//直播间列表
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommend("30", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel data) {
|
||||
itemModelList = data.getList();
|
||||
//查询直播间状态
|
||||
int index = -1;
|
||||
for (int i = 0; i < itemModelList.size(); i++) {
|
||||
AnchorRecommendItemModel model = itemModelList.get(i);
|
||||
if (TextUtils.equals(mLiveBean.getUid(), model.getUid())) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
if (index > -1) {
|
||||
Collections.swap(itemModelList, index, 0);
|
||||
} else {
|
||||
String json = GsonUtils.toJson(mLiveBean);
|
||||
AnchorRecommendItemModel model = GsonUtils.fromJson(json, AnchorRecommendItemModel.class);
|
||||
itemModelList.add(0, model);
|
||||
}
|
||||
mPagerAdapter = new VerticalPagerAdapter(itemModelList, mContext);
|
||||
verticalViewPager.setAdapter(mPagerAdapter);
|
||||
loadingView.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
verticalViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
@ -226,10 +199,12 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
Log.e(TAG, "mCurrentItem:" + mCurrentItem);
|
||||
if (mCurrentItem == itemModelList.size() - 1) {
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommend("30", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
.anchorRecommendType("30", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel data) {
|
||||
|
||||
if (TextUtils.equals(data.getList().get(0).getUid(), mLiveBean.getUid())) {
|
||||
data.getList().remove(0);
|
||||
}
|
||||
itemModelList.addAll(data.getList());
|
||||
mPagerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
@ -827,11 +802,15 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
Log.i("tag", url);
|
||||
Intent intent=new Intent(mContext,ZhuangBanActivity.class);
|
||||
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
intent.putExtra("isFull",true);
|
||||
intent.putExtra("isFull", true);
|
||||
mContext.startActivity(intent);
|
||||
break;
|
||||
case LIVE_ROOM_EXCEPTION:
|
||||
//主播未直播时自动下滑至下一个直播间
|
||||
verticalViewPager.setCurrentItem(mCurrentPage + 1);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,8 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
EFFECTS_SETTINGS(10, "特效設置"),
|
||||
WISH_LIST(11, "心愿单"),
|
||||
OPEN_PARAMETERS(12, "开放参数"),
|
||||
ACTIVITY_CENTER(13, "活動中心");
|
||||
ACTIVITY_CENTER(13, "活動中心"),
|
||||
LIVE_ROOM_EXCEPTION(14, "直播间异常");
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
@ -9,12 +9,14 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
@ -76,6 +78,8 @@ public class LiveRoomCheckLivePresenter {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_ROOM_EXCEPTION));
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
@ -119,7 +123,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
} else {
|
||||
enterLiveRoom();
|
||||
isRoom = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user