feat:调整房间公聊-头条UI
This commit is contained in:
@@ -2,6 +2,7 @@ package com.chwl.app.avroom.headline
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.view.Gravity
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
@@ -9,12 +10,15 @@ import com.chwl.app.R
|
|||||||
import com.chwl.app.databinding.RoomHeadlineWidgetBinding
|
import com.chwl.app.databinding.RoomHeadlineWidgetBinding
|
||||||
import com.chwl.app.public_chat.core.ChatRoomClient
|
import com.chwl.app.public_chat.core.ChatRoomClient
|
||||||
import com.chwl.app.public_chat.core.ChatRoomClientManager
|
import com.chwl.app.public_chat.core.ChatRoomClientManager
|
||||||
|
import com.chwl.app.ui.utils.loadAvatar
|
||||||
import com.chwl.core.im.custom.bean.CustomAttachment
|
import com.chwl.core.im.custom.bean.CustomAttachment
|
||||||
import com.chwl.core.im.custom.bean.HeadlineChangedAttachment
|
import com.chwl.core.im.custom.bean.HeadlineChangedAttachment
|
||||||
import com.chwl.core.public_chat_hall.bean.HeadlineBean
|
import com.chwl.core.public_chat_hall.bean.HeadlineBean
|
||||||
import com.chwl.core.public_chat_hall.model.PublicChatModel
|
import com.chwl.core.public_chat_hall.model.PublicChatModel
|
||||||
import com.chwl.core.support.room.FrameLayoutRoomWidget
|
import com.chwl.core.support.room.FrameLayoutRoomWidget
|
||||||
import com.chwl.core.support.room.RoomView
|
import com.chwl.core.support.room.RoomView
|
||||||
|
import com.example.lib_utils.AppUtils
|
||||||
|
import com.example.lib_utils.UiUtils
|
||||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum
|
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum
|
||||||
|
|
||||||
@@ -44,6 +48,12 @@ class RoomHeadlineWidget : FrameLayoutRoomWidget {
|
|||||||
defStyleRes: Int
|
defStyleRes: Int
|
||||||
) : super(context, attrs, defStyleAttr, defStyleRes)
|
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (UiUtils.isRtl(AppUtils.getApp())) {
|
||||||
|
binding.tvHeadlineContent.gravity = Gravity.RIGHT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStart(roomView: RoomView) {
|
override fun onStart(roomView: RoomView) {
|
||||||
super.onStart(roomView)
|
super.onStart(roomView)
|
||||||
if (!isInEditMode) {
|
if (!isInEditMode) {
|
||||||
@@ -92,8 +102,15 @@ class RoomHeadlineWidget : FrameLayoutRoomWidget {
|
|||||||
val content = data?.content
|
val content = data?.content
|
||||||
if (data?.isValid() == true && !content.isNullOrEmpty()) {
|
if (data?.isValid() == true && !content.isNullOrEmpty()) {
|
||||||
binding.tvHeadlineContent.text = content
|
binding.tvHeadlineContent.text = content
|
||||||
|
binding.ivAvatar.loadAvatar(data.avatar)
|
||||||
|
binding.tvName.text = data.nick ?: ""
|
||||||
|
binding.tvMoney.text = data.payMoneyNum?.toString() ?: "0"
|
||||||
this.isVisible = true
|
this.isVisible = true
|
||||||
} else {
|
} else {
|
||||||
|
binding.ivAvatar.setImageDrawable(null)
|
||||||
|
binding.tvHeadlineContent.text = ""
|
||||||
|
binding.tvName.text = ""
|
||||||
|
binding.tvMoney.text = "0"
|
||||||
this.isVisible = false
|
this.isVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 9.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/room_bg_headline_money.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/room_bg_headline_money.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
@@ -1,18 +1,94 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout>
|
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/tv_headline_content"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/dp_8"
|
android:background="@drawable/room_bg_headline">
|
||||||
android:background="@drawable/room_bg_headline"
|
|
||||||
android:paddingHorizontal="@dimen/dp_10"
|
<com.google.android.material.imageview.ShapeableImageView
|
||||||
android:paddingTop="@dimen/dp_9"
|
android:id="@+id/iv_avatar"
|
||||||
android:paddingBottom="@dimen/dp_9"
|
android:layout_width="@dimen/dp_20"
|
||||||
android:textColor="#FFF6E1"
|
android:layout_height="@dimen/dp_20"
|
||||||
android:textSize="@dimen/dp_13"
|
android:layout_marginStart="@dimen/dp_7_5"
|
||||||
tools:text="Content" />
|
android:layout_marginTop="@dimen/dp_7_5"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/default_avatar"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:shapeAppearance="@style/shape_circle" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="@dimen/dp_23"
|
||||||
|
android:layout_height="@dimen/dp_23"
|
||||||
|
android:src="@drawable/room_bg_headline_avatar_frame"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_avatar"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/iv_avatar"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/iv_avatar"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_avatar" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_4"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxWidth="@dimen/dp_150"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="#F5EA8E"
|
||||||
|
android:textSize="@dimen/dp_12"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_avatar"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_avatar"
|
||||||
|
tools:text="Name" />
|
||||||
|
|
||||||
|
<com.chwl.app.view.AutoMirroredImageView
|
||||||
|
android:id="@+id/iv_money_bg"
|
||||||
|
android:layout_width="@dimen/dp_40"
|
||||||
|
android:layout_height="@dimen/dp_15"
|
||||||
|
android:src="@drawable/room_bg_headline_money"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_money"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/dp_6"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/dp_8"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_money_bg"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/iv_money_bg"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_money_bg" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="@dimen/dp_10"
|
||||||
|
android:layout_height="@dimen/dp_10"
|
||||||
|
android:layout_marginEnd="@dimen/dp_2"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/icon_diamond"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/iv_money_bg"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/tv_money"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/iv_money_bg" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_headline_content"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_4"
|
||||||
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
|
android:layout_marginBottom="@dimen/dp_7"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="@dimen/dp_12"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/tv_name"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_avatar"
|
||||||
|
tools:text="Content" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
@@ -9,8 +9,11 @@ class HeadlineBean : Serializable {
|
|||||||
val id: Long? = null
|
val id: Long? = null
|
||||||
val uid: Long? = null
|
val uid: Long? = null
|
||||||
val nick: String? = null
|
val nick: String? = null
|
||||||
|
|
||||||
// 0 有效 1 过期
|
// 0 有效 1 过期
|
||||||
val recordStatus: Int? = null
|
val recordStatus: Int? = null
|
||||||
|
val avatar: String? = null
|
||||||
|
val payMoneyNum: Long? = null
|
||||||
|
|
||||||
fun isValid(): Boolean {
|
fun isValid(): Boolean {
|
||||||
return recordStatus == 0
|
return recordStatus == 0
|
||||||
|
Reference in New Issue
Block a user