diff --git a/common/src/main/java/com/yunbao/common/bean/PunishBean.java b/common/src/main/java/com/yunbao/common/bean/PunishBean.java new file mode 100644 index 000000000..3276d4434 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PunishBean.java @@ -0,0 +1,9 @@ +package com.yunbao.common.bean; + +//处罚消息的对象 +public class PunishBean { + + public String id; + public String title, content; + +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 0a745c642..93cd6743b 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1349,6 +1349,11 @@ public interface PDLiveApi { @Query("gift_id")String giftId, @Query("live_uid")String liveUid ); + + //处罚通知红点 + @GET("/api/public/?service=Message.penalizeStatus") + Observable getPenalizeStatus(); + @GET("/api/public/?service=Sudgameserver.ballClearanceTableStatus") Observable> ballClearanceTableStatus( @Query("room_id")String roomId diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 328c862f7..66aa1c9f7 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -95,6 +95,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; @@ -3716,6 +3718,42 @@ public class LiveNetManager { return MultipartBody.Part.createFormData("file", file.getName(), requestBody); } + public void getPenalizeStatus(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getPenalizeStatus() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer() { + @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() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 848f50514..424935060 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -1,6 +1,5 @@ package com.yunbao.common.utils; -import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -57,6 +56,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() { @@ -381,4 +381,11 @@ public class RouteUtil { ARouter.getInstance().build(path) .navigation(); } + /** + * 处罚通知界面 + */ + public static void forwardPunishActivity() { + ARouter.getInstance().build(PATH_LIVE_PUNISHACTIVITY) + .navigation(); + } } diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 5078aa0e2..93fb9515b 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1545,6 +1545,8 @@ 違規原因: 處罰內容: 處罰時間: + 處罰通知 + 門票 挑戰一桿清台,瓜分高額獎金 結算超時,請前往活動頁面查看本局結果 diff --git a/common/src/main/res/values/colors.xml b/common/src/main/res/values/colors.xml index d0ad06807..5fe3b1b9b 100644 --- a/common/src/main/res/values/colors.xml +++ b/common/src/main/res/values/colors.xml @@ -85,4 +85,6 @@ #FFF6F6F6 #F4F4F4 + #555555 + #525252 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index e8a7455d8..2afedff91 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1554,6 +1554,7 @@ Violation reasons: Penalty content: Penalty time: + Punishment Notice Ticket Challenge One-shot clearance Share high bonuses Settlement timed out. Please check the result on the event page diff --git a/live/src/main/AndroidManifest.xml b/live/src/main/AndroidManifest.xml index 4603df43e..c7c8a66b3 100644 --- a/live/src/main/AndroidManifest.xml +++ b/live/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> @@ -132,6 +131,10 @@ + \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/activity/PunishActivity.java b/live/src/main/java/com/yunbao/live/activity/PunishActivity.java new file mode 100644 index 000000000..84a016aba --- /dev/null +++ b/live/src/main/java/com/yunbao/live/activity/PunishActivity.java @@ -0,0 +1,81 @@ +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.common.bean.PunishBean; +import com.yunbao.live.http.ImHttpUtil; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +//处罚通知单 +@Route(path = RouteUtil.PATH_LIVE_PUNISHACTIVITY) +public class PunishActivity extends AbsActivity { + + private CommonRefreshView mRefreshView; + private PunishAdapter adapter; + private List mData = new ArrayList<>(); + + @Override + protected int getLayoutId() { + return R.layout.activity_punish; + } + + @Override + protected void main() { + super.main(); + findViewById(R.id.btn_back).setOnClickListener(v -> finish()); + mRefreshView = findViewById(R.id.refreshView); + mRefreshView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); + adapter = new PunishAdapter(this, mData); + + mRefreshView.setEmptyLayoutId(R.layout.activity_punish_no_data); + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + return adapter; + } + + @Override + public void loadData(int p, HttpCallback callback) { + ImHttpUtil.getPenalizeList(p, callback); + } + + @Override + public List processData(String[] info) { + return JSON.parseArray(Arrays.toString(info), PunishBean.class); + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + + } + + @Override + public void onLoadMoreFailure() { + + } + }); + mRefreshView.initData(); + } +} diff --git a/live/src/main/java/com/yunbao/live/activity/SystemMessageActivity.java b/live/src/main/java/com/yunbao/live/activity/SystemMessageActivity.java index 4ba054ea5..03d9d07f3 100644 --- a/live/src/main/java/com/yunbao/live/activity/SystemMessageActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SystemMessageActivity.java @@ -5,20 +5,18 @@ import android.content.Intent; import android.util.Log; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; 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.bean.UserBean; -import com.yunbao.common.interfaces.CommonCallback; +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.bean.SystemMessageBean; import com.yunbao.live.views.SystemMessageViewHolder; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - import java.util.ArrayList; import java.util.Date; @@ -36,6 +34,7 @@ public class SystemMessageActivity extends AbsActivity { public static String type;//-1=单聊消息,1=系统消息,2=互动消息,3=猜你喜欢,-2=web页面打开 public static String type2 = "0";//判断是否注册监听 public static String nowUid, nowTitle, mowHeadImg; + private TextView punish, punishNotice;//处罚通知 public static void forward(Context context, String type, String uid, String title, String headImg) { context.startActivity(new Intent(context, SystemMessageActivity.class).putExtra("type", type).putExtra("uid", uid).putExtra("title", title).putExtra("headImg", headImg)); @@ -72,6 +71,13 @@ public class SystemMessageActivity extends AbsActivity { // mSystemMessageViewHolder.loadData(); // } init(); + punish = findViewById(R.id.tv_sys_msg_punish); + punish.setVisibility(View.VISIBLE); + punishNotice = findViewById(R.id.tv_sys_msg_punish_notice); + punish.setOnClickListener(v -> { + RouteUtil.forwardPunishActivity(); + punishNotice.setVisibility(View.GONE); + }); mSystemMessageViewHolder.btn_back.setOnClickListener(new View.OnClickListener() { @Override @@ -79,6 +85,17 @@ public class SystemMessageActivity extends AbsActivity { finish(); } }); + LiveNetManager.get(mContext).getPenalizeStatus(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(ResponseModel responseModel) { + punishNotice.setVisibility(View.VISIBLE); + } + + @Override + public void onError(String error) { + punishNotice.setVisibility(View.GONE); + } + }); } //更新新消息 diff --git a/live/src/main/java/com/yunbao/live/adapter/PunishAdapter.java b/live/src/main/java/com/yunbao/live/adapter/PunishAdapter.java new file mode 100644 index 000000000..c929100c9 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/PunishAdapter.java @@ -0,0 +1,56 @@ +package com.yunbao.live.adapter; + +import android.content.Context; +import android.text.TextUtils; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.live.R; +import com.yunbao.common.bean.PunishBean; + +import java.util.List; + +public class PunishAdapter extends RefreshAdapter { + + public PunishAdapter(Context context, List list) { + super(context, list); + } + + @NonNull + @Override + public PunishHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new PunishHolder(mInflater.inflate(R.layout.activity_punish_item, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder h, int position) { + PunishHolder holder = (PunishHolder) h; + PunishBean item = mList.get(position); + holder.title.setText(item.title); + if (TextUtils.isEmpty(item.content)) { + holder.line.setVisibility(View.GONE); + } else { + holder.line.setVisibility(View.VISIBLE); + } + holder.value.setText(item.content); + } + + class PunishHolder extends RecyclerView.ViewHolder { + + public TextView title, value; + public View line; + + public PunishHolder(@NonNull View itemView) { + super(itemView); + title = itemView.findViewById(R.id.tv_punish_title); + value = itemView.findViewById(R.id.tv_punish_value); + line = itemView.findViewById(R.id.view_punish_line); + } + } + +} diff --git a/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java b/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java index 7d6d76ebf..533b2221e 100644 --- a/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/SystemMessageNewAdapter.java @@ -1,6 +1,5 @@ package com.yunbao.live.adapter; -import android.app.Activity; import android.content.Context; import android.content.Intent; import android.text.TextUtils; @@ -20,7 +19,6 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; -import com.yunbao.common.utils.L; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -77,9 +75,13 @@ public class SystemMessageNewAdapter extends RefreshAdapter { } void setData(SystemMessageBean bean, int position) { - SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm"); - Date currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000")); - messageTime.setText(sdf.format(currenTimeZone)); + if (!TextUtils.isEmpty(bean.getAddtime())) { + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm"); + Date currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000")); + messageTime.setText(sdf.format(currenTimeZone)); + } else { + messageTime.setText(""); + } messageContext.setText(bean.getContent()); title.setText(String.valueOf(bean.getTitle())); diff --git a/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java b/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java index ab3dfc4ab..dfa65a318 100644 --- a/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java @@ -1,6 +1,5 @@ package com.yunbao.live.http; -import com.yunbao.common.CommonAppConfig; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; @@ -110,4 +109,22 @@ public class ImHttpUtil { .params("message_id", msgid) .execute(callback); } + + /** + * 处罚通知是否有未读消息 + */ + public static void getPenalizeStatus(HttpCallback callback) { + HttpClient.getInstance().get("Message.penalizeStatus", "Message.penalizeStatus") + .execute(callback); + } + + /** + * 处罚通知列表 + */ + public static void getPenalizeList(int p, HttpCallback callback) { + HttpClient.getInstance().get("Message.penalizeList", "Message.penalizeList") + .params("p", p) + .execute(callback); + } + } diff --git a/live/src/main/res/drawable/bg_bk_ffffff_555555_8dp.xml b/live/src/main/res/drawable/bg_bk_ffffff_555555_8dp.xml new file mode 100644 index 000000000..8587b86d6 --- /dev/null +++ b/live/src/main/res/drawable/bg_bk_ffffff_555555_8dp.xml @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_ffae04_6dp.xml b/live/src/main/res/drawable/bg_ffae04_6dp.xml new file mode 100644 index 000000000..ba445586f --- /dev/null +++ b/live/src/main/res/drawable/bg_ffae04_6dp.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_red_yuan.xml b/live/src/main/res/drawable/bg_red_yuan.xml new file mode 100644 index 000000000..c92ab1608 --- /dev/null +++ b/live/src/main/res/drawable/bg_red_yuan.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/activity_punish.xml b/live/src/main/res/layout/activity_punish.xml new file mode 100644 index 000000000..ce7063919 --- /dev/null +++ b/live/src/main/res/layout/activity_punish.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/activity_punish_item.xml b/live/src/main/res/layout/activity_punish_item.xml new file mode 100644 index 000000000..cbddb792b --- /dev/null +++ b/live/src/main/res/layout/activity_punish_item.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/activity_punish_no_data.xml b/live/src/main/res/layout/activity_punish_no_data.xml new file mode 100644 index 000000000..61127c9ab --- /dev/null +++ b/live/src/main/res/layout/activity_punish_no_data.xml @@ -0,0 +1,28 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_sys_msg.xml b/live/src/main/res/layout/view_sys_msg.xml index 6813f4f5a..cc30fbe79 100644 --- a/live/src/main/res/layout/view_sys_msg.xml +++ b/live/src/main/res/layout/view_sys_msg.xml @@ -1,5 +1,6 @@ + android:tint="@color/textColor" + tools:ignore="UseAppTint" /> + + + + + + android:background="@color/gray_ededed" + android:visibility="gone" />