新增个播小时榜飘屏
This commit is contained in:
@@ -53,6 +53,8 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.SingleRoomRankAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.SingleRoomRankMsgBean;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
@@ -183,6 +185,9 @@ public class RoomEffectView extends FrameLayout {
|
||||
case RoomEvent.SINGLE_ROOM_PK_NOTIFY:
|
||||
addSingleRoomPKNotify(roomEvent.getChatRoomMessage());
|
||||
break;
|
||||
case RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY:
|
||||
showSingleRoomRankNotify(roomEvent.getChatRoomMessage());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -869,6 +874,21 @@ public class RoomEffectView extends FrameLayout {
|
||||
binding.flSingleRoomPkNotify.postDelayed(() -> binding.flSingleRoomPkNotify.removeView(rootView), SHOW_TIME);
|
||||
}
|
||||
|
||||
private void showSingleRoomRankNotify(ChatRoomMessage chatRoomMessage) {
|
||||
if (binding.clNotify.getVisibility() == View.GONE) {
|
||||
binding.clNotify.setVisibility(View.VISIBLE);
|
||||
}
|
||||
SingleRoomRankMsgBean roomPkBean = ((SingleRoomRankAttachment) chatRoomMessage.getAttachment()).getMsgBean();
|
||||
View rootView = LayoutInflater.from(mContext).inflate(R.layout.layout_single_room_rank_notify, null);
|
||||
((TextView) rootView.findViewById(R.id.tv_nick)).setText(StringExtensionKt.subAndReplaceDot(roomPkBean.getNick(), 6));
|
||||
((TextView) rootView.findViewById(R.id.tv_desc)).setText(roomPkBean.getDesc());
|
||||
ImageLoadUtils.loadImage(getContext(), roomPkBean.getAvatar(), rootView.findViewById(R.id.iv_avatar));
|
||||
rootView.findViewById(R.id.tv_go_room).setOnClickListener(v -> AVRoomActivity.start(getContext(), roomPkBean.getUid()));
|
||||
binding.flSingleRoomRankNotify.addView(rootView);
|
||||
animationLuckyGift = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify);
|
||||
rootView.startAnimation(animationLuckyGift);
|
||||
binding.flSingleRoomRankNotify.postDelayed(() -> binding.flSingleRoomRankNotify.removeView(rootView), SHOW_TIME);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/single_room_bg_rank_notice.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/single_room_bg_rank_notice.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@@ -87,6 +87,12 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="375:71" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_single_room_rank_notify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="375:60" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_svga_vip_notify"
|
||||
|
67
app/src/main/res/layout/layout_single_room_rank_notify.xml
Normal file
67
app/src/main/res/layout/layout_single_room_rank_notify.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/single_room_bg_rank_notice"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="4dp"
|
||||
tools:layout_height="60dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="65dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="恭喜"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13dp" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:includeFontPadding="false"
|
||||
android:src="@drawable/default_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFFFFC2C"
|
||||
android:textSize="13dp"
|
||||
tools:text="厅的名字七个字" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13dp"
|
||||
tools:text=" 成为上时段 小时榜" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="TOP1"
|
||||
android:textColor="#FFFFFC2C"
|
||||
android:textSize="13dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tv_go_room"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:background="@drawable/single_room_bg_rank_notice_btn" />
|
||||
|
||||
</LinearLayout>
|
@@ -1293,6 +1293,11 @@ public final class IMNetEaseManager {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_SINGLE_ROOM_RANK:
|
||||
if (second == CUSTOM_MSG_SUB_SINGLE_ROOM_RANK_TOP) {
|
||||
noticeRoomEvent(msg, RoomEvent.SINGLE_ROOM_RANK_TOP_NOTIFY);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -563,6 +563,9 @@ public class CustomAttachParser implements MsgAttachmentParser {
|
||||
case CustomAttachment.CUSTOM_MSG_FANS_TEAM:
|
||||
attachment = new FansTeamMsgAttachment(second);
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_SINGLE_ROOM_RANK:
|
||||
attachment = new SingleRoomRankAttachment(second);
|
||||
break;
|
||||
default:
|
||||
LogUtils.e("未定义的first,请现在CustomAttachParser中解析");
|
||||
break;
|
||||
|
@@ -441,6 +441,9 @@ public class CustomAttachment implements MsgAttachment {
|
||||
public static final int CP_INVITE_MESSAGE = 88;
|
||||
public static final int CP_INVITE_MESSAGE_TOP_NOTICE = 881;
|
||||
|
||||
public static final int CUSTOM_MSG_SINGLE_ROOM_RANK = 89;
|
||||
public static final int CUSTOM_MSG_SUB_SINGLE_ROOM_RANK_TOP = 891;
|
||||
|
||||
public static final int CUSTOM_MSG_FANS_TEAM = 90;
|
||||
public static final int CUSTOM_MSG_SUB_FANS_TEAM_OPEN = 901; //开通粉丝团
|
||||
public static final int CUSTOM_MSG_SUB_FANS_TEAM_OPEN_FAILED = 902; // 开通粉丝团失败
|
||||
|
@@ -0,0 +1,31 @@
|
||||
package com.yizhuan.xchat_android_core.im.custom.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class SingleRoomRankAttachment extends CustomAttachment {
|
||||
|
||||
private SingleRoomRankMsgBean msgBean;
|
||||
|
||||
public SingleRoomRankAttachment(int second) {
|
||||
super(CUSTOM_MSG_SINGLE_ROOM_RANK, second);
|
||||
}
|
||||
|
||||
public SingleRoomRankMsgBean getMsgBean() {
|
||||
return msgBean;
|
||||
}
|
||||
|
||||
public void setMsgBean(SingleRoomRankMsgBean msgBean) {
|
||||
this.msgBean = msgBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parseData(JSONObject data) {
|
||||
msgBean = new Gson().fromJson(data.toJSONString(), SingleRoomRankMsgBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject packData() {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.yizhuan.xchat_android_core.im.custom.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SingleRoomRankMsgBean {
|
||||
private long uid;
|
||||
private String nick;
|
||||
private String avatar;
|
||||
private String desc;
|
||||
}
|
@@ -227,6 +227,7 @@ public class RoomEvent {
|
||||
public static final int FANS_TEAM_EXIT = 87;
|
||||
|
||||
public static final int SINGLE_ROOM_PK_NOTIFY = 88;
|
||||
public static final int SINGLE_ROOM_RANK_TOP_NOTIFY = 89;
|
||||
|
||||
private int event = NONE;
|
||||
private int micPosition = Integer.MIN_VALUE;
|
||||
|
Reference in New Issue
Block a user