处罚通知,修改网络请求和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 {
|
public class PunishBean {
|
@ -1344,4 +1344,9 @@ public interface PDLiveApi {
|
|||||||
@Query("gift_id")String giftId,
|
@Query("gift_id")String giftId,
|
||||||
@Query("live_uid")String liveUid
|
@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.http.base.HttpCallback;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -2301,6 +2303,7 @@ public class LiveNetManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取房间金豆门槛和赢家获得的金豆
|
* 获取房间金豆门槛和赢家获得的金豆
|
||||||
|
*
|
||||||
* @param roomId
|
* @param roomId
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
@ -2322,6 +2325,7 @@ public class LiveNetManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取游戏中所有玩家的信息
|
* 获取游戏中所有玩家的信息
|
||||||
|
*
|
||||||
* @param roomId
|
* @param roomId
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
@ -3602,6 +3606,42 @@ public class LiveNetManager {
|
|||||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
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;
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
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_SUCCESS_ACTIVITY = "/main/FeedbackSuccessActivity";
|
||||||
public static final String PATH_FEEDBACK_ACTIVITY = "/main/FeedbackActivity";
|
public static final String PATH_FEEDBACK_ACTIVITY = "/main/FeedbackActivity";
|
||||||
public static final String PATH_FEEDBACK_EDIT_ACTIVITY = "/main/FeedbackEditActivity";
|
public static final String PATH_FEEDBACK_EDIT_ACTIVITY = "/main/FeedbackEditActivity";
|
||||||
|
public static final String PATH_LIVE_PUNISHACTIVITY = "/live/PunishActivity";
|
||||||
|
|
||||||
|
|
||||||
public static void forwardCommunityActivity() {
|
public static void forwardCommunityActivity() {
|
||||||
@ -379,4 +379,11 @@ public class RouteUtil {
|
|||||||
ARouter.getInstance().build(path)
|
ARouter.getInstance().build(path)
|
||||||
.navigation();
|
.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 androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.custom.CommonRefreshView;
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.adapter.PunishAdapter;
|
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 com.yunbao.live.http.ImHttpUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -17,6 +19,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//处罚通知单
|
//处罚通知单
|
||||||
|
@Route(path = RouteUtil.PATH_LIVE_PUNISHACTIVITY)
|
||||||
public class PunishActivity extends AbsActivity {
|
public class PunishActivity extends AbsActivity {
|
||||||
|
|
||||||
private CommonRefreshView mRefreshView;
|
private CommonRefreshView mRefreshView;
|
||||||
|
@ -11,13 +11,12 @@ import com.yunbao.common.Constants;
|
|||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.activity.SelectImageActivity;
|
import com.yunbao.common.activity.SelectImageActivity;
|
||||||
import com.yunbao.common.bean.ImageEntity;
|
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.R;
|
||||||
import com.yunbao.live.http.ImHttpUtil;
|
|
||||||
import com.yunbao.live.views.SystemMessageViewHolder;
|
import com.yunbao.live.views.SystemMessageViewHolder;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -76,8 +75,7 @@ public class SystemMessageActivity extends AbsActivity {
|
|||||||
punish.setVisibility(View.VISIBLE);
|
punish.setVisibility(View.VISIBLE);
|
||||||
punishNotice = findViewById(R.id.tv_sys_msg_punish_notice);
|
punishNotice = findViewById(R.id.tv_sys_msg_punish_notice);
|
||||||
punish.setOnClickListener(v -> {
|
punish.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(getApplicationContext(), PunishActivity.class);
|
RouteUtil.forwardPunishActivity();
|
||||||
startActivity(intent);
|
|
||||||
punishNotice.setVisibility(View.GONE);
|
punishNotice.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -87,24 +85,16 @@ public class SystemMessageActivity extends AbsActivity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ImHttpUtil.getPenalizeStatus(new HttpCallback() {
|
LiveNetManager.get(mContext).getPenalizeStatus(new com.yunbao.common.http.base.HttpCallback<ResponseModel>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(ResponseModel responseModel) {
|
||||||
if (code == 0 && info != null && info.length > 0) {
|
|
||||||
try {
|
|
||||||
JSONObject ob = new JSONObject(info[0]);
|
|
||||||
if (ob.getInt("unread_num") > 0) {
|
|
||||||
punishNotice.setVisibility(View.VISIBLE);
|
punishNotice.setVisibility(View.VISIBLE);
|
||||||
} else {
|
|
||||||
punishNotice.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
punishNotice.setVisibility(View.GONE);
|
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.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.bean.PunishBean;
|
import com.yunbao.common.bean.PunishBean;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user