update 随机PK拒绝对话框
This commit is contained in:
@@ -61,6 +61,16 @@ public class UserBean implements Parcelable {
|
||||
private int praise;
|
||||
//是否隐藏
|
||||
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() {
|
||||
return isHide;
|
||||
|
||||
@@ -370,7 +370,7 @@ public interface PDLiveApi {
|
||||
* 随机PK后调用接口给后台记录
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.startRandomPK")
|
||||
Observable<ResponseModel<BaseModel>> startRandomPK();
|
||||
Observable<ResponseModel<BaseModel>> startRandomPK(@Query("pkuid")String pkuid);
|
||||
/**
|
||||
* 自由PK开始后调用接口扣掉次数
|
||||
*/
|
||||
@@ -383,4 +383,9 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@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();
|
||||
}
|
||||
|
||||
@@ -637,9 +637,9 @@ public class LiveNetManager {
|
||||
/**
|
||||
* 随机PK后调用接口给后台记录
|
||||
*/
|
||||
public void startRandomPK(HttpCallback<Boolean> callback) {
|
||||
public void startRandomPK(String pkuid,HttpCallback<Boolean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.startRandomPK()
|
||||
.startRandomPK(pkuid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
@@ -691,7 +691,28 @@ public class LiveNetManager {
|
||||
}
|
||||
}).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 TimerTask task;
|
||||
private List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();
|
||||
private String pkUid;
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private RandomPkManager() {
|
||||
@@ -94,6 +95,7 @@ public class RandomPkManager {
|
||||
.randomPK(new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
pkUid = data;
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onStartPK(data);
|
||||
}
|
||||
@@ -179,6 +181,7 @@ public class RandomPkManager {
|
||||
}
|
||||
task = null;
|
||||
status = PK_STATUS_DEFAULT;
|
||||
pkUid = null;
|
||||
callEnd();
|
||||
}
|
||||
|
||||
@@ -208,6 +211,18 @@ public class RandomPkManager {
|
||||
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() {
|
||||
@@ -228,8 +243,8 @@ public class RandomPkManager {
|
||||
callEnd();
|
||||
break;
|
||||
case PK_STATUS_REFUSE:
|
||||
callRefuse();
|
||||
//nextPk();
|
||||
//callRefuse();
|
||||
nextPk();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.yunbao.common.utils;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.SparseArray;
|
||||
@@ -322,7 +324,9 @@ public class DialogUitl {
|
||||
private int mLength;
|
||||
private SimpleCallback mClickCallback;
|
||||
private SimpleCallback3 mClickCallback3;
|
||||
private SimpleCallbackView mSimpleCallbackView;
|
||||
private int mView = 0;
|
||||
private CharSequence mSpanned;
|
||||
|
||||
public Builder(Context context) {
|
||||
mContext = context;
|
||||
@@ -335,6 +339,18 @@ public class DialogUitl {
|
||||
|
||||
public Builder setContent(String 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;
|
||||
}
|
||||
|
||||
@@ -413,6 +429,9 @@ public class DialogUitl {
|
||||
if (!TextUtils.isEmpty(mContent)) {
|
||||
content.setText(mContent);
|
||||
}
|
||||
if (mSpanned != null) {
|
||||
content.setText(mSpanned);
|
||||
}
|
||||
if (mInputType == INPUT_TYPE_NUMBER) {
|
||||
content.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
} else if (mInputType == INPUT_TYPE_NUMBER_PASSWORD) {
|
||||
@@ -443,23 +462,33 @@ public class DialogUitl {
|
||||
mClickCallback.onConfirmClick(dialog, "");
|
||||
}
|
||||
} else {
|
||||
dialog.dismiss();
|
||||
|
||||
if (mClickCallback3 != null) {
|
||||
mClickCallback3.onConfirmClick(dialog);
|
||||
}
|
||||
if (mSimpleCallbackView != null) {
|
||||
mSimpleCallbackView.onConfirmClick(dialog,titleView, content, btnConfirm, btnCancel);
|
||||
}else{
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
dialog.dismiss();
|
||||
|
||||
if (mClickCallback3 != null) {
|
||||
mClickCallback3.onCancel();
|
||||
|
||||
dialog.dismiss();
|
||||
} else {
|
||||
|
||||
if (mClickCallback instanceof SimpleCallback2) {
|
||||
((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);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -494,6 +531,14 @@ public class DialogUitl {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 城市选择
|
||||
|
||||
Reference in New Issue
Block a user