Merge branch 'dev_random_pk'
# Conflicts: # common/src/main/res/values/strings.xml # config.gradle # live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java # live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java # live/src/main/java/com/yunbao/live/socket/SocketRyClient.java
@ -83,6 +83,9 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Activity getTopActivity() {
|
||||||
|
return activityWeakReference.get();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext(Context base) {
|
||||||
@ -100,7 +103,7 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityStarted(Activity activity) {
|
public void onActivityStarted(Activity activity) {
|
||||||
mCount++;
|
mCount++;
|
||||||
activityWeakReference=new WeakReference<>(activity);
|
activityWeakReference = new WeakReference<>(activity);
|
||||||
if (!mFront) {
|
if (!mFront) {
|
||||||
mFront = true;
|
mFront = true;
|
||||||
L.e("AppContext------->处于前台");
|
L.e("AppContext------->处于前台");
|
||||||
|
@ -132,6 +132,7 @@ public class Constants {
|
|||||||
public static final int LIVE_FUNC_MIC = 2013;//語音
|
public static final int LIVE_FUNC_MIC = 2013;//語音
|
||||||
public static final int LIVE_FUNC_WKS = 2014;//語音
|
public static final int LIVE_FUNC_WKS = 2014;//語音
|
||||||
public static final int LIVE_FUNC_ZSLK = 2015;//語音
|
public static final int LIVE_FUNC_ZSLK = 2015;//語音
|
||||||
|
public static final int LIVE_FUNC_RANDOM_PK = 2016;//随机PK
|
||||||
|
|
||||||
//socket
|
//socket
|
||||||
public static final String SOCKET_CONN = "conn";
|
public static final String SOCKET_CONN = "conn";
|
||||||
@ -145,6 +146,7 @@ public class Constants {
|
|||||||
public static final String SOCKET_ALL_SERVER_NOTIFY = "AllServerNotify";//全服通知
|
public static final String SOCKET_ALL_SERVER_NOTIFY = "AllServerNotify";//全服通知
|
||||||
public static final String SOCKET_SEND_BARRAGE = "SendBarrage";//发弹幕
|
public static final String SOCKET_SEND_BARRAGE = "SendBarrage";//发弹幕
|
||||||
public static final String SOCKET_LIVE_DRPK = "LiveDRPK";//多人PK
|
public static final String SOCKET_LIVE_DRPK = "LiveDRPK";//多人PK
|
||||||
|
public static final String SOCKET_LIVE_DRPK_RANDOM = "LiveRandomPK";//多人PK
|
||||||
public static final String SOCKET_LEAVE_ROOM = "disconnect";//用户离开房间
|
public static final String SOCKET_LEAVE_ROOM = "disconnect";//用户离开房间
|
||||||
public static final String SOCKET_LIVE_END = "StartEndLive";//主播关闭直播
|
public static final String SOCKET_LIVE_END = "StartEndLive";//主播关闭直播
|
||||||
public static final String SOCKET_SYSTEM = "SystemNot";//系统消息
|
public static final String SOCKET_SYSTEM = "SystemNot";//系统消息
|
||||||
|
@ -73,7 +73,7 @@ public class WebViewActivity extends AbsActivity {
|
|||||||
|
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
params.topMargin = DpUtil.dp2px(1);
|
params.topMargin = DpUtil.dp2px(1);
|
||||||
// mWebView.setLayoutParams(params);
|
// mWebView.setLayoutParams(params);
|
||||||
//mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
//mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||||
mWebView.setWebViewClient(new WebViewClient() {
|
mWebView.setWebViewClient(new WebViewClient() {
|
||||||
@Override
|
@Override
|
||||||
@ -96,9 +96,11 @@ public class WebViewActivity extends AbsActivity {
|
|||||||
if (url.contains("for")) {
|
if (url.contains("for")) {
|
||||||
mWebView.loadUrl("javascript:goAnchorTab()");
|
mWebView.loadUrl("javascript:goAnchorTab()");
|
||||||
}
|
}
|
||||||
//屏幕高度-ft_title的paddingTop
|
//真实屏幕高度-(ft_title的高度+导航栏高度)
|
||||||
int height = DeviceUtils.getScreenHeight(mContext)-DpUtil.dp2px(24);
|
int height = DeviceUtils.getScreenRealHeight(mContext) - DpUtil.dp2px(72) - getCurrentNavigationBarHeight(mContext);
|
||||||
view.loadUrl("javascript:window.androidObject.setHeight("+height+",0,false)");
|
if (!navigationGestureEnabled(mContext)) {
|
||||||
|
view.loadUrl("javascript:window.androidObject.setHeight(" + height + ",0,false)");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
|
||||||
|
public class HttpCallbackModel extends BaseModel{
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机PK UserBean
|
||||||
|
*/
|
||||||
|
public class RandomPkUserBean extends UserBean {
|
||||||
|
@SerializedName("is_pk")
|
||||||
|
private int pk;
|
||||||
|
@SerializedName("isattention")
|
||||||
|
private String attention;
|
||||||
|
@SerializedName("user_nicename")
|
||||||
|
private String userNiceName;
|
||||||
|
|
||||||
|
public RandomPkUserBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPk() {
|
||||||
|
return pk==1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAttention() {
|
||||||
|
return attention.equals("1");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttention() {
|
||||||
|
return attention;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttention(String attention) {
|
||||||
|
this.attention = attention;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPk() {
|
||||||
|
return pk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPk(int pk) {
|
||||||
|
this.pk = pk;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUserNiceName() {
|
||||||
|
return userNiceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUserNiceName(String userNiceName) {
|
||||||
|
this.userNiceName = userNiceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RandomPkUserBean{" +
|
||||||
|
"pk=" + pk +
|
||||||
|
", attention='" + attention + '\'' +
|
||||||
|
", userNiceName='" + userNiceName + '\'' +
|
||||||
|
", id='" + id + '\'' +
|
||||||
|
", userNiceName='" + userNiceName + '\'' +
|
||||||
|
", avatar='" + avatar + '\'' +
|
||||||
|
", avatarThumb='" + avatarThumb + '\'' +
|
||||||
|
", sex=" + sex +
|
||||||
|
", signature='" + signature + '\'' +
|
||||||
|
", coin='" + coin + '\'' +
|
||||||
|
", gold='" + gold + '\'' +
|
||||||
|
", votes='" + votes + '\'' +
|
||||||
|
", consumption='" + consumption + '\'' +
|
||||||
|
", votestotal='" + votestotal + '\'' +
|
||||||
|
", province='" + province + '\'' +
|
||||||
|
", city='" + city + '\'' +
|
||||||
|
", location='" + location + '\'' +
|
||||||
|
", birthday='" + birthday + '\'' +
|
||||||
|
", level=" + level +
|
||||||
|
", levelAnchor=" + levelAnchor +
|
||||||
|
", lives=" + lives +
|
||||||
|
", follows=" + follows +
|
||||||
|
", fans=" + fans +
|
||||||
|
", vip=" + vip +
|
||||||
|
", liang=" + liang +
|
||||||
|
", car=" + car +
|
||||||
|
", medal_level=" + medal_level +
|
||||||
|
", medal_name='" + medal_name + '\'' +
|
||||||
|
", Dress=" + Dress +
|
||||||
|
", noble_id='" + noble_id + '\'' +
|
||||||
|
", yuanbao='" + yuanbao + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
128
common/src/main/java/com/yunbao/common/bean/RankPkInfoBean.java
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class RankPkInfoBean extends BaseModel {
|
||||||
|
private int id;
|
||||||
|
@SerializedName("start_time")
|
||||||
|
private String startTime;
|
||||||
|
@SerializedName("end_time")
|
||||||
|
private String endTime;
|
||||||
|
@SerializedName("pk_start_hour1")
|
||||||
|
private String pkStartHour1;
|
||||||
|
@SerializedName("pk_end_hour1")
|
||||||
|
private String pkEndHour1;
|
||||||
|
@SerializedName("pk_start_hour2")
|
||||||
|
private String pkStartHour2;
|
||||||
|
@SerializedName("pk_end_hour2")
|
||||||
|
private String pkEndHour2;
|
||||||
|
|
||||||
|
public RankPkInfoBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(String startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkStartHour1() {
|
||||||
|
return pkStartHour1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkStartHour1(String pkStartHour1) {
|
||||||
|
this.pkStartHour1 = pkStartHour1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkEndHour1() {
|
||||||
|
return pkEndHour1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkEndHour1(String pkEndHour1) {
|
||||||
|
this.pkEndHour1 = pkEndHour1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkStartHour2() {
|
||||||
|
return pkStartHour2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkStartHour2(String pkStartHour2) {
|
||||||
|
this.pkStartHour2 = pkStartHour2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkEndHour2() {
|
||||||
|
return pkEndHour2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkEndHour2(String pkEndHour2) {
|
||||||
|
this.pkEndHour2 = pkEndHour2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否在排位赛时间范围内
|
||||||
|
*/
|
||||||
|
public boolean isRankPKTime() {
|
||||||
|
try {
|
||||||
|
Date now =new Date();
|
||||||
|
Date startDate = simpleDateToDate(startTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date endDate = simpleDateToDate(endTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
if (startDate == null || endDate == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Calendar calendarStart = Calendar.getInstance(Locale.CHINA);
|
||||||
|
Calendar calendarEnd = Calendar.getInstance(Locale.CHINA);
|
||||||
|
Calendar calendarNow = Calendar.getInstance(Locale.CHINA);
|
||||||
|
calendarNow.setTime(now);
|
||||||
|
calendarStart.setTime(startDate);
|
||||||
|
calendarEnd.setTime(endDate);
|
||||||
|
if (calendarStart.before(calendarNow) && calendarEnd.after(calendarNow)) {
|
||||||
|
calendarNow.setTime(simpleDateToDate(dateToSimpleDate(now,"HH:mm:ss"),"HH:mm:ss"));
|
||||||
|
calendarStart.setTime(simpleDateToDate(pkStartHour1, "HH:mm:ss"));
|
||||||
|
calendarEnd.setTime(simpleDateToDate(pkEndHour1, "HH:mm:ss"));
|
||||||
|
if (calendarStart.before(calendarNow) && calendarEnd.after(calendarNow)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
calendarNow.setTime(simpleDateToDate(dateToSimpleDate(now,"HH:mm:ss"),"HH:mm:ss"));
|
||||||
|
calendarStart.setTime(simpleDateToDate(pkStartHour2, "HH:mm:ss"));
|
||||||
|
calendarEnd.setTime(simpleDateToDate(pkEndHour2, "HH:mm:ss"));
|
||||||
|
return calendarStart.before(calendarNow) && calendarEnd.after(calendarNow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Date simpleDateToDate(String time, String pattern) throws ParseException {
|
||||||
|
return new SimpleDateFormat(pattern, Locale.CHINA).parse(time);
|
||||||
|
}
|
||||||
|
private String dateToSimpleDate(Date date,String pattern){
|
||||||
|
return new SimpleDateFormat(pattern,Locale.CHINA).format(date);
|
||||||
|
}
|
||||||
|
}
|
@ -61,6 +61,26 @@ public class UserBean implements Parcelable {
|
|||||||
private int praise;
|
private int praise;
|
||||||
//是否隐藏
|
//是否隐藏
|
||||||
private boolean isHide = false;
|
private boolean isHide = false;
|
||||||
|
//是否为随机PK,仅在主播PK时使用
|
||||||
|
private boolean randomPk;
|
||||||
|
//随机天梯排位赛PK img,仅在主播PK时使用
|
||||||
|
private String mRankPkImgUrl;
|
||||||
|
|
||||||
|
public boolean isRandomPk() {
|
||||||
|
return randomPk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRandomPk(boolean randomPk) {
|
||||||
|
this.randomPk = randomPk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRankPkImgUrl() {
|
||||||
|
return mRankPkImgUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRankPkImgUrl(String mRankPkImgUrl) {
|
||||||
|
this.mRankPkImgUrl = mRankPkImgUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isHide() {
|
public boolean isHide() {
|
||||||
return isHide;
|
return isHide;
|
||||||
|
@ -9,6 +9,7 @@ import com.yunbao.common.bean.CustomSidebarInfoModel;
|
|||||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||||
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.HttpCallbackModel;
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||||
import com.yunbao.common.bean.LiveInfoModel;
|
import com.yunbao.common.bean.LiveInfoModel;
|
||||||
@ -18,6 +19,8 @@ import com.yunbao.common.bean.NewPeopleInfo;
|
|||||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||||
import com.yunbao.common.bean.PkRankBean;
|
import com.yunbao.common.bean.PkRankBean;
|
||||||
|
import com.yunbao.common.bean.RandomPkUserBean;
|
||||||
|
import com.yunbao.common.bean.RankPkInfoBean;
|
||||||
import com.yunbao.common.bean.SearchModel;
|
import com.yunbao.common.bean.SearchModel;
|
||||||
import com.yunbao.common.bean.SetAttentsModel;
|
import com.yunbao.common.bean.SetAttentsModel;
|
||||||
import com.yunbao.common.bean.SlideInBannerModel;
|
import com.yunbao.common.bean.SlideInBannerModel;
|
||||||
@ -177,7 +180,7 @@ public interface PDLiveApi {
|
|||||||
* 获取多人连麦列表
|
* 获取多人连麦列表
|
||||||
*/
|
*/
|
||||||
@GET("/api/public/?service=live.getDrLm")
|
@GET("/api/public/?service=live.getDrLm")
|
||||||
Observable<ResponseModel<List<LinkMicUserBeanV2>>> getDrLm(@Query("uid")String uid);
|
Observable<ResponseModel<List<LinkMicUserBeanV2>>> getDrLm(@Query("uid") String uid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取日榜、周榜数据
|
* 获取日榜、周榜数据
|
||||||
@ -286,8 +289,9 @@ public interface PDLiveApi {
|
|||||||
Observable<ResponseModel<BaseModel>> delDrLm();
|
Observable<ResponseModel<BaseModel>> delDrLm();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多人连麦-踢出用户
|
* 多人连麦-踢出用户
|
||||||
* @param uid 对方uid
|
*
|
||||||
|
* @param uid 对方uid
|
||||||
* @param roomId 当前房间号
|
* @param roomId 当前房间号
|
||||||
*/
|
*/
|
||||||
@GET("/api/public/?service=Live.killDrLm")
|
@GET("/api/public/?service=Live.killDrLm")
|
||||||
@ -338,4 +342,56 @@ public interface PDLiveApi {
|
|||||||
@Query("GroupId") String GroupId,
|
@Query("GroupId") String GroupId,
|
||||||
@Query("stream") String stream
|
@Query("stream") String stream
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机PK开关
|
||||||
|
*
|
||||||
|
* @return 1=开,0=关
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livepk.getRandomPKType")
|
||||||
|
Observable<ResponseModel<List<Integer>>> getRandomPkSwitch();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置随机PK开关
|
||||||
|
* @param pk 1=开,0=关
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livepk.setRandomPKType")
|
||||||
|
Observable<ResponseModel<List<BaseModel>>> changeRandomPkSwitch(@Query("random_pk") int pk);
|
||||||
|
/**
|
||||||
|
* 获取随机PK次数
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livepk.getRandomPKType")
|
||||||
|
Observable<ResponseModel<Integer>> getRandomPkNumber();
|
||||||
|
/**
|
||||||
|
* 发起随机PK
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livepk.setRandomPK")
|
||||||
|
Observable<ResponseModel<String>> randomPK();
|
||||||
|
/**
|
||||||
|
* 随机PK后调用接口给后台记录
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livepk.startRandomPK")
|
||||||
|
Observable<ResponseModel<BaseModel>> startRandomPK(@Query("pkuid")String pkuid);
|
||||||
|
/**
|
||||||
|
* 自由PK开始后调用接口扣掉次数
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livepk.setActivePkNum")
|
||||||
|
Observable<ResponseModel<BaseModel>> setRandomPkNum();
|
||||||
|
/**
|
||||||
|
* 随机PK搜索用户
|
||||||
|
* @param cs 简体关键字/uid
|
||||||
|
* @param ct 繁体关键字/uid
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livepk.searchUser")
|
||||||
|
Observable<ResponseModel<List<RandomPkUserBean>>> randomPkSearchUser(@Query("jian_key")String cs,@Query("fan_key")String ct);
|
||||||
|
/**
|
||||||
|
* 拒绝随机PK
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livepk.setBanRandomPK")
|
||||||
|
Observable<ResponseModel<BaseModel>> setBanRandomPK();
|
||||||
|
/**
|
||||||
|
* 拒绝随机PK
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Ranking.getRankingInfo")
|
||||||
|
Observable<ResponseModel<RankPkInfoBean>> getRankingInfo();
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.bean.ActiveModel;
|
import com.yunbao.common.bean.ActiveModel;
|
||||||
@ -11,6 +12,7 @@ import com.yunbao.common.bean.BaseModel;
|
|||||||
import com.yunbao.common.bean.CheckLiveModel;
|
import com.yunbao.common.bean.CheckLiveModel;
|
||||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||||
|
import com.yunbao.common.bean.HttpCallbackModel;
|
||||||
import com.yunbao.common.bean.LinkMicUserBean;
|
import com.yunbao.common.bean.LinkMicUserBean;
|
||||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||||
import com.yunbao.common.bean.LiveInfoModel;
|
import com.yunbao.common.bean.LiveInfoModel;
|
||||||
@ -18,6 +20,8 @@ import com.yunbao.common.bean.LiveRoomActivityBanner;
|
|||||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||||
import com.yunbao.common.bean.PkRankBean;
|
import com.yunbao.common.bean.PkRankBean;
|
||||||
|
import com.yunbao.common.bean.RandomPkUserBean;
|
||||||
|
import com.yunbao.common.bean.RankPkInfoBean;
|
||||||
import com.yunbao.common.bean.SetAttentsModel;
|
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;
|
||||||
@ -484,6 +488,9 @@ public class LiveNetManager {
|
|||||||
|
|
||||||
private Disposable randomPkApi;
|
private Disposable randomPkApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PK排位赛接口
|
||||||
|
*/
|
||||||
public void getRandomPk(String mLiveUid, String pkUid, HttpCallback<PkRankBean> callback) {
|
public void getRandomPk(String mLiveUid, String pkUid, HttpCallback<PkRankBean> callback) {
|
||||||
randomPkApi = API.get().pdLiveApi(mContext)
|
randomPkApi = API.get().pdLiveApi(mContext)
|
||||||
.getPkRanksList(mLiveUid, pkUid)
|
.getPkRanksList(mLiveUid, pkUid)
|
||||||
@ -501,6 +508,246 @@ public class LiveNetManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机PK开关
|
||||||
|
* 1=开,0=关
|
||||||
|
*/
|
||||||
|
public void getRandomPkSwitch(HttpCallback<Integer> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getRandomPkSwitch()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(listResponseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(listResponseModel.getData().getInfo().get(0));
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置随机PK开关
|
||||||
|
*
|
||||||
|
* @param pk 1=开,0=关
|
||||||
|
* @param callback @{@link HttpCallbackModel#getCode()} 0=成功
|
||||||
|
*/
|
||||||
|
public void changeRandomPkSwitch(int pk, HttpCallback<HttpCallbackModel> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.changeRandomPkSwitch(pk)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<List<BaseModel>> responseModel) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
HttpCallbackModel model = new HttpCallbackModel();
|
||||||
|
model.setCode(responseModel.getData().getCode());
|
||||||
|
model.setMsg(responseModel.getData().getMsg());
|
||||||
|
callback.onSuccess(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机PK次数
|
||||||
|
*/
|
||||||
|
public void getRandomPkNumber(HttpCallback<Integer> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getRandomPkNumber()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Consumer<ResponseModel<Integer>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<Integer> responseModel) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(responseModel.getData().getInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起随机PK
|
||||||
|
*/
|
||||||
|
public void randomPK(HttpCallback<String> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.randomPK()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Consumer<ResponseModel<String>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<String> responseModel) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
if(CommonAppConfig.getInstance().getUid().equals("98196")) {
|
||||||
|
callback.onSuccess("98274");
|
||||||
|
}else{
|
||||||
|
callback.onSuccess("98196");
|
||||||
|
}
|
||||||
|
// callback.onSuccess(responseModel.getData().getInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自由PK开始后调用接口扣掉次数
|
||||||
|
*/
|
||||||
|
public void setRandomPkNum(HttpCallback<HttpCallbackModel> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.setRandomPkNum()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<BaseModel> responseModel) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机PK后调用接口给后台记录
|
||||||
|
*/
|
||||||
|
public void startRandomPK(String pkuid, HttpCallback<Boolean> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.startRandomPK(pkuid)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<BaseModel> responseModel) throws Exception {
|
||||||
|
if (responseModel.getData().getCode() == 0) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback.onSuccess(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机PK后调用接口给后台记录
|
||||||
|
*
|
||||||
|
* @param cs 简体关键字/uid
|
||||||
|
* @param ct 繁体关键字/uid
|
||||||
|
*/
|
||||||
|
public void randomPkSearchUser(String cs, String ct, HttpCallback<List<RandomPkUserBean>> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.randomPkSearchUser(cs, ct)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Consumer<ResponseModel<List<RandomPkUserBean>>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<List<RandomPkUserBean>> responseModel) throws Exception {
|
||||||
|
if (responseModel.getData().getCode() == 0) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(responseModel.getData().getInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拒绝随机PK
|
||||||
|
*/
|
||||||
|
public void setBanRandomPK(HttpCallback<HttpCallbackModel> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.setBanRandomPK()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<BaseModel> responseModel) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机排位赛信息
|
||||||
|
*/
|
||||||
|
public void getRankPkInfoBean(HttpCallback<RankPkInfoBean> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getRankingInfo()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Consumer<ResponseModel<RankPkInfoBean>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<RankPkInfoBean> rankPkInfoBeanResponseModel) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(rankPkInfoBeanResponseModel.getData().getInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(throwable.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直播间取消网络请求
|
* 直播间取消网络请求
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.yunbao.common.manager;
|
||||||
|
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
|
||||||
|
import cn.rongcloud.rtc.api.RCRTCRoom;
|
||||||
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||||
|
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RTC管理类,负责管理申请、同意、拒绝PK
|
||||||
|
*/
|
||||||
|
public class IMRTCManager {
|
||||||
|
private static IMRTCManager manager;
|
||||||
|
private RCRTCRoom rtcRoom;
|
||||||
|
|
||||||
|
private IMRTCManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IMRTCManager getInstance() {
|
||||||
|
if (manager == null) {
|
||||||
|
manager = new IMRTCManager();
|
||||||
|
}
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtcRoom(RCRTCRoom rtcRoom) {
|
||||||
|
this.rtcRoom = rtcRoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应PK请求
|
||||||
|
* @param liveUid 对方房间号
|
||||||
|
* @param agree 是否同意
|
||||||
|
* @param extra 扩展参数
|
||||||
|
* @param callback 回调
|
||||||
|
*/
|
||||||
|
public void responseJoinOtherRoom(String liveUid, boolean agree, String extra, IRCRTCResultCallback callback) {
|
||||||
|
if (rtcRoom != null) {
|
||||||
|
/*
|
||||||
|
inviterRoomId - 邀请者所在房间 id,
|
||||||
|
inviterUserId - 邀请者用户 id
|
||||||
|
agree - 被邀请者是否同意连麦邀请
|
||||||
|
inviteeAutoMix - 是否将被邀请者音视频资源发送到邀请人房间中合流
|
||||||
|
1:inviteeAutoMix 为true时:
|
||||||
|
1.1:如果邀请方在发送连麦请求之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把邀请方流资源合并到被邀请方视图(默认仅悬浮布局合流)上。
|
||||||
|
1.2:如果邀请方在发送连麦请求之前没有发布资源,将会在邀请方发布资源成功后,服务器才会把邀请方的资源合并到被邀请方视图(默认仅悬浮布局合流)上。
|
||||||
|
2: 无论为true或false,双方都可以使用RCRTCLiveInfo.setMixConfig(RCRTCMixConfig, IRCRTCResultCallback) 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||||
|
extra - 扩展字段,默认为空
|
||||||
|
*/
|
||||||
|
rtcRoom.getLocalUser().responseJoinOtherRoom(liveUid, liveUid, agree, agree, extra, callback);
|
||||||
|
} else {
|
||||||
|
callback.onFailed(RTCErrorCode.RongRTCCodeIMError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请PK
|
||||||
|
* @param liveUid 对方房间号
|
||||||
|
* @param inviterAutoMix 是否将邀请者音视频资源发送到被邀请人房间中合流
|
||||||
|
* @param extra 扩展参数
|
||||||
|
* @param callback 回调
|
||||||
|
*/
|
||||||
|
public void requestJoinOtherRoom(String liveUid,boolean inviterAutoMix,String extra,IRCRTCResultCallback callback){
|
||||||
|
if(rtcRoom!=null){
|
||||||
|
/*
|
||||||
|
inviteeRoomId - 被邀请者所在房间 id
|
||||||
|
inviteeUserId - 被邀请用户 id
|
||||||
|
inviterAutoMix - 是否将邀请者音视频资源发送到被邀请人房间中合流
|
||||||
|
1: inviterAutoMix为true时:
|
||||||
|
1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。
|
||||||
|
1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。
|
||||||
|
2:无论为true或false,双方都可以使用RCRTCLiveInfo.setMixConfig(RCRTCMixConfig, IRCRTCResultCallback) 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||||
|
extra - 扩展字段,默认为空
|
||||||
|
*/
|
||||||
|
rtcRoom.getLocalUser().requestJoinOtherRoom(liveUid, liveUid, inviterAutoMix, extra, new IRCRTCResultCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
callback.onSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(RTCErrorCode errorCode) {
|
||||||
|
callback.onFailed(errorCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
callback.onFailed(RTCErrorCode.RongRTCCodeIMError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,403 @@
|
|||||||
|
package com.yunbao.common.manager;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
|
||||||
|
import com.yunbao.common.CommonAppContext;
|
||||||
|
import com.yunbao.common.bean.RankPkInfoBean;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机PK管理类
|
||||||
|
*/
|
||||||
|
public class RandomPkManager {
|
||||||
|
public final static int PK_STATUS_DEFAULT = -1;//默认状态,一般为为开始匹配
|
||||||
|
public final static int PK_STATUS_REQUEST = 0;//已发出匹配请求
|
||||||
|
public final static int PK_STATUS_START = 1;//匹配到用户
|
||||||
|
public final static int PK_STATUS_CLOSE = 2;//PK结束
|
||||||
|
public final static int PK_STATUS_REFUSE = 3;//对方拒绝
|
||||||
|
public final static int PK_STATUS_EXIT_ING = 4;//退出匹配中
|
||||||
|
|
||||||
|
private static RandomPkManager manager;
|
||||||
|
private int min = -1;//匹配计时器 分钟
|
||||||
|
private int sec = -1;//匹配计时器 秒钟
|
||||||
|
private int status = PK_STATUS_DEFAULT;
|
||||||
|
private Timer timer;
|
||||||
|
private TimerTask task;
|
||||||
|
private final List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();//监听器集合
|
||||||
|
private String pkUid;//对方房间ID
|
||||||
|
private RankPkInfoBean rankPkInfoBean;//排位赛信息
|
||||||
|
Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
|
private RandomPkManager() {
|
||||||
|
getRankInfo();
|
||||||
|
initTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RandomPkManager getInstance() {
|
||||||
|
if (manager == null) {
|
||||||
|
manager = new RandomPkManager();
|
||||||
|
}
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加监听器
|
||||||
|
*/
|
||||||
|
public void addOnRandomPkTimer(OnRandomPkTimer randomPkTimer) {
|
||||||
|
if (randomPkTimer != null) {
|
||||||
|
this.randomPkTimer.add(randomPkTimer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除监听器
|
||||||
|
*/
|
||||||
|
public void unregisterOnRandomPkTimer(OnRandomPkTimer randomPkTimer) {
|
||||||
|
if (randomPkTimer != null) {
|
||||||
|
this.randomPkTimer.remove(randomPkTimer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化参数
|
||||||
|
*/
|
||||||
|
private void initVal() {
|
||||||
|
min = -1;
|
||||||
|
sec = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化任务
|
||||||
|
*/
|
||||||
|
private void initTask() {
|
||||||
|
if (task != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
task = new TimerTask() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
status = PK_STATUS_REQUEST;
|
||||||
|
sec++;
|
||||||
|
if (sec % 60 == 0) {
|
||||||
|
min++;
|
||||||
|
sec = 0;
|
||||||
|
}
|
||||||
|
handler.post(() -> {
|
||||||
|
for (OnRandomPkTimer onRandomPkTimer : randomPkTimer) {
|
||||||
|
onRandomPkTimer.onTimer(String.format(Locale.CHINA, "%02d:%02d", min, sec));
|
||||||
|
}
|
||||||
|
if (sec == 2) {
|
||||||
|
nextPk();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化匹配时间
|
||||||
|
*/
|
||||||
|
public String getTimer() {
|
||||||
|
return String.format(Locale.CHINA, "%02d:%02d", min, sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对方拒绝,开始下一轮匹配
|
||||||
|
*/
|
||||||
|
private void nextPk() {
|
||||||
|
if (status != PK_STATUS_REQUEST && status != PK_STATUS_REFUSE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||||
|
.randomPK(new HttpCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String data) {
|
||||||
|
pkUid = data;
|
||||||
|
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||||
|
pkTimer.onStartPK(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为排位赛模式
|
||||||
|
*/
|
||||||
|
public boolean isRankModel() {
|
||||||
|
return rankPkInfoBean != null && rankPkInfoBean.isRankPKTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始匹配
|
||||||
|
*/
|
||||||
|
public boolean start() {
|
||||||
|
if (status == PK_STATUS_START) {
|
||||||
|
ToastUtil.show("PK中");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (status == PK_STATUS_EXIT_ING) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (task != null) {
|
||||||
|
task.cancel();
|
||||||
|
}
|
||||||
|
task = null;
|
||||||
|
initTask();
|
||||||
|
initVal();
|
||||||
|
timer = new Timer();
|
||||||
|
timer.schedule(task, 0, 1000);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
private void getRankInfo(){
|
||||||
|
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||||
|
.getRankPkInfoBean(new HttpCallback<RankPkInfoBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(RankPkInfoBean data) {
|
||||||
|
rankPkInfoBean = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知所有监听者,开始退出匹配
|
||||||
|
*/
|
||||||
|
private void callEndPkStart() {
|
||||||
|
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||||
|
pkTimer.onPkEndStart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知所有监听者,退出匹配倒计时
|
||||||
|
*/
|
||||||
|
private void callEndPkTimer(String time) {
|
||||||
|
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||||
|
pkTimer.onPkEndTimer(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知所有监听者,退出匹配成功
|
||||||
|
*/
|
||||||
|
private void callEndPkSuccess() {
|
||||||
|
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||||
|
pkTimer.onPkEndSuccess();
|
||||||
|
}
|
||||||
|
status = PK_STATUS_DEFAULT;
|
||||||
|
rankPkInfoBean = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int exitTimer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出匹配
|
||||||
|
*/
|
||||||
|
public void exitPk() {
|
||||||
|
if (status == PK_STATUS_EXIT_ING) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
callEndPkStart();
|
||||||
|
status = PK_STATUS_EXIT_ING;
|
||||||
|
exitTimer = 11;
|
||||||
|
new Timer().schedule(new TimerTask() {
|
||||||
|
|
||||||
|
Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
handler.post(() -> {
|
||||||
|
exitTimer--;
|
||||||
|
callEndPkTimer(exitTimer + "");
|
||||||
|
if (exitTimer == 0) {
|
||||||
|
end();
|
||||||
|
callEndPkSuccess();
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 0, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出连麦
|
||||||
|
*/
|
||||||
|
public void end() {
|
||||||
|
if (task != null) {
|
||||||
|
task.cancel();
|
||||||
|
}
|
||||||
|
task = null;
|
||||||
|
status = PK_STATUS_DEFAULT;
|
||||||
|
pkUid = null;
|
||||||
|
callEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否正在匹配中
|
||||||
|
*/
|
||||||
|
public boolean isRequestPk() {
|
||||||
|
return status == PK_STATUS_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知所有监听者,结束匹配
|
||||||
|
*/
|
||||||
|
private void callEnd() {
|
||||||
|
if (task != null) {
|
||||||
|
task.cancel();
|
||||||
|
task = null;
|
||||||
|
}
|
||||||
|
handler.post(() -> {
|
||||||
|
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||||
|
pkTimer.onPkEnd();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知所有监听者,开始匹配
|
||||||
|
*/
|
||||||
|
private void callStart() {
|
||||||
|
if (task != null) {
|
||||||
|
task.cancel();
|
||||||
|
task = null;
|
||||||
|
}
|
||||||
|
handler.post(() -> {
|
||||||
|
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||||
|
pkTimer.onPking();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||||
|
.startRandomPK(pkUid, new HttpCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知所有监听者,对方拒绝PK
|
||||||
|
*/
|
||||||
|
private void callRefuse() {
|
||||||
|
handler.post(() -> {
|
||||||
|
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||||
|
pkTimer.onRefuse();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置PK状态
|
||||||
|
*/
|
||||||
|
public void setPkStatus(int status) {
|
||||||
|
if (this.status == PK_STATUS_DEFAULT || this.status == PK_STATUS_EXIT_ING) {//默认状态下不响应随机PK接口
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.status = status;
|
||||||
|
switch (status) {
|
||||||
|
case PK_STATUS_START:
|
||||||
|
callStart();
|
||||||
|
break;
|
||||||
|
case PK_STATUS_CLOSE:
|
||||||
|
callEnd();
|
||||||
|
break;
|
||||||
|
case PK_STATUS_REFUSE:
|
||||||
|
//callRefuse();
|
||||||
|
nextPk();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否正在退出匹配中
|
||||||
|
*/
|
||||||
|
public boolean isExiting() {
|
||||||
|
return status == PK_STATUS_EXIT_ING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取退出匹配倒计时
|
||||||
|
*/
|
||||||
|
public String getExitTimer() {
|
||||||
|
return exitTimer + "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static abstract class OnRandomPkTimer {
|
||||||
|
/**
|
||||||
|
* 匹配倒计时
|
||||||
|
*/
|
||||||
|
public void onTimer(String time) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匹配到对方
|
||||||
|
* @param pkUid 对方uid
|
||||||
|
*/
|
||||||
|
public void onStartPK(String pkUid) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匹配中
|
||||||
|
*/
|
||||||
|
public void onPking() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连麦结束
|
||||||
|
*/
|
||||||
|
public void onPkEnd() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对方拒绝PK
|
||||||
|
*/
|
||||||
|
public void onRefuse() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出匹配倒计时
|
||||||
|
*/
|
||||||
|
public void onPkEndTimer(String time) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始退出匹配
|
||||||
|
*/
|
||||||
|
public void onPkEndStart() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出匹配成功
|
||||||
|
*/
|
||||||
|
public void onPkEndSuccess() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,8 +5,10 @@ import android.app.ActivityManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.Point;
|
||||||
import android.text.format.Formatter;
|
import android.text.format.Formatter;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备通用类
|
* 设备通用类
|
||||||
@ -36,6 +38,19 @@ public class DeviceUtils {
|
|||||||
return displayMetrics.heightPixels;
|
return displayMetrics.heightPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取屏幕真实高度
|
||||||
|
*
|
||||||
|
* @param activity activity
|
||||||
|
* @return 屏幕高度
|
||||||
|
*/
|
||||||
|
public static int getScreenRealHeight(Activity activity) {
|
||||||
|
WindowManager service = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
Point point = new Point();
|
||||||
|
service.getDefaultDisplay().getRealSize(point);
|
||||||
|
return point.y;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
|
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
|
||||||
*
|
*
|
||||||
@ -63,7 +78,7 @@ public class DeviceUtils {
|
|||||||
public static String getVersionName(Context context) {
|
public static String getVersionName(Context context) {
|
||||||
try {
|
try {
|
||||||
PackageManager manager = context.getPackageManager();
|
PackageManager manager = context.getPackageManager();
|
||||||
PackageInfo info = manager.getPackageInfo(context.getPackageName(),0);
|
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
|
||||||
return info.versionName;
|
return info.versionName;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -81,6 +96,7 @@ public class DeviceUtils {
|
|||||||
am.getMemoryInfo(mi);
|
am.getMemoryInfo(mi);
|
||||||
return mi.lowMemory;
|
return mi.lowMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMemory(Context context) {
|
public static String getMemory(Context context) {
|
||||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
||||||
|
@ -3,8 +3,10 @@ package com.yunbao.common.utils;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
@ -322,7 +324,9 @@ public class DialogUitl {
|
|||||||
private int mLength;
|
private int mLength;
|
||||||
private SimpleCallback mClickCallback;
|
private SimpleCallback mClickCallback;
|
||||||
private SimpleCallback3 mClickCallback3;
|
private SimpleCallback3 mClickCallback3;
|
||||||
|
private SimpleCallbackView mSimpleCallbackView;
|
||||||
private int mView = 0;
|
private int mView = 0;
|
||||||
|
private CharSequence mSpanned;
|
||||||
|
|
||||||
public Builder(Context context) {
|
public Builder(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@ -335,6 +339,18 @@ public class DialogUitl {
|
|||||||
|
|
||||||
public Builder setContent(String content) {
|
public Builder setContent(String content) {
|
||||||
mContent = content;
|
mContent = content;
|
||||||
|
this.mSpanned = null;//设置文本则不是使用HTML代码
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setHtmlCode(CharSequence mSpanned) {
|
||||||
|
this.mSpanned = mSpanned;
|
||||||
|
this.mContent = null;//设置HTML代码则不使用文本
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setSimpleCallbackView(SimpleCallbackView mSimpleCallbackView) {
|
||||||
|
this.mSimpleCallbackView = mSimpleCallbackView;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,6 +429,9 @@ public class DialogUitl {
|
|||||||
if (!TextUtils.isEmpty(mContent)) {
|
if (!TextUtils.isEmpty(mContent)) {
|
||||||
content.setText(mContent);
|
content.setText(mContent);
|
||||||
}
|
}
|
||||||
|
if (mSpanned != null) {
|
||||||
|
content.setText(mSpanned);
|
||||||
|
}
|
||||||
if (mInputType == INPUT_TYPE_NUMBER) {
|
if (mInputType == INPUT_TYPE_NUMBER) {
|
||||||
content.setInputType(InputType.TYPE_CLASS_NUMBER);
|
content.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
} else if (mInputType == INPUT_TYPE_NUMBER_PASSWORD) {
|
} else if (mInputType == INPUT_TYPE_NUMBER_PASSWORD) {
|
||||||
@ -443,23 +462,33 @@ public class DialogUitl {
|
|||||||
mClickCallback.onConfirmClick(dialog, "");
|
mClickCallback.onConfirmClick(dialog, "");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dialog.dismiss();
|
|
||||||
if (mClickCallback3 != null) {
|
if (mClickCallback3 != null) {
|
||||||
mClickCallback3.onConfirmClick(dialog);
|
mClickCallback3.onConfirmClick(dialog);
|
||||||
}
|
}
|
||||||
|
if (mSimpleCallbackView != null) {
|
||||||
|
mSimpleCallbackView.onConfirmClick(dialog,titleView, content, btnConfirm, btnCancel);
|
||||||
|
}else{
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dialog.dismiss();
|
|
||||||
if (mClickCallback3 != null) {
|
if (mClickCallback3 != null) {
|
||||||
mClickCallback3.onCancel();
|
mClickCallback3.onCancel();
|
||||||
|
dialog.dismiss();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (mClickCallback instanceof SimpleCallback2) {
|
if (mClickCallback instanceof SimpleCallback2) {
|
||||||
((SimpleCallback2) mClickCallback).onCancelClick();
|
((SimpleCallback2) mClickCallback).onCancelClick();
|
||||||
}
|
}
|
||||||
|
if (mSimpleCallbackView != null) {
|
||||||
|
mSimpleCallbackView.onCancel(dialog,titleView, content, btnConfirm, btnCancel);
|
||||||
|
}else{
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -467,6 +496,14 @@ public class DialogUitl {
|
|||||||
};
|
};
|
||||||
btnConfirm.setOnClickListener(listener);
|
btnConfirm.setOnClickListener(listener);
|
||||||
btnCancel.setOnClickListener(listener);
|
btnCancel.setOnClickListener(listener);
|
||||||
|
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||||
|
@Override
|
||||||
|
public void onShow(DialogInterface dialogInterface) {
|
||||||
|
if (mSimpleCallbackView != null) {
|
||||||
|
mSimpleCallbackView.onShow(dialog,titleView, content, btnConfirm, btnCancel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,6 +531,14 @@ public class DialogUitl {
|
|||||||
void onCancel();
|
void onCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface SimpleCallbackView {
|
||||||
|
void onShow(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn);
|
||||||
|
|
||||||
|
void onConfirmClick(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn);
|
||||||
|
|
||||||
|
void onCancel(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 城市选择
|
* 城市选择
|
||||||
|
@ -256,6 +256,27 @@
|
|||||||
android:textColor="#FF9A9A9A"
|
android:textColor="#FF9A9A9A"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/live_tool_random_pk"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="23dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:src="@mipmap/icon_live_random_pk" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:text="@string/live_random"
|
||||||
|
android:textColor="#FF9A9A9A"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/live_tool_mic"
|
android:id="@+id/live_tool_mic"
|
||||||
|
71
common/src/main/res/layout/dialog_live_random_pk.xml
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="280dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_dialog"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="@string/random_pk_dialog_title"
|
||||||
|
android:textColor="@color/textColor"
|
||||||
|
android:textSize="16sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:textColor="#161616"
|
||||||
|
android:textSize="14sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginBottom="22dp"
|
||||||
|
android:layout_height="40dp">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_cancel"
|
||||||
|
android:layout_width="87dp"
|
||||||
|
android:layout_height="33dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/random_pk_dialog_refuse"
|
||||||
|
android:textColor="#FFC621"
|
||||||
|
android:layout_marginRight="7dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:background="@drawable/bg_dialog_unfollow_cancel"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_confirm"
|
||||||
|
|
||||||
|
android:layout_width="87dp"
|
||||||
|
android:layout_height="33dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginLeft="7dp"
|
||||||
|
android:text="@string/random_pk_dialog_apply"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:background="@mipmap/tipbox_btn_orange"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
BIN
common/src/main/res/mipmap-xxhdpi/icon_live_random_pk.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
@ -723,6 +723,7 @@
|
|||||||
<string name="live_wishlist">心願單</string>
|
<string name="live_wishlist">心願單</string>
|
||||||
<string name="live_zg">娛樂整蠱</string>
|
<string name="live_zg">娛樂整蠱</string>
|
||||||
<string name="live_dr">多人PK</string>
|
<string name="live_dr">多人PK</string>
|
||||||
|
<string name="live_random" translatable="false">随机PK</string>
|
||||||
<string name="live_mic">語音連麥</string>
|
<string name="live_mic">語音連麥</string>
|
||||||
<string name="live_wks">周星榜</string>
|
<string name="live_wks">周星榜</string>
|
||||||
<string name="live_zslk">暫時離開</string>
|
<string name="live_zslk">暫時離開</string>
|
||||||
@ -971,4 +972,9 @@
|
|||||||
<string name="invite_anchor">邀請\n主播</string>
|
<string name="invite_anchor">邀請\n主播</string>
|
||||||
<string name="end_pk">結束\nPK</string>
|
<string name="end_pk">結束\nPK</string>
|
||||||
<string name="pk_time">時間 %s</string>
|
<string name="pk_time">時間 %s</string>
|
||||||
|
|
||||||
|
<string name="random_pk_dialog_apply" translatable="false">接受</string>
|
||||||
|
<string name="random_pk_dialog_refuse" translatable="false">拒绝</string>
|
||||||
|
<string name="random_pk_dialog_refuse_again" translatable="false">坚持拒绝</string>
|
||||||
|
<string name="random_pk_dialog_title" translatable="false">随机PK提示</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -4,15 +4,15 @@ ext {
|
|||||||
buildToolsVersion: "28.0.3",
|
buildToolsVersion: "28.0.3",
|
||||||
minSdkVersion : 21,
|
minSdkVersion : 21,
|
||||||
targetSdkVersion : 31,
|
targetSdkVersion : 31,
|
||||||
versionCode : 311,
|
versionCode : 310,
|
||||||
versionName : "6.4.6"
|
versionName : "6.4.7"
|
||||||
]
|
]
|
||||||
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",
|
||||||
|
@ -705,7 +705,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) {
|
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) {
|
||||||
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
|
Log.e("ry", "pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
|
||||||
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
|
@ -4,7 +4,9 @@ import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
|
|||||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
||||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||||
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
|
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK_RANDOM;
|
||||||
|
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
|
||||||
|
import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view;
|
||||||
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub;
|
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub;
|
||||||
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk;
|
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk;
|
||||||
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk_view;
|
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk_view;
|
||||||
@ -48,6 +50,7 @@ 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.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
import com.yunbao.common.utils.BitmapUtil;
|
import com.yunbao.common.utils.BitmapUtil;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DateFormatUtil;
|
import com.yunbao.common.utils.DateFormatUtil;
|
||||||
@ -63,10 +66,14 @@ import com.yunbao.live.R;
|
|||||||
import com.yunbao.live.bean.LiveGuardInfo;
|
import com.yunbao.live.bean.LiveGuardInfo;
|
||||||
import com.yunbao.live.bean.LiveKsyConfigBean;
|
import com.yunbao.live.bean.LiveKsyConfigBean;
|
||||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||||
|
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||||
|
import com.yunbao.common.bean.MicUserBean;
|
||||||
|
import com.yunbao.live.dialog.FreePkDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
|
import com.yunbao.live.dialog.LiveNewFunctionDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
|
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
||||||
|
import com.yunbao.live.dialog.RandomPkDialogFragment;
|
||||||
import com.yunbao.live.event.LinkMicTxMixStreamEvent;
|
import com.yunbao.live.event.LinkMicTxMixStreamEvent;
|
||||||
import com.yunbao.live.event.LiveAudienceEvent;
|
import com.yunbao.live.event.LiveAudienceEvent;
|
||||||
import com.yunbao.live.http.LiveHttpConsts;
|
import com.yunbao.live.http.LiveHttpConsts;
|
||||||
@ -80,6 +87,8 @@ import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
|
|||||||
import com.yunbao.live.socket.SocketRyChatUtil;
|
import com.yunbao.live.socket.SocketRyChatUtil;
|
||||||
import com.yunbao.live.socket.SocketRyClient;
|
import com.yunbao.live.socket.SocketRyClient;
|
||||||
import com.yunbao.live.socket.SocketSendBean;
|
import com.yunbao.live.socket.SocketSendBean;
|
||||||
|
import com.yunbao.common.utils.MicStatusManager;
|
||||||
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
import com.yunbao.live.views.LiveEndViewHolder;
|
import com.yunbao.live.views.LiveEndViewHolder;
|
||||||
import com.yunbao.live.views.LiveMusicViewHolder;
|
import com.yunbao.live.views.LiveMusicViewHolder;
|
||||||
import com.yunbao.live.views.LiveNewReadyRyViewHolder;
|
import com.yunbao.live.views.LiveNewReadyRyViewHolder;
|
||||||
@ -91,7 +100,9 @@ import org.greenrobot.eventbus.Subscribe;
|
|||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||||
@ -142,6 +153,39 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
public static int pk_nub;
|
public static int pk_nub;
|
||||||
public static int backIndex = 0;//0=未判断,1=已判断
|
public static int backIndex = 0;//0=未判断,1=已判断
|
||||||
private FaceManager manager;
|
private FaceManager manager;
|
||||||
|
private final RandomPkManager.OnRandomPkTimer onRandomPkTimer = new RandomPkManager.OnRandomPkTimer() {
|
||||||
|
@Override
|
||||||
|
public void onTimer(String time) {
|
||||||
|
if (mLiveRoomViewHolder != null) {
|
||||||
|
mLiveRoomViewHolder.setRandomPkTimer(String.format(WordUtil.getString(R.string.random_pk_info_btn_ing), time));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartPK(String pkUid) {
|
||||||
|
ToastUtil.show("发起随机PK:" + pkUid);
|
||||||
|
JSONObject msg1 = buildLinkMicJSON();
|
||||||
|
msg1.put("random_pk", "1");
|
||||||
|
if(RandomPkManager.getInstance().isRankModel()){
|
||||||
|
msg1.put("is_ladders","https://downs.yaoulive.com/rank_top_box.png");
|
||||||
|
}
|
||||||
|
linkMicAnchorApply(pkUid, pkUid, msg1.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPking() {
|
||||||
|
if (mLiveRoomViewHolder != null) {
|
||||||
|
mLiveRoomViewHolder.setRandomPkTimer(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPkEnd() {
|
||||||
|
if (mLiveRoomViewHolder != null) {
|
||||||
|
mLiveRoomViewHolder.setRandomPkTimer(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -180,6 +224,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
mContainer = (ViewGroup) findViewById(R.id.container);
|
mContainer = (ViewGroup) findViewById(R.id.container);
|
||||||
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer);
|
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer);
|
||||||
|
|
||||||
|
RandomPkManager.getInstance().addOnRandomPkTimer(onRandomPkTimer);
|
||||||
|
|
||||||
//添加开播前设置控件
|
//添加开播前设置控件
|
||||||
mLiveReadyViewHolder = new LiveNewReadyRyViewHolder(mContext, mContainer, mLiveSDK);
|
mLiveReadyViewHolder = new LiveNewReadyRyViewHolder(mContext, mContainer, mLiveSDK);
|
||||||
@ -349,7 +394,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
break;
|
break;
|
||||||
case Constants.LIVE_FUNC_LINK_MIC://连麦
|
case Constants.LIVE_FUNC_LINK_MIC://连麦
|
||||||
if (isDRPK != 1) {
|
if (isDRPK != 1) {
|
||||||
openLinkMicAnchorWindow(false);
|
//openLinkMicAnchorWindow(false);
|
||||||
|
openFreePkWindow();
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show("您已在PK中");
|
ToastUtil.show("您已在PK中");
|
||||||
}
|
}
|
||||||
@ -368,6 +414,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Constants.LIVE_FUNC_RANDOM_PK:
|
||||||
|
openRandomPkWindow();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -547,7 +596,22 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");
|
fragment.show(getSupportFragmentManager(), "LiveLinkMicListDialogFragment");
|
||||||
}
|
}
|
||||||
|
public void openFreePkWindow(){
|
||||||
|
FreePkDialogFragment fragment = new FreePkDialogFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
fragment.show(getSupportFragmentManager(), "FreePkDialogFragment");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机PK
|
||||||
|
*/
|
||||||
|
public void openRandomPkWindow() {
|
||||||
|
RandomPkDialogFragment fragment = new RandomPkDialogFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
fragment.show(getSupportFragmentManager(), "RandomPkDialogFragment");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开选择游戏窗口
|
* 打开选择游戏窗口
|
||||||
@ -881,6 +945,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
MicStatusManager.getInstance().closeMic(mContext);
|
MicStatusManager.getInstance().closeMic(mContext);
|
||||||
}
|
}
|
||||||
L.e("LiveAnchorActivity-------onDestroy------->");
|
L.e("LiveAnchorActivity-------onDestroy------->");
|
||||||
|
RandomPkManager.getInstance().unregisterOnRandomPkTimer(onRandomPkTimer);
|
||||||
Bus.getOff(this);
|
Bus.getOff(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,7 +1062,20 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
* @param pkUid 对方主播的uid
|
* @param pkUid 对方主播的uid
|
||||||
* @param stream 对方主播的stream
|
* @param stream 对方主播的stream
|
||||||
*/
|
*/
|
||||||
public void linkMicAnchorApply(final String pkUid, String stream) {
|
public void linkMicAnchorApply(String pkUid, String stream) {
|
||||||
|
JSONObject msg1 = buildLinkMicJSON();
|
||||||
|
linkMicAnchorApply(pkUid, stream, msg1.toString());
|
||||||
|
}
|
||||||
|
public JSONObject buildLinkMicJSON(){
|
||||||
|
JSONObject msg1 = new JSONObject();
|
||||||
|
msg1.put("uid", CommonAppConfig.getInstance().getUid());
|
||||||
|
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
||||||
|
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||||
|
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||||
|
return msg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void linkMicAnchorApply(final String pkUid, String stream, String extra) {
|
||||||
|
|
||||||
LiveHttpUtil.livePkCheckLive(pkUid, stream, mStream, new HttpCallback() {
|
LiveHttpUtil.livePkCheckLive(pkUid, stream, mStream, new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -1006,15 +1084,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
JSONObject obj = JSON.parseObject(info[0]);
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
if (obj.getString("ispk").equals("0")) {
|
if (obj.getString("ispk").equals("0")) {
|
||||||
JSONObject msg1 = new JSONObject();
|
|
||||||
msg1.put("uid", CommonAppConfig.getInstance().getUid());
|
IMRTCManager.getInstance().requestJoinOtherRoom(pkUid, true, extra, new IRCRTCResultCallback() {
|
||||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
|
||||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
|
||||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
|
||||||
rtcRoom.getLocalUser().requestJoinOtherRoom(pkUid, pkUid, true, msg1.toString(), new IRCRTCResultCallback() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
ToastUtil.show("邀请 " + pkUid + " 发送成功");
|
// ToastUtil.show("邀请 " + pkUid + " 发送成功");
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -1048,14 +1122,24 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起多人主播连麦PK申请
|
||||||
|
*
|
||||||
|
* @param pkUid 对方主播的uid
|
||||||
|
* @param stream 对方主播的stream (无需steam)
|
||||||
|
*/
|
||||||
|
public void linkDrMicAnchorApply(String pkUid, String stream) {
|
||||||
|
linkDrMicAnchorApply(pkUid, stream, SOCKET_LIVE_DRPK);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起多人主播连麦PK申请
|
* 发起多人主播连麦PK申请
|
||||||
*
|
*
|
||||||
* @param pkUid 对方主播的uid
|
* @param pkUid 对方主播的uid
|
||||||
* @param stream 对方主播的stream
|
* @param stream 对方主播的stream (无需steam)
|
||||||
|
* @param extra PK类型
|
||||||
*/
|
*/
|
||||||
public void linkDrMicAnchorApply(final String pkUid, String stream) {
|
public void linkDrMicAnchorApply(final String pkUid, String stream, String extra) {
|
||||||
|
|
||||||
LiveHttpUtil.livePkCheckLive(pkUid, stream, mStream, new HttpCallback() {
|
LiveHttpUtil.livePkCheckLive(pkUid, stream, mStream, new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -1065,10 +1149,12 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
if (obj.getString("ispk").equals("0")) {
|
if (obj.getString("ispk").equals("0")) {
|
||||||
|
|
||||||
rtcRoom.getLocalUser().requestJoinOtherRoom(pkUid, pkUid, true, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().requestJoinOtherRoom(pkUid, true, extra, new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
ToastUtil.show("邀请 " + pkUid + " 发送成功");
|
if (!extra.equals(SOCKET_LIVE_DRPK_RANDOM)) {
|
||||||
|
ToastUtil.show("邀请 " + pkUid + " 发送成功");
|
||||||
|
}
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -0,0 +1,143 @@
|
|||||||
|
package com.yunbao.live.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
|
import com.yunbao.common.bean.RandomPkUserBean;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.live.R;
|
||||||
|
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||||
|
|
||||||
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||||
|
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||||
|
|
||||||
|
public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||||
|
private static final int HEAD = 0;
|
||||||
|
private static final int ITEM = 2;
|
||||||
|
|
||||||
|
public RandomPkRecyclerAdapter(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public HeadViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
if (viewType == HEAD) {
|
||||||
|
return new HeadViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_random_pk_rv_head, parent, false));
|
||||||
|
}
|
||||||
|
return new ItemViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_random_pk_rv, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
if (getItemViewType(position) == ITEM) {
|
||||||
|
((ItemViewHolder) holder).setData(mList.get(position-1));
|
||||||
|
}else{
|
||||||
|
((HeadViewHolder) holder).setData(mList.get(position));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
if (position == 0) {
|
||||||
|
return HEAD;
|
||||||
|
}
|
||||||
|
return ITEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class HeadViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
public HeadViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(RandomPkUserBean bean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class ItemViewHolder extends HeadViewHolder {
|
||||||
|
private TextView mNum;
|
||||||
|
private TextView mName;
|
||||||
|
private TextView mId;
|
||||||
|
private TextView mStatus;
|
||||||
|
private RoundedImageView mAvatar;
|
||||||
|
private ImageView mPkStatus;
|
||||||
|
private ImageView mFollow;
|
||||||
|
|
||||||
|
public ItemViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
mNum = itemView.findViewById(R.id.item_id);
|
||||||
|
mName = itemView.findViewById(R.id.item_name);
|
||||||
|
mId = itemView.findViewById(R.id.item_uid);
|
||||||
|
mStatus = itemView.findViewById(R.id.item_status);
|
||||||
|
mAvatar = itemView.findViewById(R.id.item_avatar);
|
||||||
|
mPkStatus = itemView.findViewById(R.id.item_pk);
|
||||||
|
mFollow = itemView.findViewById(R.id.item_follow);
|
||||||
|
mPkStatus.setOnClickListener(v -> {
|
||||||
|
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
||||||
|
if (bean.isPk()) {
|
||||||
|
ToastUtil.show(R.string.free_pk_user_pking);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(),
|
||||||
|
((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setData(RandomPkUserBean bean) {
|
||||||
|
super.setData(bean);
|
||||||
|
int position = getAbsoluteAdapterPosition();
|
||||||
|
if (bean == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
itemView.setTag(bean);
|
||||||
|
mNum.setText((position) + "");
|
||||||
|
if (position % 2 == 0) {
|
||||||
|
itemView.setBackgroundResource(R.drawable.bg_item_random_pk_type_1);
|
||||||
|
} else {
|
||||||
|
itemView.setBackgroundResource(R.drawable.bg_item_random_pk_type_2);
|
||||||
|
}
|
||||||
|
ImgLoader.display(mContext, bean.getAvatar(), mAvatar);
|
||||||
|
if (bean.getUserNiceName().length() > 4) {
|
||||||
|
mName.setText(bean.getUserNiceName().substring(0, 4) + "...");
|
||||||
|
} else {
|
||||||
|
mName.setText(bean.getUserNiceName());
|
||||||
|
}
|
||||||
|
mId.setText(bean.getId());
|
||||||
|
if (bean.isPk()) {
|
||||||
|
mStatus.setText("PK中");
|
||||||
|
ImgLoader.display(mContext, R.mipmap.ic_random_pk_pk, mPkStatus);
|
||||||
|
} else {
|
||||||
|
mStatus.setText("空闲");
|
||||||
|
ImgLoader.display(mContext, R.mipmap.ic_random_pk_pk_unselect, mPkStatus);
|
||||||
|
}
|
||||||
|
if (bean.isAttention()) {
|
||||||
|
ImgLoader.display(mContext, R.mipmap.ic_random_pk_like, mFollow);
|
||||||
|
} else {
|
||||||
|
ImgLoader.display(mContext, R.mipmap.ic_random_pk_like_unselect, mFollow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,272 @@
|
|||||||
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
|
import com.yunbao.common.bean.HttpCallbackModel;
|
||||||
|
import com.yunbao.common.bean.RandomPkUserBean;
|
||||||
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
|
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.utils.WordsTypeUtil;
|
||||||
|
import com.yunbao.live.R;
|
||||||
|
import com.yunbao.live.adapter.RandomPkRecyclerAdapter;
|
||||||
|
import com.yunbao.live.bean.LivePkBean;
|
||||||
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自由PK
|
||||||
|
*/
|
||||||
|
public class FreePkDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||||
|
private static final int TAB_STATUS_SEARCH = 1;
|
||||||
|
private static final int TAB_STATUS_FOLLOW = 2;
|
||||||
|
|
||||||
|
private static final String TAG = "自由PK";
|
||||||
|
private int mLiveUid;
|
||||||
|
private TabLayout tabLayout;
|
||||||
|
private View reset;
|
||||||
|
private CommonRefreshView mRecyclerView;
|
||||||
|
private View mSearchLayout;
|
||||||
|
private EditText mSearch;
|
||||||
|
private ImageView mClear;
|
||||||
|
private RandomPkRecyclerAdapter adapter;
|
||||||
|
private DataHelper helper;
|
||||||
|
private int tabStatus;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.dialog_live_free_pk_function;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDialogStyle() {
|
||||||
|
return R.style.dialog2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canCancel() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setWindowAttributes(Window window) {
|
||||||
|
WindowManager.LayoutParams params = window.getAttributes();
|
||||||
|
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||||
|
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
params.height = DpUtil.dp2px(330);
|
||||||
|
params.gravity = Gravity.BOTTOM;
|
||||||
|
window.setAttributes(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLiveUid(int mLiveUid) {
|
||||||
|
this.mLiveUid = mLiveUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
initView();
|
||||||
|
initTab();
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
tabLayout = (TabLayout) findViewById(R.id.menu_tab);
|
||||||
|
reset = findViewById(R.id.menu_reset);
|
||||||
|
mRecyclerView = (CommonRefreshView) findViewById(R.id.random_container_view);
|
||||||
|
mSearchLayout = findViewById(R.id.random_pk_search_layout);
|
||||||
|
mSearch = (EditText) findViewById(R.id.search_edit);
|
||||||
|
mClear = (ImageView) findViewById(R.id.search_clear);
|
||||||
|
mClear.setOnClickListener(this);
|
||||||
|
mSearch.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
helper.search(s.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
initRecycler();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initRecycler() {
|
||||||
|
helper = new DataHelper();
|
||||||
|
adapter = new RandomPkRecyclerAdapter(mContext);
|
||||||
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
|
mRecyclerView.setDataHelper(helper);
|
||||||
|
mRecyclerView.initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initTab() {
|
||||||
|
TabLayout.Tab searchTag = tabLayout.newTab();
|
||||||
|
TabLayout.Tab listTag = tabLayout.newTab();
|
||||||
|
searchTag.setTag(TAB_STATUS_SEARCH);
|
||||||
|
searchTag.setText("主播搜索");
|
||||||
|
listTag.setTag(TAB_STATUS_FOLLOW);
|
||||||
|
listTag.setText("關注列表");
|
||||||
|
tabLayout.addTab(searchTag);
|
||||||
|
tabLayout.addTab(listTag);
|
||||||
|
tabStatus = TAB_STATUS_SEARCH;
|
||||||
|
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
|
if (tab.getTag() != null) {
|
||||||
|
tabStatus = (int) tab.getTag();
|
||||||
|
mRecyclerView.setVisibility(View.GONE);
|
||||||
|
mSearchLayout.setVisibility(View.GONE);
|
||||||
|
switch (tabStatus) {
|
||||||
|
case TAB_STATUS_SEARCH:
|
||||||
|
mSearchLayout.setVisibility(View.VISIBLE);
|
||||||
|
mRecyclerView.setVisibility(View.VISIBLE);
|
||||||
|
mRecyclerView.initData();
|
||||||
|
break;
|
||||||
|
case TAB_STATUS_FOLLOW:
|
||||||
|
mRecyclerView.setVisibility(View.VISIBLE);
|
||||||
|
mRecyclerView.initData();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int id = v.getId();
|
||||||
|
if (id == R.id.live_random_pk_switch) {
|
||||||
|
|
||||||
|
} else if (id == R.id.search_clear) {
|
||||||
|
mSearch.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DataHelper implements CommonRefreshView.DataHelper<RandomPkUserBean> {
|
||||||
|
|
||||||
|
public void search(String key) {
|
||||||
|
LiveNetManager.get(mContext)
|
||||||
|
.randomPkSearchUser(key, WordsTypeUtil.changeTraditional(key), new com.yunbao.common.http.base.HttpCallback<List<RandomPkUserBean>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<RandomPkUserBean> data) {
|
||||||
|
List<RandomPkUserBean> list = new ArrayList<>();
|
||||||
|
list.add(null);
|
||||||
|
list.addAll(data);
|
||||||
|
adapter.setList(list);
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RefreshAdapter<RandomPkUserBean> getAdapter() {
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadData(int p, HttpCallback callback) {
|
||||||
|
LiveHttpUtil.getLivePkList(p, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RandomPkUserBean> processData(String[] info) {
|
||||||
|
Log.i(TAG, "processData: 获取数据成功");
|
||||||
|
List<LivePkBean> beans = JSON.parseArray(Arrays.toString(info), LivePkBean.class);
|
||||||
|
List<RandomPkUserBean> list = new ArrayList<>();
|
||||||
|
for (LivePkBean bean : beans) {
|
||||||
|
RandomPkUserBean userBean = new RandomPkUserBean();
|
||||||
|
userBean.setId(bean.getUid());
|
||||||
|
userBean.setSex(bean.getSex());
|
||||||
|
userBean.setUserNiceName(bean.getUserNiceName());
|
||||||
|
userBean.setAvatar(bean.getAvatar());
|
||||||
|
userBean.setPk(bean.getPkUid().equals("0") ? 0 : 1);
|
||||||
|
userBean.setAttention("0");
|
||||||
|
list.add(userBean);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefreshSuccess(List<RandomPkUserBean> list, int listCount) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefreshFailure() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMoreSuccess(List<RandomPkUserBean> loadItemList, int loadItemCount) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMoreFailure() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -25,6 +25,7 @@ import com.yunbao.live.interfaces.LiveFunctionClickListener;
|
|||||||
public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||||
|
|
||||||
private View mWishView, mPrankView, mWksView, mBeautyView, mCameraView, mLeaveView, mOnePkView, mMultiPkView, mMicView;
|
private View mWishView, mPrankView, mWksView, mBeautyView, mCameraView, mLeaveView, mOnePkView, mMultiPkView, mMicView;
|
||||||
|
private View mRandomPk;
|
||||||
private LiveFunctionClickListener mFunctionClickListener;
|
private LiveFunctionClickListener mFunctionClickListener;
|
||||||
private int leave = 0;
|
private int leave = 0;
|
||||||
private boolean isPk;
|
private boolean isPk;
|
||||||
@ -79,6 +80,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
|||||||
mOnePkView = findViewById(R.id.live_tool_one_pk);
|
mOnePkView = findViewById(R.id.live_tool_one_pk);
|
||||||
mMultiPkView = findViewById(R.id.live_tool_multi_pk);
|
mMultiPkView = findViewById(R.id.live_tool_multi_pk);
|
||||||
mMicView = findViewById(R.id.live_tool_mic);
|
mMicView = findViewById(R.id.live_tool_mic);
|
||||||
|
mRandomPk = findViewById(R.id.live_tool_random_pk);
|
||||||
|
|
||||||
mWishView.setOnClickListener(this);
|
mWishView.setOnClickListener(this);
|
||||||
mPrankView.setOnClickListener(this);
|
mPrankView.setOnClickListener(this);
|
||||||
@ -89,6 +91,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
|||||||
mOnePkView.setOnClickListener(this);
|
mOnePkView.setOnClickListener(this);
|
||||||
mMultiPkView.setOnClickListener(this);
|
mMultiPkView.setOnClickListener(this);
|
||||||
mMicView.setOnClickListener(this);
|
mMicView.setOnClickListener(this);
|
||||||
|
mRandomPk.setOnClickListener(this);
|
||||||
|
|
||||||
if (leave == 0) {
|
if (leave == 0) {
|
||||||
((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave);
|
((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave);
|
||||||
@ -140,6 +143,8 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
|
|||||||
mFunctionClickListener.onClick(LIVE_FUNC_DR);
|
mFunctionClickListener.onClick(LIVE_FUNC_DR);
|
||||||
} else if (id == R.id.live_tool_mic) {
|
} else if (id == R.id.live_tool_mic) {
|
||||||
mFunctionClickListener.onClick(LIVE_FUNC_MIC);
|
mFunctionClickListener.onClick(LIVE_FUNC_MIC);
|
||||||
|
} else if (id == R.id.live_tool_random_pk) {
|
||||||
|
mFunctionClickListener.onClick(LIVE_FUNC_RANDOM_PK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,255 @@
|
|||||||
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.yunbao.common.bean.HttpCallbackModel;
|
||||||
|
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.live.R;
|
||||||
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机PK
|
||||||
|
*/
|
||||||
|
public class RandomPkDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||||
|
private static final String TAG = "随机PK";
|
||||||
|
private View mPkBtn;
|
||||||
|
private TextView mPkBtnTitle;
|
||||||
|
private TextView mPkBtnDesc;
|
||||||
|
private ImageView mRandomPkSwitch;
|
||||||
|
|
||||||
|
|
||||||
|
private final RandomPkManager.OnRandomPkTimer randomPkTimer = new RandomPkManager.OnRandomPkTimer() {
|
||||||
|
@Override
|
||||||
|
public void onTimer(String time) {
|
||||||
|
if (!mPkBtn.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.i(TAG, "onTimer: " + time);
|
||||||
|
mPkBtnTitle.setText(String.format(WordUtil.getString(R.string.random_pk_info_btn_ing), time));
|
||||||
|
mPkBtnDesc.setText(R.string.random_pk_info_btn_end_desc);
|
||||||
|
mPkBtnDesc.setVisibility(View.VISIBLE);
|
||||||
|
mPkBtn.setBackgroundResource(R.drawable.bg_live_room_random_pk_timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPking() {
|
||||||
|
resetPkBtn();
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPkEnd() {
|
||||||
|
resetPkBtn();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPkEndStart() {
|
||||||
|
super.onPkEndStart();
|
||||||
|
mPkBtn.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPkEndTimer(String time) {
|
||||||
|
super.onPkEndTimer(time);
|
||||||
|
mPkBtnTitle.setText(String.format(WordUtil.getString(R.string.random_pk_info_btn_end), time));
|
||||||
|
mPkBtnDesc.setText(R.string.random_pk_info_btn_end_desc);
|
||||||
|
mPkBtn.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPkEndSuccess() {
|
||||||
|
super.onPkEndSuccess();
|
||||||
|
resetPkBtn();
|
||||||
|
mPkBtn.setTag(false);
|
||||||
|
mPkBtn.setEnabled(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.dialog_live_random_pk_function;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDialogStyle() {
|
||||||
|
return R.style.dialog2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canCancel() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setWindowAttributes(Window window) {
|
||||||
|
WindowManager.LayoutParams params = window.getAttributes();
|
||||||
|
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||||
|
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||||
|
params.gravity = Gravity.BOTTOM;
|
||||||
|
window.setAttributes(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
RandomPkManager.getInstance().unregisterOnRandomPkTimer(randomPkTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
initView();
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
mPkBtn = findViewById(R.id.random_pk_info_btn);
|
||||||
|
mPkBtnTitle = (TextView) findViewById(R.id.random_pk_btn_title);
|
||||||
|
mPkBtnDesc = (TextView) findViewById(R.id.random_pk_btn_desc);
|
||||||
|
mRandomPkSwitch = (ImageView) findViewById(R.id.live_random_pk_switch);
|
||||||
|
mRandomPkSwitch.setTag(true);
|
||||||
|
mRandomPkSwitch.setOnClickListener(this);
|
||||||
|
mPkBtn.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
RandomPkManager.getInstance().addOnRandomPkTimer(randomPkTimer);
|
||||||
|
initPkSwitch();
|
||||||
|
if (RandomPkManager.getInstance().isRequestPk()) {
|
||||||
|
mPkBtnTitle.setText(String.format(WordUtil.getString(R.string.random_pk_info_btn_ing), RandomPkManager.getInstance().getTimer()));
|
||||||
|
mPkBtnDesc.setText(R.string.random_pk_info_btn_end_desc);
|
||||||
|
mPkBtnDesc.setVisibility(View.VISIBLE);
|
||||||
|
mPkBtn.setBackgroundResource(R.drawable.bg_live_room_random_pk_timer);
|
||||||
|
} else if (RandomPkManager.getInstance().isExiting()) {
|
||||||
|
mPkBtnTitle.setText(String.format(WordUtil.getString(R.string.random_pk_info_btn_end), RandomPkManager.getInstance().getExitTimer()));
|
||||||
|
mPkBtnDesc.setText(R.string.random_pk_info_btn_end_desc);
|
||||||
|
mPkBtn.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置随机PK开关状态
|
||||||
|
*
|
||||||
|
* @param open on/off
|
||||||
|
*/
|
||||||
|
private void setSwitchBtn(boolean open) {
|
||||||
|
if (open) {
|
||||||
|
ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, mRandomPkSwitch);
|
||||||
|
mRandomPkSwitch.setTag(true);
|
||||||
|
} else {
|
||||||
|
ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, mRandomPkSwitch);
|
||||||
|
mRandomPkSwitch.setTag(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机PK状态
|
||||||
|
*/
|
||||||
|
private void initPkSwitch() {
|
||||||
|
LiveNetManager.get(mContext)
|
||||||
|
.getRandomPkSwitch(new com.yunbao.common.http.base.HttpCallback<Integer>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Integer data) {
|
||||||
|
if (data != null) {
|
||||||
|
setSwitchBtn(data == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dialog loadDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置随机PK状态
|
||||||
|
*
|
||||||
|
* @param pk 1=on,0=off
|
||||||
|
*/
|
||||||
|
private void setPkSwitch(int pk) {
|
||||||
|
if (RandomPkManager.getInstance().isRequestPk() || RandomPkManager.getInstance().isExiting()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loadDialog = DialogUitl.loadingDialog(mContext);
|
||||||
|
loadDialog.show();
|
||||||
|
LiveNetManager.get(mContext)
|
||||||
|
.changeRandomPkSwitch(pk, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
loadDialog.dismiss();
|
||||||
|
loadDialog = null;
|
||||||
|
if (data.getCode() == 0) {
|
||||||
|
setSwitchBtn(!(boolean) mRandomPkSwitch.getTag());
|
||||||
|
} else {
|
||||||
|
ToastUtil.show(data.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
loadDialog.dismiss();
|
||||||
|
loadDialog = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void randomPk() {
|
||||||
|
if (mRandomPkSwitch.getTag() == null || !(boolean) mRandomPkSwitch.getTag()) {
|
||||||
|
ToastUtil.show("未开启随机PK开关");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((mPkBtn.getTag() != null && (boolean) mPkBtn.getTag()) || RandomPkManager.getInstance().isRequestPk()) {
|
||||||
|
RandomPkManager.getInstance().exitPk();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RandomPkManager.getInstance().start()) {
|
||||||
|
mPkBtnDesc.setVisibility(View.VISIBLE);
|
||||||
|
mPkBtnDesc.setText(R.string.random_pk_info_btn_ing_desc);
|
||||||
|
mPkBtn.setTag(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetPkBtn() {
|
||||||
|
mPkBtnDesc.setVisibility(View.GONE);
|
||||||
|
mPkBtnTitle.setText(R.string.random_pk_info_btn_start);
|
||||||
|
mPkBtn.setBackgroundResource(R.drawable.bg_live_random_pk_info_btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int id = v.getId();
|
||||||
|
if (id == R.id.live_random_pk_switch) {
|
||||||
|
if (mRandomPkSwitch.getTag() != null && (boolean) mRandomPkSwitch.getTag()) {
|
||||||
|
setPkSwitch(0);
|
||||||
|
} else {
|
||||||
|
setPkSwitch(1);
|
||||||
|
}
|
||||||
|
} else if (id == R.id.random_pk_info_btn) {
|
||||||
|
randomPk();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.yunbao.live.presenter;
|
package com.yunbao.live.presenter;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||||
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
|
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
|
||||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||||
@ -19,6 +20,7 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@ -41,8 +43,12 @@ import com.yunbao.common.glide.ImgLoader;
|
|||||||
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.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
@ -63,9 +69,14 @@ import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
|||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||||
import cn.rongcloud.rtc.api.RCRTCMixConfig;
|
import cn.rongcloud.rtc.api.RCRTCMixConfig;
|
||||||
@ -630,7 +641,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
mApplyNmae = u.getUserNiceName();
|
mApplyNmae = u.getUserNiceName();
|
||||||
if (by != 1) {
|
if (by != 1) {
|
||||||
if (mIsApplyDialogShow == false) {
|
if (mIsApplyDialogShow == false) {
|
||||||
showApplyDialog(u);
|
if (u.isRandomPk()) {
|
||||||
|
showPkDialog(u);
|
||||||
|
} else {
|
||||||
|
showApplyDialog(u);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isPK();
|
isPK();
|
||||||
@ -651,7 +666,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
* @param callBack 加入房间回调
|
* @param callBack 加入房间回调
|
||||||
* @group 房间管理
|
* @group 房间管理
|
||||||
*/
|
*/
|
||||||
|
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
|
||||||
RCRTCEngine.getInstance().joinOtherRoom(u.getId(), new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
|
RCRTCEngine.getInstance().joinOtherRoom(u.getId(), new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) {
|
public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) {
|
||||||
@ -803,7 +818,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
|
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
|
||||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||||
|
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, true, true, msg1.toString(), new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, true, msg1.toString(), new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
RCRTCEngine.getInstance().joinOtherRoom(mApplyUid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
|
RCRTCEngine.getInstance().joinOtherRoom(mApplyUid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
|
||||||
@ -1044,46 +1059,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
refusePk(u);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(RTCErrorCode errorCode) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
final SocketSendBean msg1 = new SocketSendBean()
|
|
||||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
|
||||||
.param("action", 3);
|
|
||||||
msg1.create();
|
|
||||||
|
|
||||||
String targetId = u.getId();
|
|
||||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
|
||||||
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
|
||||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
|
||||||
|
|
||||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
|
||||||
@Override
|
|
||||||
public void onAttached(io.rong.imlib.model.Message message) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
|
||||||
Log.e("ry", "发送成功");
|
|
||||||
if (SocketRyClient.mSocketHandler != null) {
|
|
||||||
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
|
||||||
Log.e("ry", "发送失敗" + u.getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
mApplyUid = null;
|
mApplyUid = null;
|
||||||
mApplyStream = null;
|
mApplyStream = null;
|
||||||
@ -1218,6 +1194,134 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机PK拒绝对话框
|
||||||
|
*/
|
||||||
|
public void showPkDialog(UserBean u) {
|
||||||
|
new DialogUitl.Builder(mContext)
|
||||||
|
.setHtmlCode(Html.fromHtml(
|
||||||
|
"<font color='#999999' size='12'>有人向您发起PK请求。</font><br/>" +
|
||||||
|
"<font color='#FB4F4F' size='12'>若拒绝PK,将会120分钟内不会再收到任何随机PK请求。</font>"
|
||||||
|
))
|
||||||
|
.setConfrimString("接受")
|
||||||
|
.setCancelString("拒絕")
|
||||||
|
.setView(R.layout.dialog_live_random_pk)
|
||||||
|
.setSimpleCallbackView(new DialogUitl.SimpleCallbackView() {
|
||||||
|
boolean clickCancel = false;
|
||||||
|
String titleVal;
|
||||||
|
TimerTask task;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShow(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) {
|
||||||
|
task = new TimerTask() {
|
||||||
|
int time = 11;
|
||||||
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (titleVal == null) {
|
||||||
|
titleVal = ((TextView) title).getText().toString();
|
||||||
|
}
|
||||||
|
handler.post(() -> ((TextView) title).setText(titleVal + " " + time));
|
||||||
|
if (time-- == 0) {
|
||||||
|
handler.post(() -> showClose(dialog, title, context, confirmBtn, cancelBtn));
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
new Timer().schedule(task, 1000, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) {
|
||||||
|
dialog.dismiss();
|
||||||
|
apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) {
|
||||||
|
if (!clickCancel) {
|
||||||
|
titleVal = "拒絕PK提示";
|
||||||
|
((TextView) context).setText(Html.fromHtml(
|
||||||
|
"<font color='#999999' size='12'>若拒絕PK,將會關閉你的隨機PK開關。</br>" +
|
||||||
|
"並且120分鍾不會收到任何隨機PK請求。</font>"
|
||||||
|
));
|
||||||
|
((TextView) cancelBtn).setText("堅持拒絕");
|
||||||
|
clickCancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showClose(dialog, title, context, confirmBtn, cancelBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showClose(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) {
|
||||||
|
task.cancel();
|
||||||
|
((TextView) title).setText("您因拒絕隨機PK,被限制關閉中");
|
||||||
|
((TextView) confirmBtn).setText("确定");
|
||||||
|
((TextView) context).setText("隨機PK可打開時間:" + new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()).format(new Date(System.currentTimeMillis() + 7200000)));//7200000ms=120m=2h
|
||||||
|
((TextView) context).setTextSize(12);
|
||||||
|
((TextView) context).setTextColor(Color.parseColor("#999999"));
|
||||||
|
|
||||||
|
cancelBtn.setVisibility(View.GONE);
|
||||||
|
confirmBtn.setOnClickListener(v -> {
|
||||||
|
refusePk(u);
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void apply() {
|
||||||
|
isPK();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build().show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refusePk(UserBean u) {
|
||||||
|
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra_randm_pk", new IRCRTCResultCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(RTCErrorCode errorCode) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
final SocketSendBean msg1 = new SocketSendBean()
|
||||||
|
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||||
|
// .param("randomPk",u.isRandomPk()+"")
|
||||||
|
.param("action", 3);
|
||||||
|
msg1.create();
|
||||||
|
|
||||||
|
String targetId = u.getId();
|
||||||
|
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||||
|
TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString());
|
||||||
|
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||||
|
|
||||||
|
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||||
|
@Override
|
||||||
|
public void onAttached(io.rong.imlib.model.Message message) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||||
|
Log.e("ry", "发送成功");
|
||||||
|
if (SocketRyClient.mSocketHandler != null) {
|
||||||
|
SocketRyClient.mSocketHandler.processBroadcast(msg1.mResult.toString() + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||||
|
Log.e("ry", "发送失敗" + u.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
LiveNetManager.get(mContext).setBanRandomPK(null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示申请多人PK的弹窗
|
* 显示申请多人PK的弹窗
|
||||||
*/
|
*/
|
||||||
@ -1264,7 +1368,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
agree = false;
|
agree = false;
|
||||||
}
|
}
|
||||||
boolean finalAgree = agree;
|
boolean finalAgree = agree;
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, agree, true, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, agree, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
if (finalAgree == true) {
|
if (finalAgree == true) {
|
||||||
@ -1311,7 +1415,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||||
JSONArray users = obj.getJSONArray("userlist");
|
JSONArray users = obj.getJSONArray("userlist");
|
||||||
|
|
||||||
|
//添加水印
|
||||||
|
// RCRTCRect rect = new RCRTCRect(0.5f, 0.5f, 0.2f);
|
||||||
|
// RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(fromText(50, mNameText), rect);
|
||||||
dRjoinOtherRoom(u.getId(), 1);
|
dRjoinOtherRoom(u.getId(), 1);
|
||||||
|
|
||||||
for (int i = 0; i < users.size(); i++) {
|
for (int i = 0; i < users.size(); i++) {
|
||||||
JSONObject user = users.getJSONObject(i);
|
JSONObject user = users.getJSONObject(i);
|
||||||
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
|
Log.e("ry", mApplyUid + "VS" + user.getString("id") + "列表");
|
||||||
@ -1329,7 +1438,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
* 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
* 2:无论为true或false,双方都可以使用{@link RCRTCLiveInfo#setMixConfig(RCRTCMixConfig, IRCRTCResultCallback)} 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||||
* <P/>
|
* <P/>
|
||||||
*/
|
*/
|
||||||
rtcRoom.getLocalUser().requestJoinOtherRoom(user.getString("id"), user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().requestJoinOtherRoom(user.getString("id"), false, "LiveDRPK1", new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
}
|
}
|
||||||
@ -1363,7 +1472,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (mPkWaitCount < 0) {
|
if (mPkWaitCount < 0) {
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(RTCErrorCode errorCode) {
|
public void onFailed(RTCErrorCode errorCode) {
|
||||||
@ -1405,7 +1514,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(RTCErrorCode errorCode) {
|
public void onFailed(RTCErrorCode errorCode) {
|
||||||
@ -2122,7 +2231,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
if (mLiveLinkMicPkViewHolder != null) {
|
if (mLiveLinkMicPkViewHolder != null) {
|
||||||
if (!TextUtils.isEmpty(winUid)) {
|
if (!TextUtils.isEmpty(winUid)) {
|
||||||
if ("0".equals(winUid)) {
|
if ("0" .equals(winUid)) {
|
||||||
mLiveLinkMicPkViewHolder.end(0);
|
mLiveLinkMicPkViewHolder.end(0);
|
||||||
mLiveLinkMicPkViewHolder.hideTime();
|
mLiveLinkMicPkViewHolder.hideTime();
|
||||||
if (mHandler != null) {
|
if (mHandler != null) {
|
||||||
@ -2241,7 +2350,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
if (mIsAnchor) {
|
if (mIsAnchor) {
|
||||||
((LiveRyAnchorActivity) mContext).setPkBtnVisible(true);
|
((LiveRyAnchorActivity) mContext).setPkBtnVisible(true);
|
||||||
}
|
}
|
||||||
ToastUtil.show(R.string.link_mic_refuse_pk);
|
// ToastUtil.show(R.string.link_mic_refuse_pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,6 +30,7 @@ import com.yunbao.common.bean.SocketModel;
|
|||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
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.manager.IMRTCManager;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
@ -47,6 +48,7 @@ import com.yunbao.live.bean.LiveLuckGiftWinBean;
|
|||||||
import com.yunbao.live.bean.LivePKUserListBean;
|
import com.yunbao.live.bean.LivePKUserListBean;
|
||||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||||
import com.yunbao.live.event.LiveAudienceEvent;
|
import com.yunbao.live.event.LiveAudienceEvent;
|
||||||
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
import com.yunbao.live.views.LiveEndViewHolder;
|
import com.yunbao.live.views.LiveEndViewHolder;
|
||||||
import com.yunbao.live.views.LivePlayKsyViewHolder;
|
import com.yunbao.live.views.LivePlayKsyViewHolder;
|
||||||
import com.yunbao.live.views.LivePlayRyViewHolder;
|
import com.yunbao.live.views.LivePlayRyViewHolder;
|
||||||
@ -264,6 +266,7 @@ public class SocketRyClient {
|
|||||||
// case Constants.SOCKET_SEND_GIFT://送礼物
|
// case Constants.SOCKET_SEND_GIFT://送礼物
|
||||||
// ////////pk
|
// ////////pk
|
||||||
// break;
|
// break;
|
||||||
|
case Constants.SOCKET_LIVE_DRPK_RANDOM:
|
||||||
case Constants.SOCKET_LIVE_DRPK://多人PK
|
case Constants.SOCKET_LIVE_DRPK://多人PK
|
||||||
int action3 = map.getIntValue("action");
|
int action3 = map.getIntValue("action");
|
||||||
//收到多人PK邀请
|
//收到多人PK邀请
|
||||||
@ -323,7 +326,7 @@ public class SocketRyClient {
|
|||||||
isDRPK = 1;
|
isDRPK = 1;
|
||||||
} else if (action3 == 10) {
|
} else if (action3 == 10) {
|
||||||
if (!map.getString("uid").equals(CommonAppConfig.getInstance().getUid())) {
|
if (!map.getString("uid").equals(CommonAppConfig.getInstance().getUid())) {
|
||||||
// LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
|
// LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW)
|
.setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW)
|
||||||
);
|
);
|
||||||
@ -473,7 +476,7 @@ public class SocketRyClient {
|
|||||||
LiveChatBean chatBean = new LiveChatBean();
|
LiveChatBean chatBean = new LiveChatBean();
|
||||||
chatBean.setId(jsonObject.getString("uid"));
|
chatBean.setId(jsonObject.getString("uid"));
|
||||||
chatBean.setUserNiceName(jsonObject.getString("user_nicename"));
|
chatBean.setUserNiceName(jsonObject.getString("user_nicename"));
|
||||||
if ("1".equals(map.getString("msgtype"))) {
|
if ("1" .equals(map.getString("msgtype"))) {
|
||||||
chatBean.setType(-3);
|
chatBean.setType(-3);
|
||||||
} else {
|
} else {
|
||||||
chatBean.setType(-4);
|
chatBean.setType(-4);
|
||||||
@ -660,7 +663,7 @@ public class SocketRyClient {
|
|||||||
|
|
||||||
private static void sendActiveMsg(JSONObject map, SocketReceiveBean received) {
|
private static void sendActiveMsg(JSONObject map, SocketReceiveBean received) {
|
||||||
String msgtype = map.getString("msgtype");
|
String msgtype = map.getString("msgtype");
|
||||||
if ("1".equals(msgtype)) {//新年大作战活动
|
if ("1" .equals(msgtype)) {//新年大作战活动
|
||||||
LiveChatBean chatBean = new LiveChatBean();
|
LiveChatBean chatBean = new LiveChatBean();
|
||||||
chatBean.setId(map.getString("uid"));
|
chatBean.setId(map.getString("uid"));
|
||||||
chatBean.setMedalLevelImageUrl(map.getString("monster_str"));//昵称暂时做为活动图片地址
|
chatBean.setMedalLevelImageUrl(map.getString("monster_str"));//昵称暂时做为活动图片地址
|
||||||
@ -673,14 +676,14 @@ public class SocketRyClient {
|
|||||||
|
|
||||||
private static void wordLightEnterRoom(JSONObject map, SocketReceiveBean received) {
|
private static void wordLightEnterRoom(JSONObject map, SocketReceiveBean received) {
|
||||||
String msgtype = map.getString("msgtype");
|
String msgtype = map.getString("msgtype");
|
||||||
if ("2".equals(msgtype)) {//发言,点亮
|
if ("2" .equals(msgtype)) {//发言,点亮
|
||||||
if ("409002".equals(received.getRetcode())) {
|
if ("409002" .equals(received.getRetcode())) {
|
||||||
ToastUtil.show(R.string.live_you_are_shut);
|
ToastUtil.show(R.string.live_you_are_shut);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//禁言别人,自己发言只能自己看到
|
//禁言别人,自己发言只能自己看到
|
||||||
if ("409100".equals(received.getRetcode())) {
|
if ("409100" .equals(received.getRetcode())) {
|
||||||
String uid = map.getString("uid");
|
String uid = map.getString("uid");
|
||||||
if (!uid.equals(CommonAppConfig.getInstance().getUid())) {
|
if (!uid.equals(CommonAppConfig.getInstance().getUid())) {
|
||||||
return;
|
return;
|
||||||
@ -725,12 +728,12 @@ public class SocketRyClient {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!"".equals(map.getString("prankIcon")) && map.getString("prankIcon") != null) {
|
if (!"" .equals(map.getString("prankIcon")) && map.getString("prankIcon") != null) {
|
||||||
chatBean.setPrankIcon(map.getString("prankIcon"));
|
chatBean.setPrankIcon(map.getString("prankIcon"));
|
||||||
chatBean.setType(-5);
|
chatBean.setType(-5);
|
||||||
}
|
}
|
||||||
mListener.onChat(chatBean, 1);
|
mListener.onChat(chatBean, 1);
|
||||||
} else if ("0".equals(msgtype)) {//用户进入房间
|
} else if ("0" .equals(msgtype)) {//用户进入房间
|
||||||
JSONObject obj = JSON.parseObject(map.getString("ct"));
|
JSONObject obj = JSON.parseObject(map.getString("ct"));
|
||||||
LiveUserGiftBean u = GsonUtils.fromJson(obj.toJSONString(), LiveUserGiftBean.class);
|
LiveUserGiftBean u = GsonUtils.fromJson(obj.toJSONString(), LiveUserGiftBean.class);
|
||||||
UserBean.Vip vip = new UserBean.Vip();
|
UserBean.Vip vip = new UserBean.Vip();
|
||||||
@ -877,7 +880,7 @@ public class SocketRyClient {
|
|||||||
chatBean.setMedal_new(map.getString("medal_new"));
|
chatBean.setMedal_new(map.getString("medal_new"));
|
||||||
chatBean.setGood_nub(map.getString("good_num"));
|
chatBean.setGood_nub(map.getString("good_num"));
|
||||||
chatBean.setType(LiveChatBean.GIFT);
|
chatBean.setType(LiveChatBean.GIFT);
|
||||||
if (map.get("guard_type") != null && !"".equals(map.get("guard_type")) && !"null".equals(map.get("guard_type"))) {
|
if (map.get("guard_type") != null && !"" .equals(map.get("guard_type")) && !"null" .equals(map.get("guard_type"))) {
|
||||||
chatBean.setGuardType(map.getInteger("guard_type"));
|
chatBean.setGuardType(map.getInteger("guard_type"));
|
||||||
}
|
}
|
||||||
if (CommonAppContext.lang.equals("chinese")) {
|
if (CommonAppContext.lang.equals("chinese")) {
|
||||||
@ -1053,23 +1056,27 @@ public class SocketRyClient {
|
|||||||
mListener.onLinkMicPkApply(u, map.getString("stream"), 1);
|
mListener.onLinkMicPkApply(u, map.getString("stream"), 1);
|
||||||
break;
|
break;
|
||||||
case 2://收到对方主播PK回调
|
case 2://收到对方主播PK回调
|
||||||
|
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
|
||||||
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
||||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
||||||
break;
|
break;
|
||||||
case 3://对方主播拒绝PK的回调
|
case 3://对方主播拒绝PK的回调
|
||||||
|
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||||
mListener.onLinkMicPkRefuse();
|
mListener.onLinkMicPkRefuse();
|
||||||
break;
|
break;
|
||||||
case 4://所有人收到PK开始址的回调
|
case 4://所有人收到PK开始址的回调
|
||||||
|
// RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_START);
|
||||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));
|
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));
|
||||||
break;
|
break;
|
||||||
case 5://PK时候断开连麦的回调
|
case 5://PK时候断开连麦的回调
|
||||||
if (rtcRoom != null) {
|
if (rtcRoom != null) {
|
||||||
// if (LivePushRyViewHolder.mPreView1 != null) {
|
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_CLOSE);
|
||||||
// LivePushRyViewHolder.mPreView1.removeAllViews();
|
/* if (LivePushRyViewHolder.mPreView1 != null) {
|
||||||
// LivePushRyViewHolder.mPreView1.setVisibility(View.GONE);
|
LivePushRyViewHolder.mPreView1.removeAllViews();
|
||||||
// isDRPK = 0;
|
LivePushRyViewHolder.mPreView1.setVisibility(View.GONE);
|
||||||
// leaveDRRoom();
|
isDRPK = 0;
|
||||||
// }
|
leaveDRRoom();
|
||||||
|
}*/
|
||||||
LivePushRyViewHolder.btn_close.setVisibility(View.GONE);
|
LivePushRyViewHolder.btn_close.setVisibility(View.GONE);
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
|
||||||
params.topMargin = 0;
|
params.topMargin = 0;
|
||||||
@ -1101,10 +1108,7 @@ public class SocketRyClient {
|
|||||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
||||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||||
if (rtcRoom == null) {
|
IMRTCManager.getInstance().requestJoinOtherRoom(map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() {
|
||||||
return;
|
|
||||||
}
|
|
||||||
rtcRoom.getLocalUser().requestJoinOtherRoom(map.getString("uid"), map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
ToastUtil.show("邀请 " + map.getString("uid") + " 发送成功");
|
ToastUtil.show("邀请 " + map.getString("uid") + " 发送成功");
|
||||||
|
@ -34,6 +34,8 @@ import com.yunbao.common.Constants;
|
|||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
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.manager.IMRTCManager;
|
||||||
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
@ -223,9 +225,22 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
mLiveRyLinkMicPkPresenter.onLinkMicPkApply(userBean1, "", 1);
|
mLiveRyLinkMicPkPresenter.onLinkMicPkApply(userBean1, "", 1);
|
||||||
} else {
|
} else {
|
||||||
Log.e("ry", extra);
|
Log.e("ry", extra);
|
||||||
|
/*
|
||||||
|
* {
|
||||||
|
* "pkhead": "https://downs.yaoulive.com/20220906170849_79c553dc1319fb5c215e06e01674eba4?imageView2/2/w/600/h/600",
|
||||||
|
* "pkname": "用户_98274",
|
||||||
|
* "pkuid": "98274",
|
||||||
|
* "randomPk": true,
|
||||||
|
* "uid": "98274"
|
||||||
|
* }
|
||||||
|
*/
|
||||||
UserBean userBean1 = new UserBean();
|
UserBean userBean1 = new UserBean();
|
||||||
if (!extra.equals("")) {
|
if (!extra.equals("")) {
|
||||||
JSONObject map = JSONObject.parseObject(extra);
|
JSONObject map = JSONObject.parseObject(extra);
|
||||||
|
userBean1.setAvatar(map.getString("pkhead"));
|
||||||
|
userBean1.setUserNiceName(map.getString("pkname"));
|
||||||
|
userBean1.setRandomPk(map.containsKey("random_pk") && map.getString("random_pk").equals("1"));
|
||||||
|
userBean1.setRankPkImgUrl(map.containsKey("is_ladders") ? map.getString("is_ladders") : null);
|
||||||
userBean1.setId(map.getString("uid"));
|
userBean1.setId(map.getString("uid"));
|
||||||
userBean1.setUserNiceName(map.getString("pkname"));
|
userBean1.setUserNiceName(map.getString("pkname"));
|
||||||
userBean1.setAvatar(map.getString("pkhead"));
|
userBean1.setAvatar(map.getString("pkhead"));
|
||||||
@ -484,7 +499,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
|
|
||||||
// 保存房间对象
|
// 保存房间对象
|
||||||
rtcRoom = room;
|
rtcRoom = room;
|
||||||
|
IMRTCManager.getInstance().setRtcRoom(room);
|
||||||
|
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -544,6 +559,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rtcRoom = room;
|
rtcRoom = room;
|
||||||
|
IMRTCManager.getInstance().setRtcRoom(room);
|
||||||
}
|
}
|
||||||
rtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
|
rtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,6 +86,7 @@ import com.yunbao.common.http.live.LiveNetManager;
|
|||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
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.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
@ -96,6 +97,7 @@ import com.yunbao.common.utils.SVGAViewUtils;
|
|||||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||||
import com.yunbao.common.utils.SpUtil;
|
import com.yunbao.common.utils.SpUtil;
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.common.utils.formatBigNum;
|
import com.yunbao.common.utils.formatBigNum;
|
||||||
import com.yunbao.common.views.AbsViewHolder;
|
import com.yunbao.common.views.AbsViewHolder;
|
||||||
@ -323,6 +325,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
//接口整合新加参数
|
//接口整合新加参数
|
||||||
private GuardUserModel guardUserModel;
|
private GuardUserModel guardUserModel;
|
||||||
private ViewFlipper flipper;
|
private ViewFlipper flipper;
|
||||||
|
private TextView mRandomPkTimer;
|
||||||
|
|
||||||
|
|
||||||
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
|
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
@ -737,6 +741,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
lt_trickery.setOnClickListener(this);
|
lt_trickery.setOnClickListener(this);
|
||||||
dialog = new Dialog(mContext, R.style.dialog);
|
dialog = new Dialog(mContext, R.style.dialog);
|
||||||
|
|
||||||
|
mRandomPkTimer = (TextView) findViewById(R.id.random_pk_timer);
|
||||||
|
|
||||||
if (!SpUtil.getInstance().getBooleanValue("private_chat_message_switch")) {
|
if (!SpUtil.getInstance().getBooleanValue("private_chat_message_switch")) {
|
||||||
msgLayout.setVisibility(View.GONE);
|
msgLayout.setVisibility(View.GONE);
|
||||||
@ -1181,7 +1186,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
showBanner2();
|
showBanner2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void setRandomPkTimer(String timer){
|
||||||
|
if(timer==null){
|
||||||
|
mRandomPkTimer.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mRandomPkTimer.setVisibility(View.VISIBLE);
|
||||||
|
mRandomPkTimer.setText(timer);
|
||||||
|
}
|
||||||
private synchronized void showBanner2() {
|
private synchronized void showBanner2() {
|
||||||
if (mBannerList2 != null && mBanner2 != null) {
|
if (mBannerList2 != null && mBanner2 != null) {
|
||||||
btn_event2.setVisibility(View.VISIBLE);
|
btn_event2.setVisibility(View.VISIBLE);
|
||||||
@ -1615,6 +1627,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.leftMargin = DpUtil.dp2px(3);
|
params.leftMargin = DpUtil.dp2px(3);
|
||||||
textParams.setMarginStart(DpUtil.dp2px(3));
|
textParams.setMarginStart(DpUtil.dp2px(3));
|
||||||
|
textParams.setMarginEnd(DpUtil.dp2px(2));
|
||||||
|
|
||||||
View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
|
View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
|
||||||
View titleView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
|
View titleView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
|
||||||
@ -1781,7 +1794,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
avatar_l1.setOnClickListener(new View.OnClickListener() {
|
avatar_l1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (uidL1 != null && !"".equals(uidL1)) {
|
if (uidL1 != null && !"" .equals(uidL1)) {
|
||||||
showUserDialog(uidL1);
|
showUserDialog(uidL1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1789,7 +1802,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
avatar_l2.setOnClickListener(new View.OnClickListener() {
|
avatar_l2.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (uidL2 != null && !"".equals(uidL2)) {
|
if (uidL2 != null && !"" .equals(uidL2)) {
|
||||||
showUserDialog(uidL2);
|
showUserDialog(uidL2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1797,7 +1810,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
avatar_l3.setOnClickListener(new View.OnClickListener() {
|
avatar_l3.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (uidL3 != null && !"".equals(uidL3)) {
|
if (uidL3 != null && !"" .equals(uidL3)) {
|
||||||
showUserDialog(uidL3);
|
showUserDialog(uidL3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1805,7 +1818,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
avatar_r1.setOnClickListener(new View.OnClickListener() {
|
avatar_r1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (uidR1 != null && !"".equals(uidR1)) {
|
if (uidR1 != null && !"" .equals(uidR1)) {
|
||||||
showUserDialog(uidR1);
|
showUserDialog(uidR1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1813,7 +1826,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
avatar_r2.setOnClickListener(new View.OnClickListener() {
|
avatar_r2.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (uidR2 != null && !"".equals(uidR2)) {
|
if (uidR2 != null && !"" .equals(uidR2)) {
|
||||||
showUserDialog(uidR2);
|
showUserDialog(uidR2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1821,7 +1834,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
avatar_r3.setOnClickListener(new View.OnClickListener() {
|
avatar_r3.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (uidR3 != null && !"".equals(uidR3)) {
|
if (uidR3 != null && !"" .equals(uidR3)) {
|
||||||
showUserDialog(uidR3);
|
showUserDialog(uidR3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3018,7 +3031,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
if (code == 0 && info.length > 0) {
|
if (code == 0 && info.length > 0) {
|
||||||
if ("1".equals(info[0])) {
|
if ("1" .equals(info[0])) {
|
||||||
ft_hot_add.setVisibility(View.VISIBLE);
|
ft_hot_add.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
ft_hot_add.setVisibility(View.GONE);
|
ft_hot_add.setVisibility(View.GONE);
|
||||||
@ -3033,7 +3046,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
*/
|
*/
|
||||||
public static void getIsHot(String isUseHotCard) {
|
public static void getIsHot(String isUseHotCard) {
|
||||||
ImgLoader.display2(Contexts, "https://downs.yaoulive.com/img_hot_gif.gif", img_hot_gif);
|
ImgLoader.display2(Contexts, "https://downs.yaoulive.com/img_hot_gif.gif", img_hot_gif);
|
||||||
if ("1".equals(isUseHotCard)) {
|
if ("1" .equals(isUseHotCard)) {
|
||||||
ft_hot_add.setVisibility(View.VISIBLE);
|
ft_hot_add.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
ft_hot_add.setVisibility(View.GONE);
|
ft_hot_add.setVisibility(View.GONE);
|
||||||
@ -3331,7 +3344,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
} else if (bean.getActivityId() == 0) {
|
} else if (bean.getActivityId() == 0) {
|
||||||
openWebDialog(bean.getLink());
|
openWebDialog(bean.getLink());
|
||||||
} else {
|
} else {
|
||||||
LiveGameDialogFragment fragment = new LiveGameDialogFragment("1".equals(bean.getShow_type()));
|
LiveGameDialogFragment fragment = new LiveGameDialogFragment("1" .equals(bean.getShow_type()));
|
||||||
fragment.setActivityId(bean.getActivityId());
|
fragment.setActivityId(bean.getActivityId());
|
||||||
fragment.setRoomId(mLiveUid);
|
fragment.setRoomId(mLiveUid);
|
||||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
|
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
|
||||||
@ -3382,7 +3395,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
nowTime = time;
|
nowTime = time;
|
||||||
tv_trickery_time.setText("" + nowTime);
|
tv_trickery_time.setText("" + nowTime);
|
||||||
openType = 0;
|
openType = 0;
|
||||||
if ("1".equals(msgtype)) {
|
if ("1" .equals(msgtype)) {
|
||||||
nums = jsonObject.getString("nums");
|
nums = jsonObject.getString("nums");
|
||||||
prankid = jsonObject.getString("prankid");
|
prankid = jsonObject.getString("prankid");
|
||||||
content = jsonObject.getString("content");
|
content = jsonObject.getString("content");
|
||||||
@ -3546,21 +3559,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onUpdata(String str) {
|
public void onUpdata(String str) {
|
||||||
if ("svga_new_user_gif".equals(str)) {
|
if ("svga_new_user_gif" .equals(str)) {
|
||||||
if (fastMsgRecyclerView == null) return;
|
if (fastMsgRecyclerView == null) return;
|
||||||
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
|
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
|
||||||
fastMsgRecyclerView.getLayoutParams();
|
fastMsgRecyclerView.getLayoutParams();
|
||||||
params1.rightMargin = DeviceUtils.getScreenWidth((Activity) mContext) / 3;
|
params1.rightMargin = DeviceUtils.getScreenWidth((Activity) mContext) / 3;
|
||||||
fastMsgRecyclerView.setLayoutParams(params1);
|
fastMsgRecyclerView.setLayoutParams(params1);
|
||||||
} else if ("stop_svga_new_user_gif".equals(str)) {
|
} else if ("stop_svga_new_user_gif" .equals(str)) {
|
||||||
if (fastMsgRecyclerView == null) return;
|
if (fastMsgRecyclerView == null) return;
|
||||||
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
|
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
|
||||||
fastMsgRecyclerView.getLayoutParams();
|
fastMsgRecyclerView.getLayoutParams();
|
||||||
params1.rightMargin = 0;
|
params1.rightMargin = 0;
|
||||||
fastMsgRecyclerView.setLayoutParams(params1);
|
fastMsgRecyclerView.setLayoutParams(params1);
|
||||||
} else if ("showBanner".equals(str)) {
|
} else if ("showBanner" .equals(str)) {
|
||||||
showBanner3(bean1);
|
showBanner3(bean1);
|
||||||
} else if ("stop_svga_new_user_double".equals(str) && mBannerList3.size() > 2) {
|
} else if ("stop_svga_new_user_double" .equals(str) && mBannerList3.size() > 2) {
|
||||||
|
|
||||||
mBannerList3.get(2).setLink("1");
|
mBannerList3.get(2).setLink("1");
|
||||||
mBanner3.update(mBannerList3);
|
mBanner3.update(mBannerList3);
|
||||||
@ -3571,7 +3584,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ("stop_svga_new_user_follow".equals(str) && mBannerList3.size() > 1) {
|
} else if ("stop_svga_new_user_follow" .equals(str) && mBannerList3.size() > 1) {
|
||||||
mBannerList3.get(1).setLink("1");
|
mBannerList3.get(1).setLink("1");
|
||||||
|
|
||||||
mBanner3.update(mBannerList3);
|
mBanner3.update(mBannerList3);
|
||||||
@ -3582,7 +3595,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ("stop_new_user_gif".equals(str) && mBannerList3.size() > 0) {
|
} else if ("stop_new_user_gif" .equals(str) && mBannerList3.size() > 0) {
|
||||||
IMLoginManager.get(mContext).setNewUserGif(false);
|
IMLoginManager.get(mContext).setNewUserGif(false);
|
||||||
mBannerList3.get(0).setLink("1");
|
mBannerList3.get(0).setLink("1");
|
||||||
mBanner3.update(mBannerList3);
|
mBanner3.update(mBannerList3);
|
||||||
|
@ -1216,6 +1216,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLinkMicPkStart(String pkUid, String pkhead, String pkname, String isLadders) {
|
public void onLinkMicPkStart(String pkUid, String pkhead, String pkname, String isLadders) {
|
||||||
|
System.out.println("PK测试 pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
|
||||||
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
|
9
live/src/main/res/drawable/background_7792d0.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="20dp" />
|
||||||
|
<solid android:color="#337792D0" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
9
live/src/main/res/drawable/bg_item_random_pk_type_1.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:width="355dp" android:height="36dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#337792d0" />
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
9
live/src/main/res/drawable/bg_item_random_pk_type_2.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:width="355dp" android:height="36dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#000000" />
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:width="188dp" android:height="42dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#ffffbe41" />
|
||||||
|
<corners android:radius="21dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
21
live/src/main/res/drawable/bg_live_random_pk_info_switch.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!--开关按钮关闭时的导轨样式-->
|
||||||
|
<item android:state_checked="false">
|
||||||
|
<shape>
|
||||||
|
<size android:height="25dp" android:width="40dp"/>
|
||||||
|
<corners android:radius="20dp"/>
|
||||||
|
<solid android:color="#33000000"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!--开关按钮打开时的导轨样式-->
|
||||||
|
<item android:state_checked="true">
|
||||||
|
<shape>
|
||||||
|
<size android:height="25dp" android:width="40dp"/>
|
||||||
|
<corners android:radius="20dp"/>
|
||||||
|
<solid android:color="#F7B500"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!--开关按钮关闭时的导轨样式-->
|
||||||
|
<item android:state_checked="false">
|
||||||
|
<layer-list>
|
||||||
|
<item android:bottom="-1px" android:top="-1px" android:left="-1px" android:right="-1px">
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<size android:width="24dp" android:height="24dp" />
|
||||||
|
<solid android:color="#33EEEEEE" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<size android:height="25dp" android:width="25dp"/>
|
||||||
|
<corners android:radius="20dp"/>
|
||||||
|
<solid android:color="#FFFFFF"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
||||||
|
|
||||||
|
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:state_checked="true">
|
||||||
|
<layer-list>
|
||||||
|
<item android:bottom="-1px" android:top="-1px" android:left="-1px" android:right="-1px">
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<size android:width="24dp" android:height="24dp" />
|
||||||
|
<solid android:color="#33EEEEEE" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<size android:height="25dp" android:width="25dp"/>
|
||||||
|
<corners android:radius="20dp"/>
|
||||||
|
<solid android:color="#FFFFFF"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_checked="false">
|
||||||
|
<shape>
|
||||||
|
<solid android:color="#00000000" />
|
||||||
|
<corners android:radius="30dp" />
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:state_checked="true">
|
||||||
|
<shape>
|
||||||
|
<solid android:color="#00000000" />
|
||||||
|
|
||||||
|
<corners android:radius="32dp" />
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:width="96dp" android:height="28dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#fffa6400" />
|
||||||
|
<corners android:radius="21dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
9
live/src/main/res/drawable/bg_random_pk_rv_search.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:width="355dp" android:height="32dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#33ffffff" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
13
live/src/main/res/drawable/random_pk_shape_tab_indicator.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:width="14dp"
|
||||||
|
android:height="3dp"
|
||||||
|
android:gravity="center">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="1.5dp" />
|
||||||
|
<!--color无效,源码用tabIndicatorColor-->
|
||||||
|
<solid android:color="#FFF" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
108
live/src/main/res/layout/dialog_live_free_pk_function.xml
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="330dp"
|
||||||
|
android:background="@drawable/bg_live_tota">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/random_menu_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/menu_back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="1.0"
|
||||||
|
app:srcCompat="@drawable/rc_picture_icon_back" />
|
||||||
|
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/menu_tab"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:tabIndicator="@drawable/random_pk_shape_tab_indicator"
|
||||||
|
app:tabIndicatorColor="#F6F7FB"
|
||||||
|
app:tabIndicatorFullWidth="false"
|
||||||
|
app:tabMaxWidth="100dp"
|
||||||
|
app:tabMode="scrollable"
|
||||||
|
app:tabSelectedTextColor="#F6F7FB"
|
||||||
|
app:tabTextColor="#9A9A9A" />
|
||||||
|
</HorizontalScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/menu_reset"
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
app:srcCompat="@mipmap/icon_reset" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="1dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dialog_reset"
|
||||||
|
android:textColor="#9A9A9A"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/item_random_pk_rv_search"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
<com.yunbao.common.custom.CommonRefreshView
|
||||||
|
android:id="@+id/random_container_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
|
</com.yunbao.common.custom.CommonRefreshView>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
58
live/src/main/res/layout/dialog_live_random_pk_function.xml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="330dp"
|
||||||
|
android:background="@drawable/bg_live_tota">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/random_menu_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/random_pk_info_view_title"
|
||||||
|
android:textColor="#F6F7FB"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/item_random_pk_info"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="280dp"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/item_random_pk_rv_search"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<com.yunbao.common.custom.CommonRefreshView
|
||||||
|
android:id="@+id/random_container_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="238dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
</com.yunbao.common.custom.CommonRefreshView>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
144
live/src/main/res/layout/item_random_pk_info.xml
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/layout_random_pk_info"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:background="@drawable/background_7792d0"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:text="@string/random_pk_info_title"
|
||||||
|
android:textColor="#F6F7FB"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
|
||||||
|
android:text="@string/random_pk_info_desc_1"
|
||||||
|
android:textColor="#F6F7FB"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:text="@string/random_pk_info_desc_2"
|
||||||
|
android:textColor="#F6F7FB"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:text="@string/random_pk_info_desc_3"
|
||||||
|
android:textColor="#F6F7FB"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:text="@string/random_pk_info_time_desc"
|
||||||
|
android:textColor="#F6F7FB"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:text="@string/random_pk_info_time"
|
||||||
|
android:textColor="#F6F7FB"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/random_pk_info_btn"
|
||||||
|
android:layout_width="188dp"
|
||||||
|
android:layout_height="42dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:background="@drawable/bg_live_random_pk_info_btn"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/random_pk_btn_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/random_pk_info_btn_start"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/random_pk_btn_desc"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/random_pk_info_switch"
|
||||||
|
android:textColor="#9A9A9A"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/live_random_pk_switch"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/live_random_pk_switch"
|
||||||
|
android:layout_width="46.67dp"
|
||||||
|
android:layout_height="23.33dp"
|
||||||
|
android:src="@mipmap/special_icon_off"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_goneMarginEnd="10dp"
|
||||||
|
app:track="@drawable/bg_live_random_pk_info_switch_track" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
96
live/src/main/res/layout/item_random_pk_rv.xml
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:background="@drawable/bg_item_random_pk_type_1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_id"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="序号"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.4"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/item_avatar"
|
||||||
|
android:layout_width="28dp"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@mipmap/beauty_jingbai"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:id="@+id/item_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="头像&昵称"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_uid"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.8"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="ID"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_status"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="状态"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_pk"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="27dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:src="@mipmap/ic_random_pk_pk" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_follow"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="23dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:src="@mipmap/ic_random_pk_like" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
66
live/src/main/res/layout/item_random_pk_rv_head.xml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:background="@drawable/bg_item_random_pk_type_1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="序号"
|
||||||
|
android:textColor="#B3FFFFFF" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.2"
|
||||||
|
android:text="头像&昵称"
|
||||||
|
android:textColor="#B3FFFFFF" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="ID"
|
||||||
|
android:textColor="#B3FFFFFF" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="状态"
|
||||||
|
android:textColor="#B3FFFFFF" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="操作"
|
||||||
|
android:textColor="#B3FFFFFF" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="关注"
|
||||||
|
android:textColor="#B3FFFFFF" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
46
live/src/main/res/layout/item_random_pk_rv_search.xml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/random_pk_search_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:background="@drawable/bg_random_pk_rv_search"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/search_icon"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="18dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
app:srcCompat="@mipmap/ic_random_pk_search" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/search_edit"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@null"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="@string/random_pk_search_hint"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textColorHint="#80FFFFFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/search_clear"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
app:srcCompat="@mipmap/ic_random_pk_clear" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -607,7 +607,7 @@
|
|||||||
android:id="@+id/live_time"
|
android:id="@+id/live_time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_alignTop="@id/hour_rank_layout"
|
android:layout_below="@id/hour_rank_layout"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:background="@drawable/bg_live_push_time"
|
android:background="@drawable/bg_live_push_time"
|
||||||
@ -623,6 +623,20 @@
|
|||||||
app:dt_left_height="4dp"
|
app:dt_left_height="4dp"
|
||||||
app:dt_left_width="4dp" />
|
app:dt_left_width="4dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/random_pk_timer"
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_below="@id/live_time"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@drawable/bg_live_room_random_pk_timer"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/random_pk_info_btn_ing"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textSize="10sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/goto_room_view"
|
android:id="@+id/goto_room_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -1231,6 +1245,7 @@
|
|||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
android:id="@+id/live_item_view_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:translationX="0dp">
|
android:translationX="0dp">
|
||||||
@ -1274,9 +1289,9 @@
|
|||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:background="@drawable/bg_live_item_pk_rank_red"
|
android:background="@drawable/bg_live_item_pk_rank_red"
|
||||||
android:paddingStart="17dp"
|
android:paddingStart="17dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="5dp"
|
||||||
android:paddingEnd="17dp"
|
android:paddingEnd="17dp"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="5dp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
@ -1292,9 +1307,9 @@
|
|||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:background="@drawable/bg_live_item_pk_rank_blue"
|
android:background="@drawable/bg_live_item_pk_rank_blue"
|
||||||
android:paddingStart="17dp"
|
android:paddingStart="17dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="5dp"
|
||||||
android:paddingEnd="17dp"
|
android:paddingEnd="17dp"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="5dp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
BIN
live/src/main/res/mipmap-xhdpi/ic_random_pk_clear.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
live/src/main/res/mipmap-xhdpi/ic_random_pk_like.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
live/src/main/res/mipmap-xhdpi/ic_random_pk_like_unselect.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
live/src/main/res/mipmap-xhdpi/ic_random_pk_pk.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
live/src/main/res/mipmap-xhdpi/ic_random_pk_pk_unselect.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
live/src/main/res/mipmap-xhdpi/ic_random_pk_search.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
@ -32,4 +32,22 @@
|
|||||||
<string name="live_mic_user_down" translatable="false">已踢下麥</string>
|
<string name="live_mic_user_down" translatable="false">已踢下麥</string>
|
||||||
<string name="live_mic_invite" translatable="false">已發出邀請,等待用戶接受</string>
|
<string name="live_mic_invite" translatable="false">已發出邀請,等待用戶接受</string>
|
||||||
<string name="live_mic_request" translatable="false">已同意請求,等待用戶接受</string>
|
<string name="live_mic_request" translatable="false">已同意請求,等待用戶接受</string>
|
||||||
|
<string name="random_pk_info_view_title" translatable="false">隨機PK</string>
|
||||||
|
<string name="random_pk_info_title" translatable="false">PK主要規則說明:</string>
|
||||||
|
<string name="random_pk_info_time_desc" translatable="false">隨機PK排位賽時間</string>
|
||||||
|
<string name="random_pk_info_time" translatable="false">12:00~17:00、19:00~23:59</string>
|
||||||
|
<string name="random_pk_info_desc_1" translatable="false">1、開始匹配後,系統將自動挑選對手進行PK;</string>
|
||||||
|
<string name="random_pk_info_desc_2" translatable="false">2、若長時間無法匹配到對手,可嘗試重新匹配;</string>
|
||||||
|
<string name="random_pk_info_desc_3" translatable="false">3、PK過程中卡頓及延遲,可先檢查個人設備及網絡後,嘗試重新登錄並開播;</string>
|
||||||
|
<string name="random_pk_info_desc_4" translatable="false">4、安全部門將會24小時巡查,請文明PK,嚴格遵守主播守則;</string>
|
||||||
|
<string name="random_pk_info_switch" translatable="false">隨機PK開關:</string>
|
||||||
|
<string name="random_pk_info_btn_start" translatable="false">開始匹配</string>
|
||||||
|
<string name="random_pk_info_btn_ing" translatable="false">匹配中 %s </string>
|
||||||
|
<string name="random_pk_info_btn_ing_desc" translatable="false">再次點擊可取消匹配</string>
|
||||||
|
<string name="random_pk_info_btn_end" translatable="false">正在退出匹配 %s</string>
|
||||||
|
<string name="random_pk_info_btn_end_desc" translatable="false">退出過程中也有可能匹配到對手</string>
|
||||||
|
<string name="random_pk_search_hint" translatable="false">請輸入您要pk的主播昵稱或id</string>
|
||||||
|
<string name="free_pk_user_pking" translatable="false">對方正在PK中</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -17,6 +17,7 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
@ -91,9 +92,12 @@ import com.yunbao.common.views.AbsMainViewHolder;
|
|||||||
import com.yunbao.common.views.floatingview.APPEasyFloat;
|
import com.yunbao.common.views.floatingview.APPEasyFloat;
|
||||||
import com.yunbao.common.views.weight.LiveFloatView;
|
import com.yunbao.common.views.weight.LiveFloatView;
|
||||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||||
|
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||||
|
import com.yunbao.live.dialog.RandomPkDialogFragment;
|
||||||
import com.yunbao.live.http.LiveHttpConsts;
|
import com.yunbao.live.http.LiveHttpConsts;
|
||||||
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.presenter.LiveRyLinkMicPkPresenter;
|
||||||
import com.yunbao.live.utils.LiveStorge;
|
import com.yunbao.live.utils.LiveStorge;
|
||||||
import com.yunbao.live.views.ChatListViewHolder;
|
import com.yunbao.live.views.ChatListViewHolder;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
@ -638,7 +642,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
//关注
|
//关注
|
||||||
FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0);
|
FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0);
|
||||||
} else if (i == R.id.img_trophy) {
|
} else if (i == R.id.img_trophy) {
|
||||||
MainListActivity.forward(mContext, 0);
|
// MainListActivity.forward(mContext, 0);
|
||||||
|
RandomPkDialogFragment fragment = new RandomPkDialogFragment();
|
||||||
|
fragment.show(this.getSupportFragmentManager(), "RandomPkDialogFragment");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|