侧边栏

This commit is contained in:
18401019693 2022-11-09 09:47:04 +08:00
parent 88e27df986
commit ef4c377990
27 changed files with 633 additions and 352 deletions

View File

@ -188,4 +188,6 @@ dependencies {
api 'com.github.princekin-f:EasyFloat:2.0.4' api 'com.github.princekin-f:EasyFloat:2.0.4'
api files('libs/Msc.jar') api files('libs/Msc.jar')
api 'com.github.li-xiaojun:XPopup:2.9.1'
} }

View File

@ -168,6 +168,7 @@ public class Constants {
public static final String STAR_CHALLENGE_UPDATE = "starChallengeUpdate";//星级助力 public static final String STAR_CHALLENGE_UPDATE = "starChallengeUpdate";//星级助力
public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手 public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手
public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功 public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功
public static final String SUPER_VISION = "supervision";//超级发言警告
//游戏socket //游戏socket
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花 public static final String SOCKET_GAME_ZJH = "startGame";//炸金花

View File

@ -0,0 +1,29 @@
package com.yunbao.common.adapter;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* 新侧边栏适配器
*/
public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
}
@Override
public int getItemCount() {
return 0;
}
}

View File

@ -0,0 +1,94 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class CustomSidebarChildModel extends BaseModel {
@SerializedName("id")
private String id;
@SerializedName("parent_id")
private String parentId;
@SerializedName("title")
private String title;
@SerializedName("subtitle")
private String subtitle;
@SerializedName("icon")
private String icon;
@SerializedName("src")
private String src;
@SerializedName("show_type")
private String showType;
@SerializedName("sort")
private String sort;
public String getId() {
return id;
}
public CustomSidebarChildModel setId(String id) {
this.id = id;
return this;
}
public String getParentId() {
return parentId;
}
public CustomSidebarChildModel setParentId(String parentId) {
this.parentId = parentId;
return this;
}
public String getTitle() {
return title;
}
public CustomSidebarChildModel setTitle(String title) {
this.title = title;
return this;
}
public String getSubtitle() {
return subtitle;
}
public CustomSidebarChildModel setSubtitle(String subtitle) {
this.subtitle = subtitle;
return this;
}
public String getIcon() {
return icon;
}
public CustomSidebarChildModel setIcon(String icon) {
this.icon = icon;
return this;
}
public String getSrc() {
return src;
}
public CustomSidebarChildModel setSrc(String src) {
this.src = src;
return this;
}
public String getShowType() {
return showType;
}
public CustomSidebarChildModel setShowType(String showType) {
this.showType = showType;
return this;
}
public String getSort() {
return sort;
}
public CustomSidebarChildModel setSort(String sort) {
this.sort = sort;
return this;
}
}

View File

@ -0,0 +1,99 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* 新版自定义侧边栏
*/
public class CustomSidebarInfoModel extends BaseModel {
@SerializedName("id")
private String id;
@SerializedName("title")
private String title;
@SerializedName("subtitle")
private String subtitle;
@SerializedName("sort")
private String sort;
@SerializedName("show_type")
private String showType;
@SerializedName("src")
private String src;
@SerializedName("type")
private String type;
@SerializedName("child")
private List<CustomSidebarChildModel> child;
public String getId() {
return id;
}
public CustomSidebarInfoModel setId(String id) {
this.id = id;
return this;
}
public String getTitle() {
return title;
}
public CustomSidebarInfoModel setTitle(String title) {
this.title = title;
return this;
}
public String getSubtitle() {
return subtitle;
}
public CustomSidebarInfoModel setSubtitle(String subtitle) {
this.subtitle = subtitle;
return this;
}
public String getSort() {
return sort;
}
public CustomSidebarInfoModel setSort(String sort) {
this.sort = sort;
return this;
}
public String getShowType() {
return showType;
}
public CustomSidebarInfoModel setShowType(String showType) {
this.showType = showType;
return this;
}
public String getSrc() {
return src;
}
public CustomSidebarInfoModel setSrc(String src) {
this.src = src;
return this;
}
public String getType() {
return type;
}
public CustomSidebarInfoModel setType(String type) {
this.type = type;
return this;
}
public List<CustomSidebarChildModel> getChild() {
return child;
}
public CustomSidebarInfoModel setChild(List<CustomSidebarChildModel> child) {
this.child = child;
return this;
}
}

View File

@ -4,6 +4,7 @@ import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.ContributeModel; import com.yunbao.common.bean.ContributeModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.FaceBookUpModel; import com.yunbao.common.bean.FaceBookUpModel;
import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.HourRank;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
@ -236,7 +237,8 @@ public interface PDLiveApi {
Observable<ResponseModel<NobleRankHideUserListModel>> getNobleRankHideUserList(); Observable<ResponseModel<NobleRankHideUserListModel>> getNobleRankHideUserList();
/** /**
*获取当前星级 * 获取当前星级
*
* @param liveUid * @param liveUid
* @return * @return
*/ */
@ -248,4 +250,10 @@ public interface PDLiveApi {
*/ */
@GET("/api/public/?service=Live.getLiveRoomActivtyBanner") @GET("/api/public/?service=Live.getLiveRoomActivtyBanner")
Observable<ResponseModel<List<LiveRoomActivityBanner>>> getLiveRoomActivityBanner(); Observable<ResponseModel<List<LiveRoomActivityBanner>>> getLiveRoomActivityBanner();
/**
* 新侧边栏请求
*/
@GET("/api/public/?service=Live.getCustomSidebarInfo")
Observable<ResponseModel<List<CustomSidebarInfoModel>>> getCustomSidebarInfo();
} }

View File

@ -6,6 +6,7 @@ import android.text.TextUtils;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleRankHideUserListModel;
@ -14,7 +15,6 @@ import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.VipModel; import com.yunbao.common.bean.VipModel;
import com.yunbao.common.http.API; import com.yunbao.common.http.API;
import com.yunbao.common.http.ResponseModel;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import java.util.List; import java.util.List;
@ -63,6 +63,7 @@ public class LiveNetManager {
if (callback != null) if (callback != null)
callback.onError(throwable.getMessage()); callback.onError(throwable.getMessage());
}).isDisposed(); }).isDisposed();
} }
/** /**
@ -237,7 +238,6 @@ public class LiveNetManager {
/** /**
* 获取 新人特惠趣味游戏幸运天使 * 获取 新人特惠趣味游戏幸运天使
*
*/ */
public void getLiveRoomActivityBanner(HttpCallback<List<LiveRoomActivityBanner>> callback) { public void getLiveRoomActivityBanner(HttpCallback<List<LiveRoomActivityBanner>> callback) {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
@ -253,4 +253,22 @@ public class LiveNetManager {
throwable.printStackTrace(); throwable.printStackTrace();
}).isDisposed(); }).isDisposed();
} }
/**
* 获取新侧边数据
*
* @param callback
*/
public void getCustomSidebarInfo(HttpCallback<List<CustomSidebarInfoModel>> callback) {
API.get().pdLiveApi(mContext)
.getCustomSidebarInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> callback.onSuccess(listResponseModel.getData().getInfo()), throwable -> {
if (callback != null) {
callback.onError(throwable.getMessage());
}
throwable.printStackTrace();
}).isDisposed();
}
} }

View File

@ -0,0 +1,57 @@
package com.yunbao.common.views;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.core.DrawerPopupView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.http.live.LiveNetManager;
import java.util.List;
public class CustomDrawerPopupView extends DrawerPopupView {
private Context mContext;
private RecyclerView drawerList;
public CustomDrawerPopupView(@NonNull Context context) {
super(context);
mContext = context;
}
@Override
protected int getImplLayoutId() {
return R.layout.custom_drawer_popup;
}
@Override
protected void onCreate() {
super.onCreate();
initView();
initData();
}
private void initView() {
drawerList = findViewById(R.id.drawerList);
}
private void initData() {
LiveNetManager.get(mContext)
.getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> data) {
}
@Override
public void onError(String error) {
}
});
}
}

View File

@ -0,0 +1,15 @@
package com.yunbao.common.views;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* 侧边栏推荐布局 任务
*/
public class DrawerRecommendViewHolder extends RecyclerView.ViewHolder {
public DrawerRecommendViewHolder(@NonNull View itemView) {
super(itemView);
}
}

View File

@ -0,0 +1,15 @@
package com.yunbao.common.views;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* 侧边栏任务布局
*/
public class DrawerTaskViewHolder extends RecyclerView.ViewHolder {
public DrawerTaskViewHolder(@NonNull View itemView) {
super(itemView);
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomLeftRadius="16dp"
android:topLeftRadius="16dp" />
<solid android:color="#15151D" />
</shape>

View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="330dp"
android:layout_height="match_parent"
android:background="@drawable/backgroud_custom_drawer_popup"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/drawerList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="48dp"
android:layout_weight="1"
android:background="@color/white" />
<HorizontalScrollView
android:id="@+id/basic_tools_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="34dp"
android:paddingEnd="16dp">
<LinearLayout
android:id="@+id/live_link_mic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@mipmap/live_more_icon_connect_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/live_link_mic_2"
android:textColor="#FF9A9A9A"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/effects_settings_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@mipmap/live_more_icon_special_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/effects_settings"
android:textColor="#FF9A9A9A"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/slide_settings_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@mipmap/live_more_icon_sliding_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/slide_settings"
android:textColor="#FF9A9A9A"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/float_settings_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@mipmap/live_more_icon_fenestrule_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/small_window"
android:textColor="#FF9A9A9A"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/system_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@mipmap/live_more_icon_hd" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/system_notice"
android:textColor="#FF9A9A9A"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/online"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@mipmap/live_more_icon_more" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/online_service"
android:textColor="#FF9A9A9A"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -10,9 +10,9 @@ ext {
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -33,6 +33,8 @@ import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils; import com.blankj.utilcode.util.GsonUtils;
import com.facebook.appevents.AppEventsLogger; import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.analytics.FirebaseAnalytics;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition;
import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.EasyFloat;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
@ -41,6 +43,7 @@ import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.CrashSaveBean; import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean;
@ -56,6 +59,7 @@ import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
@ -68,6 +72,7 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.CustomDrawerPopupView;
import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.common.views.weight.VerticalViewPager; import com.yunbao.common.views.weight.VerticalViewPager;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -81,7 +86,6 @@ import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveMicUserDialogFragment; import com.yunbao.live.dialog.LiveMicUserDialogFragment;
import com.yunbao.live.dialog.LiveTotalDialog; import com.yunbao.live.dialog.LiveTotalDialog;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
import com.yunbao.live.dialog.SidebarLiveAudience;
import com.yunbao.live.dialog.SignDialogFragment; import com.yunbao.live.dialog.SignDialogFragment;
import com.yunbao.live.event.LinkMicTxAccEvent; import com.yunbao.live.event.LinkMicTxAccEvent;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
@ -142,6 +146,7 @@ public class LiveAudienceActivity extends LiveActivity {
//直播间进入房间队列 //直播间进入房间队列
private Handler liveHandler = new Handler(); private Handler liveHandler = new Handler();
private ImageView voicePress; private ImageView voicePress;
private View titleLine;
@Override @Override
public <T extends View> T findViewById(@IdRes int id) { public <T extends View> T findViewById(@IdRes int id) {
@ -181,6 +186,7 @@ public class LiveAudienceActivity extends LiveActivity {
private void initView() { private void initView() {
// 竖直滑动 ViewPager // 竖直滑动 ViewPager
verticalViewPager = findViewById(R.id.view_pager); verticalViewPager = findViewById(R.id.view_pager);
titleLine = findViewById(R.id.title_line);
voicePress = findViewById(R.id.voice_press); voicePress = findViewById(R.id.voice_press);
verticalViewPager.setEnableScroll(IMLoginManager.get(mContext).isSlide()); verticalViewPager.setEnableScroll(IMLoginManager.get(mContext).isSlide());
//判断是否有直播悬浮窗有直接关闭 //判断是否有直播悬浮窗有直接关闭
@ -688,23 +694,51 @@ public class LiveAudienceActivity extends LiveActivity {
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
switch (event.getType()) { switch (event.getType()) {
case SIDEBAR: case SIDEBAR:
int userIndex = -1; // int userIndex = -1;
for (int i = 0; i < list.size(); i++) { // for (int i = 0; i < list.size(); i++) {
if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) { // if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) {
userIndex = i; // userIndex = i;
} // }
} // }
if (userIndex != -1) { // if (userIndex != -1) {
list.remove(userIndex); // list.remove(userIndex);
} // }
//从右边打开侧边栏 // //从右边打开侧边栏
SidebarLiveAudience sidebarLiveAudience = new SidebarLiveAudience(); // SidebarLiveAudience sidebarLiveAudience = new SidebarLiveAudience();
bundle.putString("Avatar", mLiveBean.getAvatar()); // bundle.putString("Avatar", mLiveBean.getAvatar());
bundle.putString("banner", GsonUtils.toJson(slideInfoModels)); // bundle.putString("banner", GsonUtils.toJson(slideInfoModels));
bundle.putString("list", GsonUtils.toJson(list)); // bundle.putString("list", GsonUtils.toJson(list));
bundle.putInt("LiveBg", liveBg); // bundle.putInt("LiveBg", liveBg);
sidebarLiveAudience.setArguments(bundle); // sidebarLiveAudience.setArguments(bundle);
sidebarLiveAudience.show(getSupportFragmentManager(), "SidebarLiveAudience"); // 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();
CustomDrawerPopupView drawerPopupView = new CustomDrawerPopupView(mContext);
new XPopup.Builder(mContext)
.hasShadowBg(false)
.isDestroyOnDismiss(true)
.isLightStatusBar(false)
.popupPosition(PopupPosition.Right)//右边
.hasStatusBarShadow(true) //启用状态栏阴影
.asCustom(drawerPopupView)
.show();
break; break;
case BOTTOM_COLLECTION: case BOTTOM_COLLECTION:
LiveTotalDialog liveTotalDialog = new LiveTotalDialog(); LiveTotalDialog liveTotalDialog = new LiveTotalDialog();
@ -1030,25 +1064,36 @@ public class LiveAudienceActivity extends LiveActivity {
private List<AnchorRecommendItemModel> list = new ArrayList<>(); private List<AnchorRecommendItemModel> list = new ArrayList<>();
private void getDrawer() { private void getDrawer() {
LiveNetManager.get(mContext)
//推荐位 .getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
MainNetManager.get(mContext)
.anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@Override @Override
public void onSuccess(AnchorRecommendModel anchorRecommendModel) { public void onSuccess(List<CustomSidebarInfoModel> data) {
list.clear();
slideInfoModels.clear();
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
models.add(0, new AnchorRecommendItemModel());
list.addAll(models);
slideInfoModels = anchorRecommendModel.getSlide();
} }
@Override @Override
public void onError(String error) { public void onError(String error) {
} }
}); });
// //推荐位
// MainNetManager.get(mContext)
// .anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
// @Override
// public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
// list.clear();
// slideInfoModels.clear();
// List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
//
// models.add(0, new AnchorRecommendItemModel());
// list.addAll(models);
// slideInfoModels = anchorRecommendModel.getSlide();
// }
//
// @Override
// public void onError(String error) {
// }
// });
} }
public void onFollowEvent(FollowEvent e) { public void onFollowEvent(FollowEvent e) {

View File

@ -299,6 +299,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
mBg.setBackground(null); mBg.setBackground(null);
mTextView.setText(bean.getContent()); mTextView.setText(bean.getContent());
} }
} else if (bean.getType() == LiveChatBean.SYSTEM2) {
mTextView.setTextColor(0xffffffff);
mBg.setBackground(null);
mTextView.setText(bean.getContent());
} else if (bean.getType() == -1) {//自动消息关注 } else if (bean.getType() == -1) {//自动消息关注
boolean isContains = false; boolean isContains = false;
for (LiveChatBean model : mList) { for (LiveChatBean model : mList) {

View File

@ -11,8 +11,9 @@ import com.yunbao.common.bean.MsgModel;
public class LiveChatBean { public class LiveChatBean {
public static final int NORMAL = 0; public final int NORMAL = 0;
public static final int SYSTEM = 1; public static final int SYSTEM = 1;
public static final int SYSTEM2 = 111;
public static final int GIFT = 2; public static final int GIFT = 2;
public static final int ENTER_ROOM = 3; public static final int ENTER_ROOM = 3;
public static final int LIGHT = 4; public static final int LIGHT = 4;
@ -22,6 +23,8 @@ public class LiveChatBean {
public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105; public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105;
public static final int LUCKY_ANGEL = 106;//幸运天使 public static final int LUCKY_ANGEL = 106;//幸运天使
private String id; private String id;
private String userNiceName; private String userNiceName;
private int level; private int level;

View File

@ -1,40 +1,19 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.view.Display;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.blankj.utilcode.util.GsonUtils;
import com.google.gson.reflect.TypeToken;
import com.ms.banner.Banner;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.SlideInBannerViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.adapter.SidebarAdapter; import com.yunbao.live.adapter.SidebarAdapter;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
@ -42,32 +21,18 @@ import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.views.LivePlayRyViewHolder; import com.yunbao.live.views.LivePlayRyViewHolder;
import com.yunbao.live.views.PortraitLiveManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.List;
/** /**
* 直播间侧边栏 * 直播间侧边栏
*/ */
public class SidebarLiveAudience extends AbsDialogFragment { public class SidebarLiveAudience extends AbsDialogFragment {
//侧边栏背景
private ImageView sidebarBack;
private View mask;
//侧边栏刷新列表
public CommonRefreshView sidebarList;
//侧边栏适配器 //侧边栏适配器
private SidebarAdapter sidebarAdapter; private SidebarAdapter sidebarAdapter;
private List<SlideInfoModel> slideInfoModels = new ArrayList<>();
private List<AnchorRecommendItemModel> list = new ArrayList<>();
private int index = 0;
private LinearLayout haveData, noDataLive;
private Banner mBanner;
private TextView inBatch;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
@ -84,176 +49,7 @@ public class SidebarLiveAudience extends AbsDialogFragment {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
Bundle bundle = getArguments(); Bundle bundle = getArguments();
sidebarBack = (ImageView) findViewById(R.id.sidebar_back);
haveData = (LinearLayout) findViewById(R.id.have_data);
noDataLive = (LinearLayout) findViewById(R.id.view_no_data_live);
//侧边栏轮播
mBanner = (Banner) findViewById(R.id.banner);
inBatch = (TextView) findViewById(R.id.in_batch);
mask = findViewById(R.id.mask);
if (bundle != null) {
String avatar = bundle.getString("Avatar");
int liveBg = bundle.getInt("LiveBg");
slideInfoModels = GsonUtils.fromJson(bundle.getString("banner"), new TypeToken<List<SlideInfoModel>>() {
}.getType());
list = GsonUtils.fromJson(bundle.getString("list"), new TypeToken<List<AnchorRecommendItemModel>>() {
}.getType());
//侧边栏背景
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);
}
}
sidebarList = (CommonRefreshView) findViewById(R.id.sidebarList);
sidebarList.setHeaderTextColor(Color.parseColor("#ffffff"));
GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 2, GridLayoutManager.VERTICAL, false);
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (position == 0) {
return 2;
}
return 1;
}
});
sidebarList.setLayoutManager(gridLayoutManager);
sidebarList.setEmptyLayoutId(R.layout.view_no_data_live);
sidebarList.setLoadMoreEnable(false);
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 6, 0);
decoration.setOnlySetItemOffsetsButNoDraw(true);
sidebarList.setItemDecoration(decoration);
Display mDisplay = getActivity().getWindowManager().getDefaultDisplay();
sidebarAdapter = new SidebarAdapter(mContext, mDisplay.getHeight());
sidebarAdapter.setHasStableIds(true);
sidebarList.setRecyclerViewAdapter(sidebarAdapter);
ViewClicksAntiShake.clicksAntiShake(inBatch, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
sidebarList.initData();
}
});
if (sidebarAdapter != null) {
if (list.size() == 1) {
haveData.setVisibility(View.GONE);
noDataLive.setVisibility(View.VISIBLE);
if (mBanner.isStart()) {
mBanner.update(slideInfoModels);
} else {
mBanner.setAutoPlay(true)
.setPages(slideInfoModels, new SlideInBannerViewHolder())
.setDelayTime(3000)
.setOnBannerClickListener((datas, p) -> {
if (p >= 0 && p < slideInfoModels.size()) {
SlideInfoModel bean = slideInfoModels.get(p);
if (bean != null) {
String link = bean.getSlideUrl();
if (link.contains("http")) {
WebViewActivity.forward(getContext(), link, true);
} else {
gotoLive(link);
}
}
}
}).start();
}
} else {
haveData.setVisibility(View.VISIBLE);
noDataLive.setVisibility(View.GONE);
sidebarAdapter.addData(list);
sidebarAdapter.setData(slideInfoModels);
}
}
sidebarList.setDataHelperNew(new CommonRefreshView.DataHelperNew() {
@Override
public void loadData(int p) {
}
@Override
public void refresh() {
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);
}
list.add(0, new AnchorRecommendItemModel());
if (list.size() == 1) {
haveData.setVisibility(View.GONE);
noDataLive.setVisibility(View.VISIBLE);
if (mBanner.isStart()) {
mBanner.update(slideInfoModels);
} else {
mBanner.setAutoPlay(true)
.setPages(slideInfoModels, new SlideInBannerViewHolder())
.setDelayTime(3000)
.setOnBannerClickListener((datas, p) -> {
if (p >= 0 && p < slideInfoModels.size()) {
SlideInfoModel bean = slideInfoModels.get(p);
if (bean != null) {
String link = bean.getSlideUrl();
if (link.contains("http")) {
WebViewActivity.forward(getContext(), link, true);
} else {
gotoLive(link);
}
}
}
}).start();
}
} else {
haveData.setVisibility(View.VISIBLE);
noDataLive.setVisibility(View.GONE);
sidebarAdapter.addData(list);
sidebarAdapter.setData(anchorRecommendModel.getSlide());
}
sidebarList.onFinish();
}
@Override
public void onError(String error) {
}
});
} else {
index = index + 1;
}
}
});
sidebarList.initData();
sidebarAdapter.setOnItemClickListener((bean, position) -> {
gotoLive(bean.getUid());
dismiss();
});
sidebarAdapter.setListener(new SidebarAdapter.SidebarListener() {
@Override
public void refresh() {
sidebarList.initData();
}
});
} }
@Override @Override

View File

@ -204,12 +204,12 @@ public class SocketRyClient {
} }
break; break;
case Constants.SOCKET_KICK://踢人 case Constants.SOCKET_KICK://踢人
systemChatMessage(map.getString("ct")); systemChatMessage2(map.getString("ct"));
mListener.onKick(map.getString("touid")); mListener.onKick(map.getString("touid"));
break; break;
case Constants.SOCKET_SHUT_UP://禁言 case Constants.SOCKET_SHUT_UP://禁言
String ct = map.getString("ct"); String ct = map.getString("ct");
systemChatMessage(ct); systemChatMessage2(ct);
mListener.onShutUp(map.getString("touid"), ct); mListener.onShutUp(map.getString("touid"), ct);
break; break;
case Constants.SOCKET_SEND_MSG://文字消息点亮用户进房间这种混乱的设计是因为服务器端逻辑就是这样设计的,客户端无法自行修改 case Constants.SOCKET_SEND_MSG://文字消息点亮用户进房间这种混乱的设计是因为服务器端逻辑就是这样设计的,客户端无法自行修改
@ -333,9 +333,12 @@ public class SocketRyClient {
mListener.addFakeFans(list); mListener.addFakeFans(list);
break; break;
case Constants.SOCKET_SET_ADMIN://设置或取消管理员 case Constants.SOCKET_SET_ADMIN://设置或取消管理员
systemChatMessage(map.getString("ct")); systemChatMessage2(map.getString("ct"));
mListener.onSetAdmin(map.getString("touid"), map.getIntValue("action")); mListener.onSetAdmin(map.getString("touid"), map.getIntValue("action"));
break; break;
case Constants.SUPER_VISION://设置或取消管理员
systemChatMessage2(map.getString("ct"));
break;
case Constants.SOCKET_BUY_GUARD://购买守护 case Constants.SOCKET_BUY_GUARD://购买守护
buyGuardInSameRoom(map); buyGuardInSameRoom(map);
break; break;
@ -858,6 +861,16 @@ public class SocketRyClient {
mListener.onChat(bean, 1); mListener.onChat(bean, 1);
} }
/**
* 接收到系统消息显示在聊天栏中
*/
private static void systemChatMessage2(String content) {
LiveChatBean bean = new LiveChatBean();
bean.setContent(content);
bean.setType(LiveChatBean.SYSTEM2);
mListener.onChat(bean, 1);
}
/** /**
* 处理观众与主播连麦逻辑 * 处理观众与主播连麦逻辑
*/ */

View File

@ -183,6 +183,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//标记是调用正常退出还是手动切后台 //标记是调用正常退出还是手动切后台
private boolean isQuitF = false; private boolean isQuitF = false;
//是否成功调用进入房间接口
private boolean isEnterRoom = false;
public PortraitLiveManager setQuitF(boolean quitF) { public PortraitLiveManager setQuitF(boolean quitF) {
isQuitF = quitF; isQuitF = quitF;
return this; return this;
@ -224,6 +227,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) { public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
isEnterRoom = false;
openParametersModel = new OpenParametersModel(); openParametersModel = new OpenParametersModel();
mContext.runOnUiThread(new Runnable() { mContext.runOnUiThread(new Runnable() {
@Override @Override
@ -1062,7 +1066,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
isEnterRoom = true;
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]); JSONObject obj = JSON.parseObject(info[0]);
mDanmuPrice = obj.getString("barrage_fee"); mDanmuPrice = obj.getString("barrage_fee");
@ -1418,7 +1422,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 退出直播间 * 退出直播间
*/ */
public void exitLiveRoom() { public void exitLiveRoom() {
if (mLiveBean == null) { if (mLiveBean == null && !isEnterRoom) {
return; return;
} }
RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() { RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() {

View File

@ -3,6 +3,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<View
android:id="@+id/title_line"
android:layout_width="match_parent"
android:layout_height="0.5dp" />
<com.yunbao.common.views.weight.VerticalViewPager <com.yunbao.common.views.weight.VerticalViewPager
android:id="@+id/view_pager" android:id="@+id/view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -13,9 +18,9 @@
android:id="@+id/voice_press" android:id="@+id/voice_press"
android:layout_width="64dp" android:layout_width="64dp"
android:layout_height="64dp" android:layout_height="64dp"
android:visibility="gone"
android:src="@mipmap/icon_voice_press"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginStart="54dp" /> android:layout_marginStart="54dp"
android:src="@mipmap/icon_voice_press"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,110 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="300dp"
android:layout_width="match_parent" android:background="@color/white"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView
android:id="@+id/sidebar_back"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<View
android:id="@+id/mask"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#90000000" />
<LinearLayout
android:id="@+id/have_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="8dp"
android:paddingEnd="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="26dp">
<com.yunbao.common.custom.CommonRefreshView
android:id="@+id/sidebarList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
</com.yunbao.common.custom.CommonRefreshView>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/view_no_data_live"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingStart="8dp"
android:paddingTop="26dp"
android:paddingEnd="8dp">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="4dp"
app:cardElevation="4dp">
<com.ms.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="77dp"
app:delay_time="3000"
app:indicator_drawable_selected="@drawable/bg_home_indicator_selected"
app:indicator_drawable_unselected="@drawable/bg_home_indicator_unselected"
app:indicator_height="8dp"
app:indicator_margin="6dp"
app:indicator_width="8dp" />
</androidx.cardview.widget.CardView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/recommended_for_you"
android:textColor="#FFF6F7FB"
android:textSize="14sp" />
<TextView
android:id="@+id/in_batch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="8dp"
android:drawableStart="@mipmap/icon_change"
android:drawablePadding="2dp"
android:text="@string/in_batch"
android:textColor="#FFF6F7FB"
android:textSize="10sp" />
</FrameLayout>
<ImageView
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_marginTop="194dp"
android:src="@mipmap/img_no_anchor" />
</LinearLayout>
</FrameLayout> </FrameLayout>