feat:首页房间列表UI调整
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.chwl.app.home.adapter
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isInvisible
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.chwl.app.R
|
||||
@@ -20,6 +22,7 @@ class HomeHotAdapter :
|
||||
getView<ImageView>(R.id.iv_room_image).load(item.avatar)
|
||||
setText(R.id.tv_online_number, item.onlineNum.toString())
|
||||
setText(R.id.tv_room_title, item.title)
|
||||
setText(R.id.tv_desc, item.roomDesc)
|
||||
}
|
||||
|
||||
val avatars: Array<ImageView> = arrayOf(
|
||||
@@ -31,8 +34,18 @@ class HomeHotAdapter :
|
||||
)
|
||||
for (i in avatars.indices) {
|
||||
val avatarUrl = item.micUsers?.getOrNull(i)?.avatar
|
||||
avatars[i].isGone = avatarUrl.isNullOrBlank()
|
||||
avatars[i].isInvisible = avatarUrl.isNullOrBlank()
|
||||
avatars[i].load(avatarUrl)
|
||||
}
|
||||
val topView = helper.getView<ImageView>(R.id.iv_top)
|
||||
if (item.isHourTop1 == 1) {
|
||||
topView.setImageResource(R.drawable.home_room_bg_hour_top)
|
||||
topView.visibility = View.VISIBLE
|
||||
} else if (item.isWeekTop1 == 1) {
|
||||
topView.setImageResource(R.drawable.home_room_bg_week_top)
|
||||
topView.visibility = View.VISIBLE
|
||||
} else {
|
||||
topView.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-xxhdpi/home_room_bg_hour_top.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/home_room_bg_hour_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_room_bg_week_top.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/home_room_bg_week_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
@@ -4,76 +4,63 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="@dimen/dp_6">
|
||||
|
||||
<View
|
||||
android:id="@+id/v_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_84"
|
||||
android:layout_marginHorizontal="@dimen/dp_12"
|
||||
android:background="@drawable/shape_white_10dp_round"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:layout_marginHorizontal="@dimen/dp_15"
|
||||
android:layout_marginVertical="@dimen/dp_5"
|
||||
android:background="@drawable/shape_white_10dp_round">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/iv_room_image"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:padding="@dimen/dp_1"
|
||||
android:layout_width="@dimen/dp_72"
|
||||
android:layout_height="@dimen/dp_72"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/v_bg"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearance="@style/shape_home_recommend_item"
|
||||
app:strokeColor="#FE87FF"
|
||||
app:strokeWidth="@dimen/dp_2" />
|
||||
app:shapeAppearance="@style/shape_home_recommend_item" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_room_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_1E1E1F"
|
||||
android:textSize="@dimen/dp_16"
|
||||
android:textSize="@dimen/dp_15"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_online_number"
|
||||
app:layout_constraintEnd_toEndOf="@id/v_bg"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_desc"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_tag"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_room_image"
|
||||
app:layout_constraintTop_toTopOf="@id/v_bg"
|
||||
app:layout_constraintVertical_chainStyle="spread_inside"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="@string/layout_item_room_common_02" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_online_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
android:drawableStart="@drawable/home_ic_hot"
|
||||
android:drawablePadding="@dimen/dp_3"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#84868A"
|
||||
android:maxLines="1"
|
||||
android:textColor="#1E1E1F"
|
||||
android:textSize="@dimen/dp_12"
|
||||
app:layout_constraintBottom_toBottomOf="@id/v_bg"
|
||||
app:layout_constraintBottom_toTopOf="@id/fl_avatar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_room_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_room_title"
|
||||
tools:text="266" />
|
||||
tools:text="Content" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_avatar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_online_number"
|
||||
app:layout_constraintEnd_toEndOf="@id/v_bg"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_online_number">
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_room_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_desc">
|
||||
|
||||
<com.chwl.app.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar_0"
|
||||
@@ -121,4 +108,36 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_online_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_11"
|
||||
android:drawableStart="@drawable/home_ic_hot"
|
||||
android:drawablePadding="@dimen/dp_3"
|
||||
android:gravity="center_vertical"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#84868A"
|
||||
android:textSize="@dimen/dp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:text="266" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintDimensionRatio="345:92"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/bg_like_pk" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -595,11 +595,16 @@
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="shape_home_recommend_item" parent="shape_circle"/>
|
||||
<style name="shape_home_recommend_item" parent="shape_corner_6dp"/>
|
||||
|
||||
<style name="shape_circle">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">50%</item>
|
||||
</style>
|
||||
|
||||
<style name="shape_corner_6dp">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">@dimen/dp_6</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user