Ui 调整赋值
This commit is contained in:
parent
a95b8b84e9
commit
68f1119b4a
|
|
@ -5,11 +5,14 @@ import android.view.ViewGroup
|
|||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gamedog.vididin.R
|
||||
import com.gamedog.vididin.beans.ZeroBuyItem
|
||||
import com.gamedog.vididin.databinding.LayoutItemZerobuyBinding as ViewBinding
|
||||
|
||||
class ZeroItemAdapter : ListAdapter<ZeroBuyItem, ZeroItemAdapter.ViewHolder>(DiffCallback()) {
|
||||
|
||||
private val mBgResList = listOf<Int>(R.mipmap.zero_bg_item_sub1, R.mipmap.zero_bg_item_sub2, R.mipmap.zero_bg_item_sub3, R.mipmap.zero_bg_item_sub4)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = ViewBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return ViewHolder(binding)
|
||||
|
|
@ -21,12 +24,12 @@ class ZeroItemAdapter : ListAdapter<ZeroBuyItem, ZeroItemAdapter.ViewHolder>(Dif
|
|||
|
||||
inner class ViewHolder(private val binding: ViewBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: ZeroBuyItem) {
|
||||
/*binding.tvDate.text = transaction.dateTime
|
||||
binding.tvTitle.text = transaction.statusText
|
||||
binding.tvDescription.text = transaction.description
|
||||
binding.tvAmount.text = transaction.amount
|
||||
binding.tvAmount.setTextColor(ContextCompat.getColor(binding.root.context, transaction.amountColor))
|
||||
*/
|
||||
binding.tvTitle.text = item.title
|
||||
binding.tvJoinedNum.text = item.current_users?.size.toString()
|
||||
binding.tvPeopleTotal.text = "/${item.target_num}"
|
||||
binding.tvJoinGoldNum.text = item.cost.toString()
|
||||
binding.ivBgType.setImageResource(mBgResList[item.image])
|
||||
binding.tvRewardCashNum.text = item.price
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:background="@mipmap/zero_bg_item">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
|
|
@ -19,10 +20,26 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7.5dp">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_bg_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/zero_bg_item_sub1"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_reward_cash_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:textSize="10sp"
|
||||
android:text="@string/cash"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
|
@ -42,6 +59,7 @@
|
|||
android:layout_marginTop="0.5dp"
|
||||
android:orientation="horizontal">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_joined_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
|
|
@ -52,6 +70,7 @@
|
|||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_people_total"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4.5dp"
|
||||
|
|
@ -89,6 +108,7 @@
|
|||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_participate_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
|
|
@ -98,6 +118,7 @@
|
|||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_join_gold_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 34 KiB |
Loading…
Reference in New Issue