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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 城市选择
|
||||
|
||||
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="moer">查看更多</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>
|
||||
|
||||
Reference in New Issue
Block a user