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.activity.UserModifyPhotosActivity
import com.chwl.app.ui.user.adapter.UserInfoAlbumAdapter import com.chwl.app.ui.user.adapter.UserInfoAlbumAdapter
import com.chwl.app.ui.user.adapter.UserInfoGiftAdapter 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.user.viewmodel.UserInfoViewModel
import com.chwl.app.ui.widget.recyclerview.decoration.GridSpacingItemNewDecoration import com.chwl.app.ui.widget.recyclerview.decoration.GridSpacingItemNewDecoration
import com.chwl.core.user.bean.UserPhoto import com.chwl.core.user.bean.UserPhoto
@@ -21,16 +22,11 @@ import com.example.lib_utils.UiUtils
class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding>() { 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() private val viewModel: UserInfoViewModel by activityViewModels()
override fun init() { override fun init() {
initAlbum() initAlbum()
initMedal()
initGift() initGift()
initLuckyGift() initLuckyGift()
FragmentVisibleStateHelper(this).apply { FragmentVisibleStateHelper(this).apply {
@@ -41,6 +37,7 @@ class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding
} }
private fun initAlbum() { private fun initAlbum() {
val albumAdapter = UserInfoAlbumAdapter()
binding.ivAlbumMore.isVisible = viewModel.isMe binding.ivAlbumMore.isVisible = viewModel.isMe
binding.recyclerViewAlbum.adapter = albumAdapter binding.recyclerViewAlbum.adapter = albumAdapter
binding.layoutAlbum.setOnClickListener { 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() { private fun initGift() {
val giftAdapter = UserInfoGiftAdapter()
var isMiniMode = true var isMiniMode = true
binding.ivGiftMore.setOnClickListener { binding.ivGiftMore.setOnClickListener {
isMiniMode = !isMiniMode isMiniMode = !isMiniMode
@@ -91,6 +100,7 @@ class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding
} }
private fun initLuckyGift() { private fun initLuckyGift() {
val luckyGiftAdapter = UserInfoGiftAdapter(R.drawable.user_info_bg_lucku_gift)
var isMiniMode = true var isMiniMode = true
binding.ivLuckyGiftMore.setOnClickListener { binding.ivLuckyGiftMore.setOnClickListener {
isMiniMode = !isMiniMode 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_height="@dimen/dp_81"
android:layout_marginTop="@dimen/dp_14" android:layout_marginTop="@dimen/dp_14"
android:clipToPadding="false" android:clipToPadding="false"
android:nestedScrollingEnabled="false"
android:orientation="horizontal" android:orientation="horizontal"
android:overScrollMode="never" android:overScrollMode="never"
android:paddingHorizontal="@dimen/dp_13" android:paddingHorizontal="@dimen/dp_13"
@@ -81,11 +82,61 @@
</androidx.constraintlayout.widget.ConstraintLayout> </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 <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_gift" android:id="@+id/layout_gift"
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_21"> android:layout_marginTop="@dimen/dp_20">
<TextView <TextView
android:id="@+id/tv_gift_title" android:id="@+id/tv_gift_title"
@@ -140,7 +191,6 @@
tools:visibility="visible" /> tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_lucky_gift" android:id="@+id/layout_lucky_gift"
android:layout_width="match_parent" 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="home_room_card_topic_empty_def">اهلا بك في غرفتي</string>
<string name="lately">مؤخرًا</string> <string name="lately">مؤخرًا</string>
<string name="photo_album_empty_tips">塹無照片</string> <string name="photo_album_empty_tips">لا توجد صور بعد</string>
<string name="gift_empty_tips">塹無禮物</string> <string name="gift_empty_tips">لا توجد هدايا بعد</string>
<string name="medal">ميدالية</string>
</resources> </resources>

View File

@@ -5245,4 +5245,5 @@
<string name="lately">最近</string> <string name="lately">最近</string>
<string name="photo_album_empty_tips">塹無照片</string> <string name="photo_album_empty_tips">塹無照片</string>
<string name="gift_empty_tips">塹無禮物</string> <string name="gift_empty_tips">塹無禮物</string>
<string name="medal">勳章</string>
</resources> </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="home_room_card_topic_empty_def">Welcome to my room</string>
<string name="lately">Recent</string> <string name="lately">Recent</string>
<string name="photo_album_empty_tips">塹無照片</string> <string name="photo_album_empty_tips">No photos yet</string>
<string name="gift_empty_tips">塹無禮物</string> <string name="gift_empty_tips">No gifts yet</string>
<string name="medal">Medal</string>
</resources> </resources>

View File

@@ -0,0 +1,11 @@
package com.chwl.core.user.bean
import androidx.annotation.Keep
import java.io.Serializable
@Keep
class MedalBean : Serializable {
val medalId: Long? = null
val picUrl: String? = null
val medalName: String? = null
}

View File

@@ -71,6 +71,7 @@ public class UserDetailInfo implements Serializable {
private String nameplatePic; private String nameplatePic;
private String nameplateWord; private String nameplateWord;
private String region; private String region;
private UserDetailMedalInfo medals;
public String getRegion() { public String getRegion() {
return region; return region;
@@ -192,6 +193,14 @@ public class UserDetailInfo implements Serializable {
this.privatePhoto = privatePhoto; this.privatePhoto = privatePhoto;
} }
public UserDetailMedalInfo getMedals() {
return medals;
}
public void setMedals(UserDetailMedalInfo medals) {
this.medals = medals;
}
public static class UserLevelVoBean { public static class UserLevelVoBean {
/** /**
* experAmount : 1647 * experAmount : 1647

View File

@@ -0,0 +1,10 @@
package com.chwl.core.user.bean
import androidx.annotation.Keep
import java.io.Serializable
@Keep
class UserDetailMedalInfo : Serializable {
val userMedals: List<MedalBean>? = null
val medalCount: Long? = null
}