[Modify]首页ui和接口修改
BIN
app/src/main/assets/svga/home_living.svga
Normal file
BIN
app/src/main/assets/svga/home_white_living.svga
Normal file
@@ -1,12 +1,15 @@
|
||||
package com.yizhuan.erban.home.adapter
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.opensource.svgaplayer.SVGAImageView
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
import com.yizhuan.erban.ui.utils.loadFromAssets
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
|
||||
import com.yizhuan.xchat_android_library.utils.StringCutUtils
|
||||
|
||||
/**
|
||||
* create by lvzebiao @2019/11/13
|
||||
@@ -15,17 +18,22 @@ class HomeChatAdapter :
|
||||
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.item_home_chat) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
|
||||
when(item.gender){
|
||||
0 ->{
|
||||
helper.getView<View>(R.id.view_bg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_man)
|
||||
}
|
||||
1 ->{
|
||||
helper.getView<View>(R.id.view_bg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_man)
|
||||
}
|
||||
2 ->{
|
||||
helper.getView<View>(R.id.view_bg).background = ContextCompat.getDrawable(mContext,R.drawable.bg_home_chat_women)
|
||||
}
|
||||
}
|
||||
val svgaLiving = helper.getView<SVGAImageView>(R.id.svga_living)
|
||||
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_avatar), item.avatar)
|
||||
val name = StringCutUtils.subStrByLen(item.title.substring(0, item.title.length - 3), 8)
|
||||
helper.setText(R.id.tv_name, name)
|
||||
if (item.mgId == 0L) {
|
||||
helper.getView<Group>(R.id.group_game).visibility = View.INVISIBLE
|
||||
} else {
|
||||
helper.getView<Group>(R.id.group_game).visibility = View.VISIBLE
|
||||
}
|
||||
svgaLiving.loadFromAssets("svga/home_living.svga")
|
||||
}
|
||||
|
||||
override fun onViewAttachedToWindow(holder: BaseViewHolder) {
|
||||
super.onViewAttachedToWindow(holder)
|
||||
val svgaLiving = holder.getView<SVGAImageView>(R.id.svga_living)
|
||||
svgaLiving?.loadFromAssets("svga/home_living.svga")
|
||||
}
|
||||
|
||||
}
|
@@ -1,24 +1,33 @@
|
||||
package com.yizhuan.erban.home.adapter
|
||||
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.opensource.svgaplayer.SVGAImageView
|
||||
import com.google.android.flexbox.AlignItems
|
||||
import com.google.android.flexbox.FlexDirection
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity
|
||||
import com.yizhuan.erban.ui.user.activity.UserInfoActivity
|
||||
import com.yizhuan.erban.ui.user.adapter.UserInfoLabelAdapter
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.erban.ui.utils.loadAvatar
|
||||
import com.yizhuan.erban.ui.utils.loadFromAssets
|
||||
import com.yizhuan.erban.vip.util.VipHelper
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo.SoundBean
|
||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
||||
import com.yizhuan.xchat_android_core.utils.StarUtils
|
||||
import com.yizhuan.xchat_android_core.utils.ifNullOrEmpty
|
||||
import com.yizhuan.xchat_android_library.common.widget.LinesFlexBoxLayoutManager
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils
|
||||
import java.util.*
|
||||
|
||||
class RoomNewFriendsAdapter :
|
||||
@@ -43,27 +52,25 @@ class RoomNewFriendsAdapter :
|
||||
R.id.iv_gender,
|
||||
if (item.gender == 1) R.drawable.ic_home_man else R.drawable.ic_home_woman
|
||||
)
|
||||
val tvOnlineText = helper.getView<TextView>(R.id.tv_online_text)
|
||||
val ivTalk = helper.getView<AppCompatImageView>(R.id.iv_talk)
|
||||
val svgaLiving = helper.getView<SVGAImageView>(R.id.svga_living)
|
||||
val llOnline = helper.getView<View>(R.id.ll_online)
|
||||
val tvTalk = helper.getView<TextView>(R.id.tv_talk)
|
||||
val viewOnline = helper.getView<View>(R.id.view_online)
|
||||
val groupParty = helper.getView<Group>(R.id.group_party)
|
||||
|
||||
viewOnline.isVisible = item.inOnline
|
||||
if(item.inMic){
|
||||
groupParty.visibility = View.VISIBLE
|
||||
} else {
|
||||
groupParty.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
if (item.inRoomUid != 0L) {
|
||||
ivTalk.isVisible = false
|
||||
svgaLiving.isVisible = true
|
||||
viewOnline.isVisible = true
|
||||
svgaLiving.loadFromAssets("svga/home_living.svga")
|
||||
tvOnlineText.text = "直播中"
|
||||
llOnline.setOnClickListener {
|
||||
tvTalk.text = "去找TA"
|
||||
tvTalk.setOnClickListener {
|
||||
AVRoomActivity.start(mContext, item.inRoomUid)
|
||||
}
|
||||
} else {
|
||||
ivTalk.isVisible = true
|
||||
svgaLiving.isVisible = false
|
||||
viewOnline.isVisible = false
|
||||
tvOnlineText.text = "和TA聊"
|
||||
llOnline.setOnClickListener {
|
||||
tvTalk.text = "和TA聊"
|
||||
tvTalk.setOnClickListener {
|
||||
NimP2PMessageActivity.start(mContext, item.uid.toString())
|
||||
}
|
||||
}
|
||||
@@ -74,15 +81,58 @@ class RoomNewFriendsAdapter :
|
||||
|
||||
val tvNickname = helper.getView<TextView>(R.id.tv_nickname)
|
||||
tvNickname.text = item.nick
|
||||
VipHelper.loadVipNickColor(tvNickname, item.userVipInfoVO, "#282828")
|
||||
VipHelper.loadVipIcon(helper.getView(R.id.iv_vip_icon), item.userVipInfoVO)
|
||||
|
||||
val ivUserLevel: AppCompatImageView = helper.getView(R.id.iv_user_level)
|
||||
ivUserLevel.visibility = View.GONE
|
||||
if (item.userLevelVo != null && !TextUtils.isEmpty(item.userLevelVo.getExperUrl())) {
|
||||
ivUserLevel.visibility = View.VISIBLE
|
||||
ImageLoadUtils.loadImage(mContext, item.userLevelVo.getExperUrl(), ivUserLevel)
|
||||
}
|
||||
|
||||
val ivCharmLevel: AppCompatImageView = helper.getView(R.id.iv_charm_level)
|
||||
ivCharmLevel.visibility = View.GONE
|
||||
if (item.userLevelVo != null && !TextUtils.isEmpty(item.userLevelVo.getCharmUrl())) {
|
||||
ivCharmLevel.visibility = View.VISIBLE
|
||||
ImageLoadUtils.loadImage(
|
||||
mContext,
|
||||
item.userLevelVo.getCharmUrl(),
|
||||
ivCharmLevel
|
||||
)
|
||||
}
|
||||
|
||||
if (item.audioCard != null && !TextUtils.isEmpty(item.audioCard.audioUrl)) {
|
||||
helper.getView<AppCompatTextView>(R.id.tv_desc).visibility = View.GONE
|
||||
helper.getView<LinearLayout>(R.id.llAudio).visibility = View.VISIBLE
|
||||
|
||||
helper.getView<AppCompatTextView>(R.id.tvAudio).text = item.audioCard.second.toString()
|
||||
helper.getView<LinearLayout>(R.id.llAudio)
|
||||
.setOnClickListener { v -> toggleAudio(item.audioCard) }
|
||||
} else {
|
||||
helper.getView<AppCompatTextView>(R.id.tv_desc).visibility = View.VISIBLE
|
||||
helper.getView<LinearLayout>(R.id.llAudio).visibility = View.GONE
|
||||
}
|
||||
|
||||
val mLabelRecyclerView = helper.getView<RecyclerView>(R.id.mLabelRecyclerView)
|
||||
if(!ListUtils.isListEmpty(item.labels)){
|
||||
mLabelRecyclerView.visibility = View.VISIBLE
|
||||
val userInfoLabelAdapter = UserInfoLabelAdapter()
|
||||
|
||||
val labelLayoutManager = LinesFlexBoxLayoutManager(mContext)
|
||||
labelLayoutManager.flexDirection = FlexDirection.ROW
|
||||
labelLayoutManager.alignItems = AlignItems.FLEX_START
|
||||
labelLayoutManager.setMaxLines(1)
|
||||
mLabelRecyclerView.layoutManager = labelLayoutManager
|
||||
mLabelRecyclerView.adapter = userInfoLabelAdapter
|
||||
|
||||
userInfoLabelAdapter.setNewData(item.labels)
|
||||
} else {
|
||||
mLabelRecyclerView.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onViewAttachedToWindow(holder: BaseViewHolder) {
|
||||
super.onViewAttachedToWindow(holder)
|
||||
val svgaLiving = holder.getView<SVGAImageView>(R.id.svga_living)
|
||||
svgaLiving?.loadFromAssets("svga/home_living.svga")
|
||||
}
|
||||
private fun toggleAudio(audioCard: SoundBean) {
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
app/src/main/res/drawable-xhdpi/bg_game.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_masking_game.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_masking_party.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_sound_pause.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_sound_star.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_sound_wave.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/iv_party.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
6
app/src/main/res/drawable/bg_759fff_2.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke android:width="2dp" android:color="#ff759fff" />
|
||||
<corners android:radius="360dp" />
|
||||
</shape>
|
5
app/src/main/res/drawable/shape_339168fa_corner.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="100dp" />
|
||||
<solid android:color="#339168FA" />
|
||||
</shape>
|
@@ -4,7 +4,7 @@
|
||||
|
||||
<solid android:color="#ffffffff" />
|
||||
|
||||
<corners android:radius="14dp" />
|
||||
<corners android:radius="12dp" />
|
||||
|
||||
</shape>
|
||||
|
||||
|
@@ -71,6 +71,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="never"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:scrollbars="none"
|
||||
@@ -90,7 +91,7 @@
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none" />
|
||||
|
||||
|
@@ -4,25 +4,26 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_8">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="92dp"
|
||||
android:background="@drawable/bg_white_round_10"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_aperture"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/bg_home_chat_man"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
android:background="@drawable/bg_759fff_2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_bg" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
@@ -30,20 +31,58 @@
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_aperture"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_aperture"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_aperture"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_aperture"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_aperture"/>
|
||||
app:layout_constraintStart_toStartOf="@+id/view_aperture"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_aperture" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_mask"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:background="@drawable/bg_masking_game"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_avatar"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_avatar" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_game"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
android:background="@drawable/bg_game"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_mask"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_mask"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_mask" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_game"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"
|
||||
app:constraint_referenced_ids="iv_mask,iv_game,view_aperture" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_living"
|
||||
android:layout_width="@dimen/dp_10"
|
||||
android:layout_height="@dimen/dp_8"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_name"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_name"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_name"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toEndOf="@+id/svga_living"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view_aperture"
|
||||
tools:text="音樂與你"/>
|
||||
tools:text="音樂與你" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -10,43 +10,78 @@
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/shape_room_new_friends_bg"
|
||||
app:layout_constraintDimensionRatio="335:93"
|
||||
app:layout_constraintDimensionRatio="351:96"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_avatar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_aperture"
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:background="@drawable/bg_759fff_2"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_bg" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_marginStart="@dimen/dp_14"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_aperture"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_aperture"
|
||||
app:layout_constraintStart_toStartOf="@+id/view_aperture"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_aperture" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_mask_party"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/bg_masking_party"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_avatar"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_avatar" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_party"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
android:src="@drawable/iv_party"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_mask_party"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_mask_party"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_mask_party" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_party"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"
|
||||
app:constraint_referenced_ids="iv_mask_party,iv_party,view_aperture" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_online"
|
||||
android:layout_width="@dimen/dp_11"
|
||||
android:layout_height="@dimen/dp_11"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
android:background="@drawable/shape_home_online"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_avatar" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_avatar"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_avatar" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_nickname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg"
|
||||
tools:text="余生点唱歌曲" />
|
||||
@@ -58,37 +93,52 @@
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@drawable/shape_ff9cce_corner"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_nickname"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_nickname"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_nickname"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_nickname">
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_nickname">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:layout_width="@dimen/dp_8"
|
||||
android:layout_height="@dimen/dp_8"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:src="@drawable/ic_home_woman" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_age"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginStart="1dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_11"
|
||||
android:textSize="@dimen/sp_10"
|
||||
tools:text="22" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_vip_icon"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="18dp"
|
||||
android:id="@+id/iv_user_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="4dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_nickname"
|
||||
app:layout_constraintStart_toEndOf="@id/ll_gender_age"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_nickname" />
|
||||
app:layout_constraintTop_toTopOf="@id/tv_nickname"
|
||||
tools:src="@mipmap/ic_user_level"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_charm_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:adjustViewBounds="true"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_nickname"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_user_level"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_nickname"
|
||||
tools:src="@mipmap/ic_user_level"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_constellation"
|
||||
@@ -96,69 +146,108 @@
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:background="@drawable/shape_f6f7f9_corner"
|
||||
android:background="@drawable/shape_339168fa_corner"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffb3b5c4"
|
||||
android:textColor="@color/color_9168FA"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_nickname"
|
||||
tools:text="巨蟹座" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mLabelRecyclerView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginEnd="@dimen/dp_24"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_constellation"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_talk"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_nickname" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_24"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="@dimen/dp_24"
|
||||
android:background="@drawable/bg_f5f6fa_anomaly"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:paddingStart="@dimen/dp_10"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
android:text="一起来玩呀"
|
||||
android:textColor="@color/color_8A8CAB"
|
||||
android:textSize="@dimen/sp_10"
|
||||
android:paddingStart="@dimen/dp_10"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
android:background="@drawable/bg_f5f6fa_anomaly"
|
||||
app:layout_constraintEnd_toStartOf="@id/ll_online"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_talk"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_constellation" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_online"
|
||||
android:id="@+id/llAudio"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_14"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg">
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@drawable/bg_f5f6fa_anomaly"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/dp_6"
|
||||
android:paddingEnd="@dimen/dp_12"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_constellation"
|
||||
tools:visibility="visible">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_talk"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:src="@drawable/ic_new_friends_msg"
|
||||
android:visibility="gone" />
|
||||
<ImageView
|
||||
android:id="@+id/iv_audio_control"
|
||||
android:layout_width="@dimen/dp_26"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:src="@drawable/ic_sound_pause" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_living"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
android:id="@+id/liv_user"
|
||||
android:layout_width="@dimen/dp_22"
|
||||
android:layout_height="@dimen/dp_10"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:src="@drawable/ic_sound_wave"
|
||||
app:autoPlay="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_online_text"
|
||||
android:layout_width="40dp"
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tvAudio"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="直播中"
|
||||
android:textColor="#ffbdbfd0"
|
||||
android:textSize="@dimen/sp_11" />
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="@dimen/sp_12"
|
||||
tools:text="60" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="''"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/tv_talk"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:text="和TA聊"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:corner="@dimen/dp_14"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/view_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/view_bg"
|
||||
app:solid="@color/color_9168FA" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -313,6 +313,14 @@ public class UserInfo implements Serializable {
|
||||
|
||||
private long inRoomUid;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public boolean inMic;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public boolean inOnline;
|
||||
|
||||
public UserInfo() {
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,103 @@
|
||||
package com.yizhuan.xchat_android_library.utils;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p> </p>
|
||||
*
|
||||
* @author jiahui
|
||||
* date 2018/2/28
|
||||
*/
|
||||
public class StringCutUtils {
|
||||
|
||||
private static String regEx = "[\u4e00-\u9fa5]"; // 中文范围
|
||||
|
||||
/**
|
||||
* 格式化字符串
|
||||
* @param string 原始输入字符串
|
||||
* @param maxCount 最大字符限制,中文算作2个字符,其他都算1个字符
|
||||
* @return
|
||||
*/
|
||||
private static String formatText(String string, int maxCount) {
|
||||
if ( (string == null || string.length() == 0)
|
||||
&& getChCount(string) > maxCount) {
|
||||
string = subStrByLen(string, maxCount - 1);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 截取字符串,超出最大字数截断并显示"..."
|
||||
* @param str 原始字符串
|
||||
* @param length 最大字数限制(以最大字数限制7个为例,当含中文时,length应设为2*7,不含中文时设为7)
|
||||
* @return 处理后的字符串
|
||||
*/
|
||||
public static String subStrByLen(String str, int length) {
|
||||
if (str == null || str.length() == 0) {
|
||||
return "";
|
||||
}
|
||||
int chCnt = getStrLen(str);
|
||||
// 超出进行截断处理
|
||||
if (chCnt > length) {
|
||||
int cur = 0;
|
||||
int cnt = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (cnt <= length && cur < str.length()) {
|
||||
char nextChar = str.charAt(cur);
|
||||
if (isChCharacter(String.valueOf(nextChar))) {
|
||||
cnt += 2;
|
||||
} else {
|
||||
cnt++;
|
||||
}
|
||||
if (cnt <= length) {
|
||||
sb.append(nextChar);
|
||||
} else {
|
||||
return sb.toString() + "...";
|
||||
}
|
||||
cur++;
|
||||
}
|
||||
return sb.toString() + "...";
|
||||
}
|
||||
// 未超出直接返回
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字符串中的中文字数
|
||||
*/
|
||||
private static int getChCount(String str) {
|
||||
int cnt = 0;
|
||||
Pattern pattern = Pattern.compile(regEx);
|
||||
Matcher matcher = pattern.matcher(str);;
|
||||
while(matcher.find()) {
|
||||
cnt++;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符是不是中文
|
||||
*/
|
||||
private static boolean isChCharacter(String str) {
|
||||
if (str == null || str.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
if (str.length() > 1) {
|
||||
return false;
|
||||
}
|
||||
return Pattern.matches(regEx, str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字符长度,中文算作2个字符,其他都算1个字符
|
||||
*/
|
||||
public static int getStrLen(String str) {
|
||||
if (str == null || str.length() == 0) {
|
||||
return 0;
|
||||
}
|
||||
return str.length() + getChCount(str);
|
||||
}
|
||||
|
||||
}
|