处罚通知,修改网络请求和activity跳转代码
This commit is contained in:
parent
dbd684a6e2
commit
cb87974320
@ -1,4 +1,4 @@
|
||||
package com.yunbao.live.bean;
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
//处罚消息的对象
|
||||
public class PunishBean {
|
@ -1344,4 +1344,9 @@ public interface PDLiveApi {
|
||||
@Query("gift_id")String giftId,
|
||||
@Query("live_uid")String liveUid
|
||||
);
|
||||
|
||||
//处罚通知红点
|
||||
@GET("/api/public/?service=Message.penalizeStatus")
|
||||
Observable<ResponseModel> getPenalizeStatus();
|
||||
|
||||
}
|
||||
|
@ -91,6 +91,8 @@ import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -2301,20 +2303,21 @@ public class LiveNetManager {
|
||||
|
||||
/**
|
||||
* 获取房间金豆门槛和赢家获得的金豆
|
||||
*
|
||||
* @param roomId
|
||||
* @param callback
|
||||
*/
|
||||
public void getScore(String roomId,HttpCallback<SudGameScoreBean> callback){
|
||||
public void getScore(String roomId, HttpCallback<SudGameScoreBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getScore(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(sudGameScoreBeanResponseModel -> {
|
||||
if (callback != null){
|
||||
if (callback != null) {
|
||||
callback.onSuccess(sudGameScoreBeanResponseModel.getData().getInfo());
|
||||
}
|
||||
}, throwable -> {
|
||||
if (callback != null){
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}).isDisposed();
|
||||
@ -2322,20 +2325,21 @@ public class LiveNetManager {
|
||||
|
||||
/**
|
||||
* 获取游戏中所有玩家的信息
|
||||
*
|
||||
* @param roomId
|
||||
* @param callback
|
||||
*/
|
||||
public void getSudGameInfo(String roomId,HttpCallback<List<SudGameInfoBean>> callback){
|
||||
public void getSudGameInfo(String roomId, HttpCallback<List<SudGameInfoBean>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getSudGameInfo(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(infoModel->{
|
||||
if (callback != null){
|
||||
.subscribe(infoModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(infoModel.getData().getInfo());
|
||||
}
|
||||
},throwable -> {
|
||||
if (callback != null){
|
||||
}, throwable -> {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}).isDisposed();
|
||||
@ -3061,9 +3065,9 @@ public class LiveNetManager {
|
||||
|
||||
}
|
||||
|
||||
public void openGuard(String liveUid, String guardType, String priceKey, String stream,String coupon_type,String couponId, HttpCallback<String> callback) {
|
||||
public void openGuard(String liveUid, String guardType, String priceKey, String stream, String coupon_type, String couponId, HttpCallback<String> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.openGuard(liveUid, guardType, priceKey, stream,coupon_type,couponId)
|
||||
.openGuard(liveUid, guardType, priceKey, stream, coupon_type, couponId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||
@ -3572,9 +3576,9 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void userUseDress( String usersDressId, HttpCallback<HttpCallbackModel> callback) {
|
||||
public void userUseDress(String usersDressId, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.userUseDress(usersDressId,3)
|
||||
.userUseDress(usersDressId, 3)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@ -3602,6 +3606,42 @@ public class LiveNetManager {
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
}
|
||||
|
||||
public void getPenalizeStatus(HttpCallback<ResponseModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getPenalizeStatus()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel>() {
|
||||
@Override
|
||||
public void accept(ResponseModel responseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
if (responseModel.getData().getCode() == 0) {
|
||||
String s = responseModel.getData().getInfo().toString();
|
||||
try {
|
||||
JSONObject ob = new JSONObject(s);
|
||||
if (ob.getInt("unread_num") > 0) {
|
||||
callback.onSuccess(responseModel);
|
||||
} else {
|
||||
callback.onError("");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
callback.onError("");
|
||||
}
|
||||
} else {
|
||||
callback.onError("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
@ -56,6 +55,7 @@ public class RouteUtil {
|
||||
public static final String PATH_FEEDBACK_SUCCESS_ACTIVITY = "/main/FeedbackSuccessActivity";
|
||||
public static final String PATH_FEEDBACK_ACTIVITY = "/main/FeedbackActivity";
|
||||
public static final String PATH_FEEDBACK_EDIT_ACTIVITY = "/main/FeedbackEditActivity";
|
||||
public static final String PATH_LIVE_PUNISHACTIVITY = "/live/PunishActivity";
|
||||
|
||||
|
||||
public static void forwardCommunityActivity() {
|
||||
@ -379,4 +379,11 @@ public class RouteUtil {
|
||||
ARouter.getInstance().build(path)
|
||||
.navigation();
|
||||
}
|
||||
/**
|
||||
* 处罚通知界面
|
||||
*/
|
||||
public static void forwardPunishActivity() {
|
||||
ARouter.getInstance().build(PATH_LIVE_PUNISHACTIVITY)
|
||||
.navigation();
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,16 @@ package com.yunbao.live.activity;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.PunishAdapter;
|
||||
import com.yunbao.live.bean.PunishBean;
|
||||
import com.yunbao.common.bean.PunishBean;
|
||||
import com.yunbao.live.http.ImHttpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -17,6 +19,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
//处罚通知单
|
||||
@Route(path = RouteUtil.PATH_LIVE_PUNISHACTIVITY)
|
||||
public class PunishActivity extends AbsActivity {
|
||||
|
||||
private CommonRefreshView mRefreshView;
|
||||
|
@ -11,13 +11,12 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.activity.SelectImageActivity;
|
||||
import com.yunbao.common.bean.ImageEntity;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.views.SystemMessageViewHolder;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
@ -76,8 +75,7 @@ public class SystemMessageActivity extends AbsActivity {
|
||||
punish.setVisibility(View.VISIBLE);
|
||||
punishNotice = findViewById(R.id.tv_sys_msg_punish_notice);
|
||||
punish.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(getApplicationContext(), PunishActivity.class);
|
||||
startActivity(intent);
|
||||
RouteUtil.forwardPunishActivity();
|
||||
punishNotice.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
@ -87,24 +85,16 @@ public class SystemMessageActivity extends AbsActivity {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
ImHttpUtil.getPenalizeStatus(new HttpCallback() {
|
||||
LiveNetManager.get(mContext).getPenalizeStatus(new com.yunbao.common.http.base.HttpCallback<ResponseModel>() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info != null && info.length > 0) {
|
||||
try {
|
||||
JSONObject ob = new JSONObject(info[0]);
|
||||
if (ob.getInt("unread_num") > 0) {
|
||||
public void onSuccess(ResponseModel responseModel) {
|
||||
punishNotice.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
punishNotice.setVisibility(View.GONE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
punishNotice.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
punishNotice.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.PunishBean;
|
||||
import com.yunbao.common.bean.PunishBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user