增加处罚通知功能

This commit is contained in:
gongduoxiang 2024-08-06 16:29:15 +08:00
parent abc37aa486
commit dbd684a6e2
19 changed files with 406 additions and 17 deletions

View File

@ -1545,5 +1545,6 @@
<string name="live_end_view_ban_reason">違規原因:</string> <string name="live_end_view_ban_reason">違規原因:</string>
<string name="live_end_view_ban_content">處罰內容:</string> <string name="live_end_view_ban_content">處罰內容:</string>
<string name="live_end_view_ban_timer">處罰時間:</string> <string name="live_end_view_ban_timer">處罰時間:</string>
<string name="live_end_view_ban_punish_title">處罰通知</string>
</resources> </resources>

View File

@ -85,4 +85,6 @@
<color name="gray_f6f6f6f6">#FFF6F6F6</color> <color name="gray_f6f6f6f6">#FFF6F6F6</color>
<color name="gray_F4F4F4">#F4F4F4</color> <color name="gray_F4F4F4">#F4F4F4</color>
<color name="color_555555">#555555</color>
<color name="color_525252">#525252</color>
</resources> </resources>

View File

@ -1554,4 +1554,5 @@
<string name="live_end_view_ban_reason">Violation reasons:</string> <string name="live_end_view_ban_reason">Violation reasons:</string>
<string name="live_end_view_ban_content">Penalty content:</string> <string name="live_end_view_ban_content">Penalty content:</string>
<string name="live_end_view_ban_timer">Penalty time:</string> <string name="live_end_view_ban_timer">Penalty time:</string>
<string name="live_end_view_ban_punish_title">Punishment Notice</string>
</resources> </resources>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools">
>
<!--com.kugou.fanxing.allinone.watch.liveroominone.media.FALiveRoomInOneActivity"--> <!--com.kugou.fanxing.allinone.watch.liveroominone.media.FALiveRoomInOneActivity"-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
@ -132,6 +131,10 @@
<activity <activity
android:name=".activity.CompensateActivity" android:name=".activity.CompensateActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".activity.PunishActivity"
android:label="处罚通知列表"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,78 @@
package com.yunbao.live.activity;
import androidx.recyclerview.widget.LinearLayoutManager;
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.live.R;
import com.yunbao.live.adapter.PunishAdapter;
import com.yunbao.live.bean.PunishBean;
import com.yunbao.live.http.ImHttpUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
//处罚通知单
public class PunishActivity extends AbsActivity {
private CommonRefreshView mRefreshView;
private PunishAdapter adapter;
private List<PunishBean> 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<PunishBean>() {
@Override
public RefreshAdapter<PunishBean> getAdapter() {
return adapter;
}
@Override
public void loadData(int p, HttpCallback callback) {
ImHttpUtil.getPenalizeList(p, callback);
}
@Override
public List<PunishBean> processData(String[] info) {
return JSON.parseArray(Arrays.toString(info), PunishBean.class);
}
@Override
public void onRefreshSuccess(List<PunishBean> list, int listCount) {
}
@Override
public void onRefreshFailure() {
}
@Override
public void onLoadMoreSuccess(List<PunishBean> loadItemList, int loadItemCount) {
}
@Override
public void onLoadMoreFailure() {
}
});
mRefreshView.initData();
}
}

View File

@ -5,19 +5,18 @@ import android.content.Intent;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import com.yunbao.common.Constants; 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.bean.UserBean; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.bean.SystemMessageBean; import com.yunbao.live.http.ImHttpUtil;
import com.yunbao.live.views.SystemMessageViewHolder; import com.yunbao.live.views.SystemMessageViewHolder;
import org.greenrobot.eventbus.Subscribe; import org.json.JSONObject;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -36,6 +35,7 @@ public class SystemMessageActivity extends AbsActivity {
public static String type;//-1=单聊消息,1=系统消息,2=互动消息,3=猜你喜欢,-2=web页面打开 public static String type;//-1=单聊消息,1=系统消息,2=互动消息,3=猜你喜欢,-2=web页面打开
public static String type2 = "0";//判断是否注册监听 public static String type2 = "0";//判断是否注册监听
public static String nowUid, nowTitle, mowHeadImg; public static String nowUid, nowTitle, mowHeadImg;
private TextView punish, punishNotice;//处罚通知
public static void forward(Context context, String type, String uid, String title, String headImg) { 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)); context.startActivity(new Intent(context, SystemMessageActivity.class).putExtra("type", type).putExtra("uid", uid).putExtra("title", title).putExtra("headImg", headImg));
@ -72,6 +72,14 @@ public class SystemMessageActivity extends AbsActivity {
// mSystemMessageViewHolder.loadData(); // mSystemMessageViewHolder.loadData();
// } // }
init(); 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 -> {
Intent intent = new Intent(getApplicationContext(), PunishActivity.class);
startActivity(intent);
punishNotice.setVisibility(View.GONE);
});
mSystemMessageViewHolder.btn_back.setOnClickListener(new View.OnClickListener() { mSystemMessageViewHolder.btn_back.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -79,6 +87,25 @@ public class SystemMessageActivity extends AbsActivity {
finish(); finish();
} }
}); });
ImHttpUtil.getPenalizeStatus(new HttpCallback() {
@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) {
punishNotice.setVisibility(View.VISIBLE);
} else {
punishNotice.setVisibility(View.GONE);
}
} catch (Exception e) {
punishNotice.setVisibility(View.GONE);
}
} else {
punishNotice.setVisibility(View.GONE);
}
}
});
} }
//更新新消息 //更新新消息

View File

@ -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.live.bean.PunishBean;
import java.util.List;
public class PunishAdapter extends RefreshAdapter<PunishBean> {
public PunishAdapter(Context context, List<PunishBean> 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);
}
}
}

View File

@ -1,6 +1,5 @@
package com.yunbao.live.adapter; package com.yunbao.live.adapter;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.text.TextUtils; import android.text.TextUtils;
@ -20,7 +19,6 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -77,9 +75,13 @@ public class SystemMessageNewAdapter extends RefreshAdapter<SystemMessageBean> {
} }
void setData(SystemMessageBean bean, int position) { void setData(SystemMessageBean bean, int position) {
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm"); if (!TextUtils.isEmpty(bean.getAddtime())) {
Date currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000")); SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
messageTime.setText(sdf.format(currenTimeZone)); Date currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000"));
messageTime.setText(sdf.format(currenTimeZone));
} else {
messageTime.setText("");
}
messageContext.setText(bean.getContent()); messageContext.setText(bean.getContent());
title.setText(String.valueOf(bean.getTitle())); title.setText(String.valueOf(bean.getTitle()));

View File

@ -0,0 +1,9 @@
package com.yunbao.live.bean;
//处罚消息的对象
public class PunishBean {
public String id;
public String title, content;
}

View File

@ -1,6 +1,5 @@
package com.yunbao.live.http; package com.yunbao.live.http;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
@ -110,4 +109,22 @@ public class ImHttpUtil {
.params("message_id", msgid) .params("message_id", msgid)
.execute(callback); .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);
}
} }

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topLeftRadius="2dp"
android:topRightRadius="8dp" />
<stroke
android:width="1px"
android:color="#555555" />
<solid android:color="@color/colorWhite" />
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="6dp" />
<solid android:color="#FFAE04" />
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp"/>
<solid android:color="#FE4C4B"/>
</shape>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/rl_layout"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/white"
android:paddingTop="24dp"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/titleView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/live_end_view_ban_punish_title"
android:textColor="@color/textColor"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:padding="9dp"
android:src="@mipmap/icon_back"
android:tint="@color/textColor"
tools:ignore="UseAppTint" />
</FrameLayout>
<com.yunbao.common.custom.CommonRefreshView
android:id="@+id/refreshView"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/rl_layout" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="@+id/iv_punish_icon"
android:layout_width="36dp"
android:layout_height="40dp"
android:layout_marginLeft="18dp"
android:src="@mipmap/cftz"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="234dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="25dp"
android:background="@drawable/bg_bk_ffffff_555555_8dp"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="@id/iv_punish_icon"
app:layout_constraintTop_toTopOf="@id/iv_punish_icon">
<TextView
android:id="@+id/tv_punish_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="5dp"
android:text="标题"
android:textColor="@color/color_555555"
android:textSize="14sp"
android:textStyle="bold" />
<View
android:id="@+id/view_punish_line"
android:layout_width="match_parent"
android:layout_height="0.4dp"
android:background="@color/color_525252" />
<TextView
android:id="@+id/tv_punish_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:text="内容"
android:textColor="@color/color_555555"
android:textSize="13sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/img_nodata_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/cftz_no_data" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="暫無處罰通知"
android:textColor="#333333"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No penalty notice yet."
android:textColor="@color/color_555555"
android:textSize="12sp" />
</LinearLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/lt_root" android:id="@+id/lt_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -28,7 +29,8 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:padding="9dp" android:padding="9dp"
android:src="@mipmap/icon_back" android:src="@mipmap/icon_back"
android:tint="@color/textColor" /> android:tint="@color/textColor"
tools:ignore="UseAppTint" />
<ImageView <ImageView
android:id="@+id/img_more" android:id="@+id/img_more"
@ -39,7 +41,34 @@
android:padding="6dp" android:padding="6dp"
android:src="@mipmap/btn_more_black" android:src="@mipmap/btn_more_black"
android:tint="@color/textColor" android:tint="@color/textColor"
android:visibility="gone"
tools:ignore="UseAppTint" />
<TextView
android:id="@+id/tv_sys_msg_punish"
android:layout_width="60dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_ffae04_6dp"
android:gravity="center"
android:text="@string/live_end_view_ban_punish_title"
android:textColor="@color/colorWhite"
android:textSize="12sp"
android:visibility="visible" />
<TextView
android:id="@+id/tv_sys_msg_punish_notice"
android:layout_width="6dp"
android:layout_height="6dp"
android:background="@drawable/bg_red_yuan"
android:layout_alignTop="@+id/tv_sys_msg_punish"
android:layout_alignEnd="@id/tv_sys_msg_punish"
android:layout_marginTop="-1.5dp"
android:layout_marginEnd="-1.5dp"
android:visibility="gone" /> android:visibility="gone" />
</RelativeLayout> </RelativeLayout>
<com.yunbao.common.custom.CommonRefreshView <com.yunbao.common.custom.CommonRefreshView
@ -129,8 +158,8 @@
android:id="@+id/lt_controls" android:id="@+id/lt_controls"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:layout_marginLeft="9dp" android:layout_marginLeft="9dp"
android:layout_marginTop="9dp"
android:layout_marginRight="9dp" android:layout_marginRight="9dp"
android:layout_marginBottom="18dp" android:layout_marginBottom="18dp"
android:gravity="center" android:gravity="center"
@ -141,8 +170,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginBottom="9dp" android:layout_marginBottom="9dp"
android:visibility="gone" android:background="@color/gray_ededed"
android:background="@color/gray_ededed" /> android:visibility="gone" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB