优化:调整天梯赛左右下角连胜字样大小
update 随机PK
This commit is contained in:
parent
9eff246f06
commit
3fa259c5b9
128
common/src/main/java/com/yunbao/common/bean/RankPkInfoBean.java
Normal file
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);
|
||||
}
|
||||
}
|
@ -63,6 +63,8 @@ public class UserBean implements Parcelable {
|
||||
private boolean isHide = false;
|
||||
//是否为随机PK,仅在主播PK时使用
|
||||
private boolean randomPk;
|
||||
//随机天梯排位赛PK img,仅在主播PK时使用
|
||||
private String mRankPkImgUrl;
|
||||
|
||||
public boolean isRandomPk() {
|
||||
return randomPk;
|
||||
@ -72,6 +74,14 @@ public class UserBean implements Parcelable {
|
||||
this.randomPk = randomPk;
|
||||
}
|
||||
|
||||
public String getRankPkImgUrl() {
|
||||
return mRankPkImgUrl;
|
||||
}
|
||||
|
||||
public void setRankPkImgUrl(String mRankPkImgUrl) {
|
||||
this.mRankPkImgUrl = mRankPkImgUrl;
|
||||
}
|
||||
|
||||
public boolean isHide() {
|
||||
return isHide;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
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.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
@ -388,4 +389,9 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@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.util.Log;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
@ -20,6 +21,7 @@ import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
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.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
@ -598,8 +600,12 @@ public class LiveNetManager {
|
||||
@Override
|
||||
public void accept(ResponseModel<String> responseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess("98196");
|
||||
// callback.onSuccess(responseModel.getData().getInfo());
|
||||
if(CommonAppConfig.getInstance().getUid().equals("98196")) {
|
||||
callback.onSuccess("98274");
|
||||
}else{
|
||||
callback.onSuccess("98196");
|
||||
}
|
||||
// callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@ -611,6 +617,7 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 自由PK开始后调用接口扣掉次数
|
||||
*/
|
||||
@ -637,7 +644,7 @@ public class LiveNetManager {
|
||||
/**
|
||||
* 随机PK后调用接口给后台记录
|
||||
*/
|
||||
public void startRandomPK(String pkuid,HttpCallback<Boolean> callback) {
|
||||
public void startRandomPK(String pkuid, HttpCallback<Boolean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.startRandomPK(pkuid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -665,6 +672,7 @@ public class LiveNetManager {
|
||||
|
||||
/**
|
||||
* 随机PK后调用接口给后台记录
|
||||
*
|
||||
* @param cs 简体关键字/uid
|
||||
* @param ct 繁体关键字/uid
|
||||
*/
|
||||
@ -691,6 +699,7 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝随机PK
|
||||
*/
|
||||
@ -713,6 +722,32 @@ public class LiveNetManager {
|
||||
}
|
||||
}).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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -4,6 +4,7 @@ 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;
|
||||
@ -14,25 +15,30 @@ 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;
|
||||
public final static int PK_STATUS_REFUSE = 3;
|
||||
public final static int PK_STATUS_EXIT_ING = 4;
|
||||
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 min = -1;//匹配计时器 分钟
|
||||
private int sec = -1;//匹配计时器 秒钟
|
||||
private int status = PK_STATUS_DEFAULT;
|
||||
private Timer timer;
|
||||
private TimerTask task;
|
||||
private List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();
|
||||
private String pkUid;
|
||||
private final List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();//监听器集合
|
||||
private String pkUid;//对方房间ID
|
||||
private RankPkInfoBean rankPkInfoBean;//排位赛信息
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private RandomPkManager() {
|
||||
getRankInfo();
|
||||
initTask();
|
||||
}
|
||||
|
||||
@ -43,23 +49,35 @@ public class 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;
|
||||
@ -86,11 +104,20 @@ public class RandomPkManager {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化匹配时间
|
||||
*/
|
||||
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
|
||||
@ -108,6 +135,16 @@ public class RandomPkManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为排位赛模式
|
||||
*/
|
||||
public boolean isRankModel() {
|
||||
return rankPkInfoBean != null && rankPkInfoBean.isRankPKTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始匹配
|
||||
*/
|
||||
public boolean start() {
|
||||
if (status == PK_STATUS_START) {
|
||||
ToastUtil.show("PK中");
|
||||
@ -126,28 +163,55 @@ public class RandomPkManager {
|
||||
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;
|
||||
@ -175,6 +239,9 @@ public class RandomPkManager {
|
||||
}, 0, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出连麦
|
||||
*/
|
||||
public void end() {
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
@ -185,10 +252,16 @@ public class RandomPkManager {
|
||||
callEnd();
|
||||
}
|
||||
|
||||
public boolean isPking() {
|
||||
/**
|
||||
* 是否正在匹配中
|
||||
*/
|
||||
public boolean isRequestPk() {
|
||||
return status == PK_STATUS_REQUEST;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,结束匹配
|
||||
*/
|
||||
private void callEnd() {
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
@ -201,6 +274,9 @@ public class RandomPkManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,开始匹配
|
||||
*/
|
||||
private void callStart() {
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
@ -225,6 +301,9 @@ public class RandomPkManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,对方拒绝PK
|
||||
*/
|
||||
private void callRefuse() {
|
||||
handler.post(() -> {
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
@ -233,8 +312,11 @@ public class RandomPkManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置PK状态
|
||||
*/
|
||||
public void setPkStatus(int status) {
|
||||
if(status==PK_STATUS_DEFAULT){//默认状态下不响应随机PK接口
|
||||
if (this.status == PK_STATUS_DEFAULT || this.status == PK_STATUS_EXIT_ING) {//默认状态下不响应随机PK接口
|
||||
return;
|
||||
}
|
||||
this.status = status;
|
||||
@ -252,38 +334,69 @@ public class RandomPkManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否正在退出匹配中
|
||||
*/
|
||||
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() {
|
||||
}
|
||||
}
|
||||
|
@ -705,7 +705,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
*/
|
||||
@Override
|
||||
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) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||
Handler handler = new Handler();
|
||||
|
@ -163,7 +163,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
public void onStartPK(String pkUid) {
|
||||
ToastUtil.show("发起随机PK:" + pkUid);
|
||||
JSONObject msg1 = buildLinkMicJSON();
|
||||
msg1.put("randomPk", true);
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -2,48 +2,26 @@ 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.utils.DialogUitl;
|
||||
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 com.yunbao.common.manager.RandomPkManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* 随机PK
|
||||
*/
|
||||
@ -154,7 +132,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
|
||||
private void initData() {
|
||||
RandomPkManager.getInstance().addOnRandomPkTimer(randomPkTimer);
|
||||
initPkSwitch();
|
||||
if (RandomPkManager.getInstance().isPking()) {
|
||||
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);
|
||||
@ -240,7 +218,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
|
||||
ToastUtil.show("未开启随机PK开关");
|
||||
return;
|
||||
}
|
||||
if ((mPkBtn.getTag() != null && (boolean) mPkBtn.getTag()) || RandomPkManager.getInstance().isPking()) {
|
||||
if ((mPkBtn.getTag() != null && (boolean) mPkBtn.getTag()) || RandomPkManager.getInstance().isRequestPk()) {
|
||||
RandomPkManager.getInstance().exitPk();
|
||||
return;
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
|
||||
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
|
||||
public void onSuccess() {
|
||||
RCRTCEngine.getInstance().joinOtherRoom(mApplyUid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
|
||||
|
@ -32,6 +32,7 @@ import com.yunbao.common.bean.SocketModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@ -1053,9 +1054,7 @@ public class SocketRyClient {
|
||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
||||
break;
|
||||
case 3://对方主播拒绝PK的回调
|
||||
if (map.containsKey("randomPk") && map.getString("randomPk").equals("true")) {
|
||||
}
|
||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||
mListener.onLinkMicPkRefuse();
|
||||
break;
|
||||
case 4://所有人收到PK开始址的回调
|
||||
@ -1102,10 +1101,7 @@ public class SocketRyClient {
|
||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||
if (rtcRoom == null) {
|
||||
return;
|
||||
}
|
||||
rtcRoom.getLocalUser().requestJoinOtherRoom(map.getString("uid"), map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() {
|
||||
IMRTCManager.getInstance().requestJoinOtherRoom(map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
ToastUtil.show("邀请 " + map.getString("uid") + " 发送成功");
|
||||
|
@ -238,7 +238,8 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
JSONObject map = JSONObject.parseObject(extra);
|
||||
userBean1.setAvatar(map.getString("pkhead"));
|
||||
userBean1.setUserNiceName(map.getString("pkname"));
|
||||
userBean1.setRandomPk(map.containsKey("randomPk") ? map.getBoolean("randomPk") : false);
|
||||
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.setUserNiceName(map.getString("pkname"));
|
||||
userBean1.setAvatar(map.getString("pkhead"));
|
||||
|
@ -328,7 +328,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
private TextView mRandomPkTimer;
|
||||
|
||||
|
||||
|
||||
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
|
||||
super(context, parentView);
|
||||
Contexts = context;
|
||||
@ -1627,6 +1626,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.leftMargin = 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 titleView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
|
||||
@ -1793,7 +1793,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
avatar_l1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (uidL1 != null && !"".equals(uidL1)) {
|
||||
if (uidL1 != null && !"" .equals(uidL1)) {
|
||||
showUserDialog(uidL1);
|
||||
}
|
||||
}
|
||||
@ -1801,7 +1801,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
avatar_l2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (uidL2 != null && !"".equals(uidL2)) {
|
||||
if (uidL2 != null && !"" .equals(uidL2)) {
|
||||
showUserDialog(uidL2);
|
||||
}
|
||||
}
|
||||
@ -1809,7 +1809,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
avatar_l3.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (uidL3 != null && !"".equals(uidL3)) {
|
||||
if (uidL3 != null && !"" .equals(uidL3)) {
|
||||
showUserDialog(uidL3);
|
||||
}
|
||||
}
|
||||
@ -1817,7 +1817,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
avatar_r1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (uidR1 != null && !"".equals(uidR1)) {
|
||||
if (uidR1 != null && !"" .equals(uidR1)) {
|
||||
showUserDialog(uidR1);
|
||||
}
|
||||
}
|
||||
@ -1825,7 +1825,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
avatar_r2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (uidR2 != null && !"".equals(uidR2)) {
|
||||
if (uidR2 != null && !"" .equals(uidR2)) {
|
||||
showUserDialog(uidR2);
|
||||
}
|
||||
}
|
||||
@ -1833,7 +1833,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
avatar_r3.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (uidR3 != null && !"".equals(uidR3)) {
|
||||
if (uidR3 != null && !"" .equals(uidR3)) {
|
||||
showUserDialog(uidR3);
|
||||
}
|
||||
}
|
||||
@ -3030,7 +3030,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
if ("1".equals(info[0])) {
|
||||
if ("1" .equals(info[0])) {
|
||||
ft_hot_add.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ft_hot_add.setVisibility(View.GONE);
|
||||
@ -3045,7 +3045,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
*/
|
||||
public static void getIsHot(String isUseHotCard) {
|
||||
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);
|
||||
} else {
|
||||
ft_hot_add.setVisibility(View.GONE);
|
||||
@ -3343,7 +3343,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
} else if (bean.getActivityId() == 0) {
|
||||
openWebDialog(bean.getLink());
|
||||
} else {
|
||||
LiveGameDialogFragment fragment = new LiveGameDialogFragment("1".equals(bean.getShow_type()));
|
||||
LiveGameDialogFragment fragment = new LiveGameDialogFragment("1" .equals(bean.getShow_type()));
|
||||
fragment.setActivityId(bean.getActivityId());
|
||||
fragment.setRoomId(mLiveUid);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
|
||||
@ -3394,7 +3394,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
nowTime = time;
|
||||
tv_trickery_time.setText("" + nowTime);
|
||||
openType = 0;
|
||||
if ("1".equals(msgtype)) {
|
||||
if ("1" .equals(msgtype)) {
|
||||
nums = jsonObject.getString("nums");
|
||||
prankid = jsonObject.getString("prankid");
|
||||
content = jsonObject.getString("content");
|
||||
@ -3558,21 +3558,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onUpdata(String str) {
|
||||
if ("svga_new_user_gif".equals(str)) {
|
||||
if ("svga_new_user_gif" .equals(str)) {
|
||||
if (fastMsgRecyclerView == null) return;
|
||||
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
|
||||
fastMsgRecyclerView.getLayoutParams();
|
||||
params1.rightMargin = DeviceUtils.getScreenWidth((Activity) mContext) / 3;
|
||||
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;
|
||||
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
|
||||
fastMsgRecyclerView.getLayoutParams();
|
||||
params1.rightMargin = 0;
|
||||
fastMsgRecyclerView.setLayoutParams(params1);
|
||||
} else if ("showBanner".equals(str)) {
|
||||
} else if ("showBanner" .equals(str)) {
|
||||
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");
|
||||
mBanner3.update(mBannerList3);
|
||||
@ -3583,7 +3583,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");
|
||||
|
||||
mBanner3.update(mBannerList3);
|
||||
@ -3594,7 +3594,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);
|
||||
mBannerList3.get(0).setLink("1");
|
||||
mBanner3.update(mBannerList3);
|
||||
|
@ -1220,6 +1220,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
@Override
|
||||
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) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||
Handler handler = new Handler();
|
||||
|
@ -58,7 +58,15 @@
|
||||
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"
|
||||
@ -66,7 +74,7 @@
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:text="@string/random_pk_info_desc_4"
|
||||
android:text="@string/random_pk_info_time"
|
||||
android:textColor="#F6F7FB"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
@ -1289,9 +1289,9 @@
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/bg_live_item_pk_rank_red"
|
||||
android:paddingStart="17dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="17dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
@ -1307,9 +1307,9 @@
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/bg_live_item_pk_rank_blue"
|
||||
android:paddingStart="17dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="17dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
|
@ -34,9 +34,11 @@
|
||||
<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_desc_1" translatable="false">1、開始匹配後,系統將會自動給您挑選對手進行PK;</string>
|
||||
<string name="random_pk_info_desc_2" translatable="false">2、每場PK總時長10分鍾,懲罰時間為1分鍾;</string>
|
||||
<string name="random_pk_info_desc_3" translatable="false">3、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>
|
||||
|
Loading…
Reference in New Issue
Block a user