修复:
侧边栏问题
This commit is contained in:
parent
da19811ad4
commit
b3500b94c0
@ -22,6 +22,17 @@ public class AnchorRecommendModel extends BaseModel {
|
||||
private int upShow = 0;
|
||||
@SerializedName("list")
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
@SerializedName("slide")
|
||||
private List<SlideInfoModel> slide = new ArrayList<>();
|
||||
|
||||
public List<SlideInfoModel> getSlide() {
|
||||
return slide;
|
||||
}
|
||||
|
||||
public AnchorRecommendModel setSlide(List<SlideInfoModel> slide) {
|
||||
this.slide = slide;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getListShow() {
|
||||
return listShow;
|
||||
|
@ -21,9 +21,10 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/live_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_margin="4dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
|
@ -65,7 +65,6 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
||||
import com.yunbao.live.views.LoadingView;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -121,7 +120,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
private int mLastPosition = -1;
|
||||
|
||||
private ViewGroup mViewGroup;
|
||||
private LoadingView loadingView;
|
||||
private int liveBg = 0;
|
||||
|
||||
|
||||
@ -168,8 +166,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
private void initView() {
|
||||
// 竖直滑动 ViewPager
|
||||
verticalViewPager = findViewById(R.id.view_pager);
|
||||
loadingView = findViewById(R.id.loading);
|
||||
loadingView.show();
|
||||
}
|
||||
|
||||
public void setBackIndex(int backIndex) {
|
||||
@ -193,7 +189,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
itemModelList.add(0, model);
|
||||
mPagerAdapter = new VerticalPagerAdapter(itemModelList, mContext);
|
||||
verticalViewPager.setAdapter(mPagerAdapter);
|
||||
loadingView.hide();
|
||||
verticalViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
@ -822,6 +817,14 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
mPagerAdapter.notifyDataSetChanged();
|
||||
verticalViewPager.setCurrentItem(mCurrentPage + 1);
|
||||
break;
|
||||
case REFRESH_THE_LIVEl_PAGE:
|
||||
// loadingView.show();
|
||||
// AnchorRecommendItemModel model = event.getAnchorRecommendItemModel();
|
||||
// itemModelList.add(0, model);
|
||||
// mPagerAdapter.notifyDataSetChanged();
|
||||
// verticalViewPager.setCurrentItem(0);
|
||||
getDrawer();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@ -856,26 +859,27 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
|
||||
private void getDrawer() {
|
||||
//侧边栏轮播
|
||||
MainNetManager.get(mContext)
|
||||
.getHot(1, new com.yunbao.common.http.base.HttpCallback<List<SlideInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SlideInfoModel> data) {
|
||||
slideInfoModels = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
//推荐位
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommend("10", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
.anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
list = anchorRecommendModel.getList();
|
||||
|
||||
list.clear();
|
||||
slideInfoModels.clear();
|
||||
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
|
||||
int userIndex = -1;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) {
|
||||
userIndex = i;
|
||||
}
|
||||
}
|
||||
if (userIndex != -1) {
|
||||
models.remove(userIndex);
|
||||
}
|
||||
models.add(0, new AnchorRecommendItemModel());
|
||||
list.addAll(models);
|
||||
slideInfoModels = anchorRecommendModel.getSlide();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@ -22,14 +24,19 @@ import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.main.MainNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.adapter.SidebarAdapter;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -40,6 +47,7 @@ import java.util.List;
|
||||
public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
//侧边栏背景
|
||||
private ImageView sidebarBack;
|
||||
private View mask;
|
||||
//侧边栏刷新列表
|
||||
public CommonRefreshView sidebarList;
|
||||
|
||||
@ -48,6 +56,8 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
private List<SlideInfoModel> slideInfoModels = new ArrayList<>();
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_sidebar_live_audience;
|
||||
@ -63,6 +73,7 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Bundle bundle = getArguments();
|
||||
sidebarBack = (ImageView) findViewById(R.id.sidebar_back);
|
||||
mask = findViewById(R.id.mask);
|
||||
if (bundle != null) {
|
||||
String avatar = bundle.getString("Avatar");
|
||||
int liveBg = bundle.getInt("LiveBg");
|
||||
@ -73,8 +84,10 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
//侧边栏背景
|
||||
if (liveBg == 1) {
|
||||
ImgLoader.displayBlurLive(mContext, avatar, sidebarBack);
|
||||
mask.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ImgLoader.display(mContext, R.mipmap.live_bg, sidebarBack);
|
||||
mask.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
@ -112,39 +125,46 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
//推荐位
|
||||
MainNetManager.get(getActivity())
|
||||
.anchorRecommend("10", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
//侧边栏
|
||||
MainNetManager.get(getActivity())
|
||||
.getHot(1, new com.yunbao.common.http.base.HttpCallback<List<SlideInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SlideInfoModel> data) {
|
||||
List<AnchorRecommendItemModel> list = anchorRecommendModel.getList();
|
||||
list.add(0, new AnchorRecommendItemModel());
|
||||
sidebarAdapter.addData(list);
|
||||
sidebarList.onFinish();
|
||||
sidebarAdapter.setData(data);
|
||||
}
|
||||
if (index > 0) {
|
||||
//推荐位
|
||||
MainNetManager.get(getActivity())
|
||||
.anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
List<AnchorRecommendItemModel> list = anchorRecommendModel.getList();
|
||||
int userIndex = -1;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) {
|
||||
userIndex = i;
|
||||
}
|
||||
}
|
||||
if (userIndex != -1) {
|
||||
list.remove(userIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
list.add(0, new AnchorRecommendItemModel());
|
||||
|
||||
}
|
||||
});
|
||||
sidebarAdapter.addData(list);
|
||||
sidebarAdapter.setData(anchorRecommendModel.getSlide());
|
||||
sidebarList.onFinish();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
index = index + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
sidebarList.initData();
|
||||
sidebarAdapter.setOnItemClickListener((bean, position) -> gotoLive(bean.getUid()));
|
||||
sidebarAdapter.setOnItemClickListener((bean, position) -> {
|
||||
|
||||
gotoLive(bean.getUid());
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -182,8 +202,7 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
if (liveBean1 == null) {
|
||||
return;
|
||||
}
|
||||
LiveAudienceActivity.forward(getActivity(), liveBean1, liveType, liveTypeVal, "", 0, liveSdk);
|
||||
(getActivity()).finish();
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
|
||||
});
|
||||
mCheckLivePresenter.checkLive(liveBean);
|
||||
|
||||
@ -194,4 +213,12 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.REFRESH_THE_LIVEl_PAGE)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.live.event;
|
||||
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.live.bean.OpenParametersModel;
|
||||
|
||||
@ -9,6 +10,16 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
private ActiveModel model = new ActiveModel();
|
||||
private String avatar = "";
|
||||
private OpenParametersModel parametersModel = new OpenParametersModel();
|
||||
private AnchorRecommendItemModel anchorRecommendItemModel = new AnchorRecommendItemModel();
|
||||
|
||||
public AnchorRecommendItemModel getAnchorRecommendItemModel() {
|
||||
return anchorRecommendItemModel;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setAnchorRecommendItemModel(AnchorRecommendItemModel anchorRecommendItemModel) {
|
||||
this.anchorRecommendItemModel = anchorRecommendItemModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OpenParametersModel getParametersModel() {
|
||||
return parametersModel;
|
||||
@ -60,7 +71,8 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
WISH_LIST(11, "心愿单"),
|
||||
OPEN_PARAMETERS(12, "开放参数"),
|
||||
ACTIVITY_CENTER(13, "活動中心"),
|
||||
LIVE_ROOM_EXCEPTION(14, "直播间异常");
|
||||
LIVE_ROOM_EXCEPTION(14, "直播间异常"),
|
||||
REFRESH_THE_LIVEl_PAGE(15, "刷新直播页面");
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
@ -105,7 +105,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
//直播间背景
|
||||
private ImageView liveBack;
|
||||
|
||||
|
||||
private View mask;
|
||||
//侧滑布局
|
||||
// private DrawerLayout drawerLayout;
|
||||
//直播间拆分布局
|
||||
@ -184,6 +184,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
//直播页面背景
|
||||
liveBack = mRootContainer.findViewById(R.id.live_back);
|
||||
mask = mRootContainer.findViewById(R.id.mask);
|
||||
|
||||
|
||||
}
|
||||
@ -219,8 +220,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
|
||||
//直播间背景
|
||||
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
|
||||
|
||||
ImgLoader.display(mContext, R.mipmap.live_bg, liveBack);
|
||||
mask.setVisibility(View.GONE);
|
||||
mLivePlayViewHolder.setCover(data.getThumb());
|
||||
mLivePlayViewHolder.play(data.getPull());
|
||||
mLiveRoomViewHolder.setAvatar(data.getAvatar());
|
||||
@ -811,6 +812,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
if (liveBg == 1) {
|
||||
//直播间背景
|
||||
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
|
||||
mask.setVisibility(View.VISIBLE);
|
||||
}
|
||||
//回传参数
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
|
@ -18,6 +18,7 @@
|
||||
android:src="@mipmap/live_bg" />
|
||||
|
||||
<View
|
||||
android:id="@+id/mask"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#70000000" />
|
||||
|
@ -9,10 +9,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<com.yunbao.live.views.LoadingView
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
@ -10,6 +10,7 @@
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<View
|
||||
android:id="@+id/mask"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#90000000" />
|
||||
|
Loading…
Reference in New Issue
Block a user