猜你喜欢
This commit is contained in:
parent
134cdf2e2a
commit
d13e42e33d
@ -1,5 +1,6 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -10,7 +11,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.http.main.MainNetManager;
|
||||
import com.yunbao.common.views.DrawerRecommendViewHolder;
|
||||
import com.yunbao.common.views.DrawerTaskViewHolder;
|
||||
import com.yunbao.common.views.FunGamesViewHolder;
|
||||
@ -85,6 +88,34 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
RecommendViewHolder recommendViewHolder = (RecommendViewHolder) holder;
|
||||
recommendViewHolder.setData(infoModels.get(position));
|
||||
recommendViewHolder.updateData(list);
|
||||
recommendViewHolder.setListener(new RecommendViewHolder.RecommendViewListener() {
|
||||
@Override
|
||||
public void changeOneBatch() {
|
||||
//推荐位
|
||||
MainNetManager.get((Activity) mContext)
|
||||
.anchorRecommend("9", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
|
||||
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
|
||||
|
||||
recommendViewHolder.updateData(models);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToLive(AnchorRecommendItemModel model) {
|
||||
if (listener != null) {
|
||||
listener.goToLive(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,4 +148,15 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
infoModels.addAll(mInfoModels);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private CustomDrawerListener listener;
|
||||
|
||||
public CustomDrawerPopupAdapter setListener(CustomDrawerListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface CustomDrawerListener {
|
||||
void goToLive(AnchorRecommendItemModel model);
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,14 @@ public class RecommendAdapter extends RecyclerView.Adapter {
|
||||
|
||||
RecommendChildViewHolder itemViewHolder = (RecommendChildViewHolder) holder;
|
||||
itemViewHolder.setData(list.get(position));
|
||||
itemViewHolder.setListener(new RecommendChildViewHolder.RecommendChildListener() {
|
||||
@Override
|
||||
public void goToLive(AnchorRecommendItemModel model) {
|
||||
if (callback != null) {
|
||||
callback.goToLive(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,4 +53,15 @@ public class RecommendAdapter extends RecyclerView.Adapter {
|
||||
list.addAll(mList);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private RecommendCallback callback;
|
||||
|
||||
public RecommendAdapter setCallback(RecommendCallback callback) {
|
||||
this.callback = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface RecommendCallback {
|
||||
void goToLive(AnchorRecommendItemModel model);
|
||||
}
|
||||
}
|
||||
|
@ -48,12 +48,21 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initView() {
|
||||
drawerList = findViewById(R.id.drawerList);
|
||||
adapter = new CustomDrawerPopupAdapter(mContext);
|
||||
adapter.setList(list);
|
||||
drawerList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
drawerList.setAdapter(adapter);
|
||||
adapter.setListener(new CustomDrawerPopupAdapter.CustomDrawerListener() {
|
||||
@Override
|
||||
public void goToLive(AnchorRecommendItemModel model) {
|
||||
if (callBack != null) {
|
||||
callBack.goToLive(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
@ -70,4 +79,15 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private CustomDrawerPopupCallBack callBack;
|
||||
|
||||
public CustomDrawerPopupView setCallBack(CustomDrawerPopupCallBack callBack) {
|
||||
this.callBack = callBack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface CustomDrawerPopupCallBack {
|
||||
void goToLive(AnchorRecommendItemModel model);
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ import com.squareup.picasso.Picasso;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class RecommendChildViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView cover;
|
||||
@ -38,5 +39,24 @@ public class RecommendChildViewHolder extends RecyclerView.ViewHolder {
|
||||
}
|
||||
ImgLoader.display(itemView.getContext(), bean.getThumb(), cover);
|
||||
name.setText(bean.getUserNicename());
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (listener != null) {
|
||||
listener.goToLive(bean);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private RecommendChildListener listener;
|
||||
|
||||
public RecommendChildViewHolder setListener(RecommendChildListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface RecommendChildListener {
|
||||
void goToLive(AnchorRecommendItemModel model);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.RecommendAdapter;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -28,6 +29,24 @@ public class RecommendViewHolder extends RecyclerView.ViewHolder {
|
||||
recommendAdapter = new RecommendAdapter(itemView.getContext());
|
||||
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 3));
|
||||
childList.setAdapter(recommendAdapter);
|
||||
ViewClicksAntiShake.clicksAntiShake(subtitle, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (listener != null) {
|
||||
listener.changeOneBatch();
|
||||
}
|
||||
}
|
||||
});
|
||||
recommendAdapter.setCallback(new RecommendAdapter.RecommendCallback() {
|
||||
@Override
|
||||
public void goToLive(AnchorRecommendItemModel model) {
|
||||
if (listener != null) {
|
||||
listener.goToLive(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setData(CustomSidebarInfoModel model) {
|
||||
@ -38,4 +57,17 @@ public class RecommendViewHolder extends RecyclerView.ViewHolder {
|
||||
public void updateData(List<AnchorRecommendItemModel> list) {
|
||||
recommendAdapter.updateData(list);
|
||||
}
|
||||
|
||||
private RecommendViewListener listener;
|
||||
|
||||
public RecommendViewHolder setListener(RecommendViewListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface RecommendViewListener {
|
||||
void changeOneBatch();
|
||||
|
||||
void goToLive(AnchorRecommendItemModel model);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:layout_height="35.12dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@mipmap/bg_main_item_bottom" />
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_margin="4dp"
|
||||
android:textColor="#FFF6F7FB"
|
||||
android:textSize="12sp" />
|
||||
android:textSize="11sp" />
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@ -11,8 +11,7 @@
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="6dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@mipmap/icon_start_number" />
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
|
@ -34,7 +34,9 @@ import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lxj.xpopup.enums.PopupPosition;
|
||||
import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
@ -689,53 +691,71 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
Bundle bundle = new Bundle();
|
||||
Log.i("SocketRyClient", "onOpenDrawer: " + event.getType() + " " + event);
|
||||
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
|
||||
CustomDrawerPopupView customDrawerPopupView = new CustomDrawerPopupView(mContext).setList(list);
|
||||
customDrawerPopupView.setCallBack(new CustomDrawerPopupView.CustomDrawerPopupCallBack() {
|
||||
@Override
|
||||
public void goToLive(AnchorRecommendItemModel model) {
|
||||
//获取直播间状态
|
||||
LiveHttpUtil.getLiveInfo(model.getUid(), liveInfo);
|
||||
customDrawerPopupView.dismiss();
|
||||
}
|
||||
});
|
||||
switch (event.getType()) {
|
||||
case SIDEBAR:
|
||||
case BOTTOM_COLLECTION:
|
||||
// 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);
|
||||
// }
|
||||
// //从右边打开侧边栏
|
||||
// SidebarLiveAudience sidebarLiveAudience = new SidebarLiveAudience();
|
||||
// bundle.putString("Avatar", mLiveBean.getAvatar());
|
||||
// bundle.putString("banner", GsonUtils.toJson(slideInfoModels));
|
||||
// bundle.putString("list", GsonUtils.toJson(list));
|
||||
// bundle.putInt("LiveBg", liveBg);
|
||||
// sidebarLiveAudience.setArguments(bundle);
|
||||
// sidebarLiveAudience.show(getSupportFragmentManager(), "SidebarLiveAudience");
|
||||
// MPopupWindow.create(mContext)
|
||||
// .setLayoutId(R.layout.view_sidebar_live_audience)
|
||||
// .setBackgroundDrawable(new ColorDrawable(Color.GREEN))
|
||||
// .setOnDismissListener(new MPopupWindow.MPopupListener() {
|
||||
// @Override
|
||||
// public void invoke(View contentView) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onDismiss() {
|
||||
//
|
||||
// }
|
||||
// }).setGravity(TypeGravity.BOTTOM_RIGHT)
|
||||
// .setTarget(titleLine)
|
||||
// .setHeight(DeviceUtils.getScreenHeight(mContext)*2)
|
||||
// .setWidth(DeviceUtils.getScreenWidth(mContext)/6*5)
|
||||
// .build()
|
||||
// .show();
|
||||
|
||||
new XPopup.Builder(mContext)
|
||||
.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Right)//右边
|
||||
.hasStatusBarShadow(true) //启用状态栏阴影
|
||||
.asCustom(new CustomDrawerPopupView(mContext).setList(list))
|
||||
.setPopupCallback(new XPopupCallback() {
|
||||
@Override
|
||||
public void onCreated(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(BasePopupView popupView) {
|
||||
getDrawer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeDismiss(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed(BasePopupView popupView) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickOutside(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
})
|
||||
.asCustom(customDrawerPopupView)
|
||||
.show();
|
||||
break;
|
||||
case GIFT_POPUP:
|
||||
@ -1057,7 +1077,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
|
||||
//推荐位
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
.anchorRecommend("9", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
list.clear();
|
||||
|
@ -341,13 +341,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
<!--普通工具合集-->
|
||||
<ImageView
|
||||
android:id="@+id/total_image"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/live_icon_more" />
|
||||
|
||||
<!--特权-->
|
||||
<ImageView
|
||||
android:id="@+id/live_privilege"
|
||||
@ -402,7 +396,13 @@
|
||||
android:layout_height="38dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/live_lw" />
|
||||
|
||||
<!--普通工具合集-->
|
||||
<ImageView
|
||||
android:id="@+id/total_image"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/live_icon_more" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 4.3 KiB |
Loading…
Reference in New Issue
Block a user