update 随机PK拒绝对话框
This commit is contained in:
parent
f62a093092
commit
285a33ff9a
@ -61,6 +61,16 @@ public class UserBean implements Parcelable {
|
|||||||
private int praise;
|
private int praise;
|
||||||
//是否隐藏
|
//是否隐藏
|
||||||
private boolean isHide = false;
|
private boolean isHide = false;
|
||||||
|
//是否为随机PK,仅在主播PK时使用
|
||||||
|
private boolean randomPk;
|
||||||
|
|
||||||
|
public boolean isRandomPk() {
|
||||||
|
return randomPk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRandomPk(boolean randomPk) {
|
||||||
|
this.randomPk = randomPk;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isHide() {
|
public boolean isHide() {
|
||||||
return isHide;
|
return isHide;
|
||||||
|
@ -370,7 +370,7 @@ public interface PDLiveApi {
|
|||||||
* 随机PK后调用接口给后台记录
|
* 随机PK后调用接口给后台记录
|
||||||
*/
|
*/
|
||||||
@GET("/api/public/?service=Livepk.startRandomPK")
|
@GET("/api/public/?service=Livepk.startRandomPK")
|
||||||
Observable<ResponseModel<BaseModel>> startRandomPK();
|
Observable<ResponseModel<BaseModel>> startRandomPK(@Query("pkuid")String pkuid);
|
||||||
/**
|
/**
|
||||||
* 自由PK开始后调用接口扣掉次数
|
* 自由PK开始后调用接口扣掉次数
|
||||||
*/
|
*/
|
||||||
@ -383,4 +383,9 @@ public interface PDLiveApi {
|
|||||||
*/
|
*/
|
||||||
@GET("/api/public/?service=Livepk.searchUser")
|
@GET("/api/public/?service=Livepk.searchUser")
|
||||||
Observable<ResponseModel<List<RandomPkUserBean>>> randomPkSearchUser(@Query("jian_key")String cs,@Query("fan_key")String ct);
|
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();
|
||||||
}
|
}
|
||||||
|
@ -637,9 +637,9 @@ public class LiveNetManager {
|
|||||||
/**
|
/**
|
||||||
* 随机PK后调用接口给后台记录
|
* 随机PK后调用接口给后台记录
|
||||||
*/
|
*/
|
||||||
public void startRandomPK(HttpCallback<Boolean> callback) {
|
public void startRandomPK(String pkuid,HttpCallback<Boolean> callback) {
|
||||||
API.get().pdLiveApi(mContext)
|
API.get().pdLiveApi(mContext)
|
||||||
.startRandomPK()
|
.startRandomPK(pkuid)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||||
@ -691,7 +691,28 @@ public class LiveNetManager {
|
|||||||
}
|
}
|
||||||
}).isDisposed();
|
}).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();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 直播间取消网络请求
|
* 直播间取消网络请求
|
||||||
*/
|
*/
|
||||||
|
@ -29,6 +29,7 @@ public class RandomPkManager {
|
|||||||
private Timer timer;
|
private Timer timer;
|
||||||
private TimerTask task;
|
private TimerTask task;
|
||||||
private List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();
|
private List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();
|
||||||
|
private String pkUid;
|
||||||
Handler handler = new Handler(Looper.getMainLooper());
|
Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
private RandomPkManager() {
|
private RandomPkManager() {
|
||||||
@ -94,6 +95,7 @@ public class RandomPkManager {
|
|||||||
.randomPK(new HttpCallback<String>() {
|
.randomPK(new HttpCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String data) {
|
public void onSuccess(String data) {
|
||||||
|
pkUid = data;
|
||||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||||
pkTimer.onStartPK(data);
|
pkTimer.onStartPK(data);
|
||||||
}
|
}
|
||||||
@ -179,6 +181,7 @@ public class RandomPkManager {
|
|||||||
}
|
}
|
||||||
task = null;
|
task = null;
|
||||||
status = PK_STATUS_DEFAULT;
|
status = PK_STATUS_DEFAULT;
|
||||||
|
pkUid = null;
|
||||||
callEnd();
|
callEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +211,18 @@ public class RandomPkManager {
|
|||||||
pkTimer.onPking();
|
pkTimer.onPking();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||||
|
.startRandomPK(pkUid, new HttpCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void callRefuse() {
|
private void callRefuse() {
|
||||||
@ -228,8 +243,8 @@ public class RandomPkManager {
|
|||||||
callEnd();
|
callEnd();
|
||||||
break;
|
break;
|
||||||
case PK_STATUS_REFUSE:
|
case PK_STATUS_REFUSE:
|
||||||
callRefuse();
|
//callRefuse();
|
||||||
//nextPk();
|
nextPk();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 城市选择
|
* 城市选择
|
||||||
|
71
common/src/main/res/layout/dialog_live_random_pk.xml
Normal file
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>
|
@ -966,4 +966,9 @@
|
|||||||
<string name="more_settings" translatable="false">更多設置</string>
|
<string name="more_settings" translatable="false">更多設置</string>
|
||||||
<string name="moer">查看更多</string>
|
<string name="moer">查看更多</string>
|
||||||
<string name="gift_way">礼物正在获取中...</string>
|
<string name="gift_way">礼物正在获取中...</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>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.yunbao.live.presenter;
|
package com.yunbao.live.presenter;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@ -10,6 +11,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;
|
||||||
@ -18,6 +20,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@ -26,9 +29,11 @@ import com.yunbao.common.CommonAppConfig;
|
|||||||
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.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMRTCManager;
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
import com.yunbao.common.manager.RandomPkManager;
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
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;
|
||||||
@ -47,9 +52,14 @@ import com.yunbao.live.socket.SocketSendBean;
|
|||||||
import com.yunbao.live.views.LiveLinkMicPkViewHolder;
|
import com.yunbao.live.views.LiveLinkMicPkViewHolder;
|
||||||
import com.yunbao.live.views.LivePushRyViewHolder;
|
import com.yunbao.live.views.LivePushRyViewHolder;
|
||||||
|
|
||||||
|
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;
|
||||||
@ -76,7 +86,6 @@ 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;
|
||||||
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
|
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
|
||||||
import static com.yunbao.live.views.AbsRyLivePushViewHolder.leave;
|
|
||||||
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
|
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
|
||||||
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView1;
|
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView1;
|
||||||
import static com.yunbao.live.views.LivePushRyViewHolder.contexts;
|
import static com.yunbao.live.views.LivePushRyViewHolder.contexts;
|
||||||
@ -579,7 +588,8 @@ 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);
|
// showApplyDialog(u);
|
||||||
|
showPkDialog(u);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isPK();
|
isPK();
|
||||||
@ -993,46 +1003,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
|
||||||
|
|
||||||
@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;
|
||||||
@ -1160,6 +1131,132 @@ 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 -> {
|
||||||
|
refuse();
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void refuse() {
|
||||||
|
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||||
|
|
||||||
|
@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());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
LiveNetManager.get(mContext).setBanRandomPK(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
void apply() {
|
||||||
|
isPK();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build().show();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示申请多人PK的弹窗
|
* 显示申请多人PK的弹窗
|
||||||
*/
|
*/
|
||||||
@ -1276,7 +1373,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/>
|
||||||
*/
|
*/
|
||||||
IMRTCManager.getInstance().requestJoinOtherRoom(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() {
|
||||||
}
|
}
|
||||||
@ -1352,7 +1449,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(),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) {
|
||||||
@ -1878,7 +1975,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) {
|
||||||
@ -1997,7 +2094,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,9 +224,21 @@ 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("randomPk") ? map.getBoolean("randomPk") : false);
|
||||||
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"));
|
||||||
|
@ -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,10 +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.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;
|
||||||
|
Loading…
Reference in New Issue
Block a user