fix:调整翻译

feat:完成勋章展示
This commit is contained in:
max
2024-06-24 11:13:43 +08:00
parent 2a1983aa46
commit 16a8f9a52a
11 changed files with 141 additions and 12 deletions

View File

@@ -0,0 +1,16 @@
package com.chwl.app.ui.user.adapter
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.chwl.app.ui.utils.load
import com.chwl.core.user.bean.MedalBean
class UserInfoMedalAdapter :
BaseQuickAdapter<MedalBean, BaseViewHolder>(R.layout.user_info_item_medal) {
override fun convert(helper: BaseViewHolder, item: MedalBean) {
val imageView = helper.getView<ImageView>(R.id.iv_image)
imageView.load(item.picUrl)
}
}

View File

@@ -14,6 +14,7 @@ import com.chwl.app.ui.user.activity.UserInfoModifyActivity
import com.chwl.app.ui.user.activity.UserModifyPhotosActivity
import com.chwl.app.ui.user.adapter.UserInfoAlbumAdapter
import com.chwl.app.ui.user.adapter.UserInfoGiftAdapter
import com.chwl.app.ui.user.adapter.UserInfoMedalAdapter
import com.chwl.app.ui.user.viewmodel.UserInfoViewModel
import com.chwl.app.ui.widget.recyclerview.decoration.GridSpacingItemNewDecoration
import com.chwl.core.user.bean.UserPhoto
@@ -21,16 +22,11 @@ import com.example.lib_utils.UiUtils
class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding>() {
private val albumAdapter = UserInfoAlbumAdapter()
private val giftAdapter = UserInfoGiftAdapter()
private val luckyGiftAdapter = UserInfoGiftAdapter(R.drawable.user_info_bg_lucku_gift)
private val viewModel: UserInfoViewModel by activityViewModels()
override fun init() {
initAlbum()
initMedal()
initGift()
initLuckyGift()
FragmentVisibleStateHelper(this).apply {
@@ -41,6 +37,7 @@ class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding
}
private fun initAlbum() {
val albumAdapter = UserInfoAlbumAdapter()
binding.ivAlbumMore.isVisible = viewModel.isMe
binding.recyclerViewAlbum.adapter = albumAdapter
binding.layoutAlbum.setOnClickListener {
@@ -67,7 +64,19 @@ class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding
}
}
private fun initMedal() {
val medalAdapter = UserInfoMedalAdapter()
binding.recyclerViewMedal.adapter = medalAdapter
viewModel.userInfoDetailData.observe(this) {
val list = it.medals.userMedals
binding.tvMedalCount.text = "(${list?.size ?: 0})"
medalAdapter.setNewData(list)
binding.layoutMedal.isVisible = !list.isNullOrEmpty()
}
}
private fun initGift() {
val giftAdapter = UserInfoGiftAdapter()
var isMiniMode = true
binding.ivGiftMore.setOnClickListener {
isMiniMode = !isMiniMode
@@ -91,6 +100,7 @@ class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding
}
private fun initLuckyGift() {
val luckyGiftAdapter = UserInfoGiftAdapter(R.drawable.user_info_bg_lucku_gift)
var isMiniMode = true
binding.ivLuckyGiftMore.setOnClickListener {
isMiniMode = !isMiniMode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -59,6 +59,7 @@
android:layout_height="@dimen/dp_81"
android:layout_marginTop="@dimen/dp_14"
android:clipToPadding="false"
android:nestedScrollingEnabled="false"
android:orientation="horizontal"
android:overScrollMode="never"
android:paddingHorizontal="@dimen/dp_13"
@@ -81,11 +82,61 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_medal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_20"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tv_medal_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:text="@string/medal"
android:textColor="#191919"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_medal_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_3"
android:text="(0)"
android:textColor="#666666"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_medal_title"
app:layout_constraintStart_toEndOf="@id/tv_medal_title"
app:layout_constraintTop_toTopOf="@id/tv_medal_title" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_medal"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_55"
android:layout_marginTop="@dimen/dp_11"
android:clipToPadding="false"
android:nestedScrollingEnabled="false"
android:orientation="horizontal"
android:overScrollMode="never"
android:paddingHorizontal="@dimen/dp_12"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@id/tv_medal_title"
tools:background="#33000000"
tools:listitem="@layout/user_info_item_medal" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_gift"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_21">
android:layout_marginTop="@dimen/dp_20">
<TextView
android:id="@+id/tv_gift_title"
@@ -140,7 +191,6 @@
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_lucky_gift"
android:layout_width="match_parent"

View File

@@ -0,0 +1,20 @@
<?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="wrap_content"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/dp_3"
tools:layout_height="@dimen/dp_55">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_image"
android:layout_width="0dp"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintStart_toStartOf="parent"
tools:src="@drawable/default_cover" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -5302,6 +5302,7 @@
<string name="home_room_card_topic_empty_def">اهلا بك في غرفتي</string>
<string name="lately">مؤخرًا</string>
<string name="photo_album_empty_tips">塹無照片</string>
<string name="gift_empty_tips">塹無禮物</string>
<string name="photo_album_empty_tips">لا توجد صور بعد</string>
<string name="gift_empty_tips">لا توجد هدايا بعد</string>
<string name="medal">ميدالية</string>
</resources>

View File

@@ -5245,4 +5245,5 @@
<string name="lately">最近</string>
<string name="photo_album_empty_tips">塹無照片</string>
<string name="gift_empty_tips">塹無禮物</string>
<string name="medal">勳章</string>
</resources>

View File

@@ -5283,8 +5283,9 @@ You cannot join again within 24 hours after leaving</string>
<string name="home_room_card_topic_empty_def">Welcome to my room</string>
<string name="lately">Recent</string>
<string name="photo_album_empty_tips">塹無照片</string>
<string name="gift_empty_tips">塹無禮物</string>
<string name="photo_album_empty_tips">No photos yet</string>
<string name="gift_empty_tips">No gifts yet</string>
<string name="medal">Medal</string>
</resources>