Commit b0d1f423 authored by wanglei's avatar wanglei

...

parent fff01cf1
package com.base.appzxhy.ui.main //package com.base.appzxhy.ui.main
//
import android.annotation.SuppressLint //import android.annotation.SuppressLint
import android.content.Context //import android.content.Context
import android.view.View //import android.view.View
import android.view.ViewGroup //import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView.ViewHolder //import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.base.appzxhy.BuildConfig //import com.base.appzxhy.BuildConfig
import com.base.appzxhy.R //import com.base.appzxhy.R
import com.base.appzxhy.databinding.ItemYuan2Binding //import com.base.appzxhy.databinding.ItemYuan2Binding
import com.base.appzxhy.utils.XmlEx.inflate //import com.base.appzxhy.utils.XmlEx.inflate
import com.chad.library.adapter4.BaseQuickAdapter //import com.chad.library.adapter4.BaseQuickAdapter
import kotlin.random.Random //import kotlin.random.Random
//
class YuanAdapter2 : BaseQuickAdapter<Array<String>, YuanAdapter2.AAA>() { //class YuanAdapter2 : BaseQuickAdapter<Array<String>, YuanAdapter2.AAA>() {
//
var cleanClick: (() -> Unit)? = null // var cleanClick: (() -> Unit)? = null
//
inner class AAA(view: View) : ViewHolder(view) // inner class AAA(view: View) : ViewHolder(view)
//
@SuppressLint("SetTextI18n") // @SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: AAA, position: Int, item: Array<String>?) { // override fun onBindViewHolder(holder: AAA, position: Int, item: Array<String>?) {
item ?: return // item ?: return
val binding = ItemYuan2Binding.bind(holder.itemView) // val binding = ItemYuan2Binding.bind(holder.itemView)
//
if (BuildConfig.DEBUG) { // if (BuildConfig.DEBUG) {
binding.tvCleanSize.text = "%.2f".format(Random.nextFloat() * Random.nextInt(1, 10)) // binding.tvCleanSize.text = "%.2f".format(Random.nextFloat() * Random.nextInt(1, 10))
binding.tvCleanSizeUnit.text = "GB Found" // binding.tvCleanSizeUnit.text = "GB Found"
} // }
//
binding.tvSize2.text = item[0] // binding.tvSize2.text = item[0]
binding.tvSize1.text = item[1] // binding.tvSize1.text = item[1]
//
//
binding.fl.setOnClickListener { // binding.fl.setOnClickListener {
cleanClick?.invoke() // cleanClick?.invoke()
} // }
binding.tvClean.setOnClickListener { // binding.tvClean.setOnClickListener {
cleanClick?.invoke() // cleanClick?.invoke()
} // }
} // }
//
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): AAA { // override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): AAA {
return AAA(R.layout.item_yuan_2.inflate(parent)) // return AAA(R.layout.item_yuan_2.inflate(parent))
} // }
//
//
} //}
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:centerY="0.5"
android:centerX="0.5"
android:angle="270"
android:endColor="#6FF2A2"
android:startColor="#2DD29E" />
</shape>
\ No newline at end of file
...@@ -6,14 +6,38 @@ ...@@ -6,14 +6,38 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"> android:background="@color/white">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_450"
android:background="@drawable/bg_2dd29e_6ff2a2"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/flTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">
<androidx.recyclerview.widget.RecyclerView <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/dp_16"
android:layout_marginStart="@dimen/dp_16"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="@dimen/sp_20" />
</FrameLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/rv" android:id="@+id/rv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:overScrollMode="never" android:overScrollMode="never"
android:paddingHorizontal="8dp" android:paddingHorizontal="8dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="parent" /> app:layout_constraintTop_toBottomOf="@id/flTop">
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -47,4 +47,5 @@ ...@@ -47,4 +47,5 @@
<dimen name="sp_13">13sp</dimen> <dimen name="sp_13">13sp</dimen>
<dimen name="dp_260">260dp</dimen> <dimen name="dp_260">260dp</dimen>
<dimen name="dp_26">26dp</dimen> <dimen name="dp_26">26dp</dimen>
<dimen name="dp_450">450dp</dimen>
</resources> </resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment