侧边栏数据请求前移
This commit is contained in:
parent
cb55c09624
commit
8e7de87c6b
@ -59,7 +59,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
Bus.getOn(this);
|
||||
super.onCreate();
|
||||
initView();
|
||||
initData();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -148,19 +148,24 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
LiveNetManager.get(mContext)
|
||||
.getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
||||
adapter.updateData(data);
|
||||
}
|
||||
public void initData(List<CustomSidebarInfoModel> data) {
|
||||
if (data != null) {
|
||||
adapter.updateData(data);
|
||||
} else {
|
||||
LiveNetManager.get(mContext)
|
||||
.getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
||||
adapter.updateData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private CustomDrawerPopupCallBack callBack;
|
||||
@ -226,7 +231,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
|
||||
}
|
||||
if (event.isRefresh()) {
|
||||
initData();
|
||||
initData(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
@ -59,6 +60,7 @@ import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.http.main.MainNetManager;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
@ -183,7 +185,8 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
initData();
|
||||
MicStatusManager.getInstance().addOnMicListener(onMicStatusListener);
|
||||
}
|
||||
private final MicStatusManager.OnMicStatusListener onMicStatusListener=new MicStatusManager.OnMicStatusListener() {
|
||||
|
||||
private final MicStatusManager.OnMicStatusListener onMicStatusListener = new MicStatusManager.OnMicStatusListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
verticalViewPager.setEnableScroll(false);
|
||||
@ -194,6 +197,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
verticalViewPager.setEnableScroll(true);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化界面
|
||||
*/
|
||||
@ -304,6 +308,19 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
|
||||
});
|
||||
getDrawer();
|
||||
//侧边栏
|
||||
LiveNetManager.get(mContext)
|
||||
.getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
||||
customSidebarInfoModels = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadData(ViewGroup viewGroup, int currentItem) {
|
||||
@ -318,7 +335,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
@Override
|
||||
public void run() {
|
||||
AnchorRecommendItemModel data = itemModelList.get(mCurrentPage);
|
||||
if (mCurrentPage == 0&&liveIndex) {
|
||||
if (mCurrentPage == 0 && liveIndex) {
|
||||
View rootView = manager.getRootView();
|
||||
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
|
||||
((ViewGroup) (rootView.getParent())).removeView(rootView);
|
||||
@ -338,7 +355,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
liveIndex =false;
|
||||
liveIndex = false;
|
||||
try {
|
||||
mLiveSDK = Integer.parseInt(liveSdk);
|
||||
mLiveTypeVal = Integer.parseInt(liveTypeVal);
|
||||
@ -751,6 +768,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
list.remove(userIndex);
|
||||
}
|
||||
CustomDrawerPopupView customDrawerPopupView = new CustomDrawerPopupView(mContext).setList(list).setLiveId(mLiveBean.getUid());
|
||||
|
||||
customDrawerPopupView.setCallBack(new CustomDrawerPopupView.CustomDrawerPopupCallBack() {
|
||||
@Override
|
||||
public void funGamesID(int zfunGamesID) {
|
||||
@ -777,7 +795,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
if(MicStatusManager.getInstance().isMic(liveUid)){
|
||||
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||
return;
|
||||
}
|
||||
@ -894,7 +912,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
|
||||
@Override
|
||||
public void onShow(BasePopupView popupView) {
|
||||
|
||||
customDrawerPopupView.initData(customSidebarInfoModels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1275,6 +1293,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
*/
|
||||
private List<SlideInfoModel> slideInfoModels = new ArrayList<>();
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
private List<CustomSidebarInfoModel> customSidebarInfoModels = new ArrayList<>();
|
||||
|
||||
private void getDrawer() {
|
||||
|
||||
@ -1295,6 +1314,8 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onFollowEvent(FollowEvent e) {
|
||||
|
Loading…
Reference in New Issue
Block a user