@@ -3,7 +3,6 @@ package com.lizongying.mytv0
33import android.content.Context
44import android.graphics.Bitmap
55import android.graphics.Canvas
6- import android.graphics.Color
76import android.graphics.Paint
87import android.os.Handler
98import android.os.Looper
@@ -15,7 +14,6 @@ import android.view.ViewGroup
1514import android.view.ViewGroup.FOCUS_BEFORE_DESCENDANTS
1615import android.view.ViewGroup.FOCUS_BLOCK_DESCENDANTS
1716import androidx.core.content.ContextCompat
18- import androidx.core.view.marginStart
1917import androidx.core.view.setPadding
2018import androidx.recyclerview.widget.LinearLayoutManager
2119import androidx.recyclerview.widget.RecyclerView
@@ -185,20 +183,27 @@ class ListAdapter(
185183 }
186184
187185 fun bindImage (url : String? , id : Int , name : String , tvModel : TVModel ) {
188- val width = Utils .dpToPx( 40 )
189- val height = Utils .dpToPx( 40 )
186+ val width = 300
187+ val height = 180
190188 val bitmap = Bitmap .createBitmap(width, height, Bitmap .Config .ARGB_8888 )
191189 val canvas = Canvas (bitmap)
192190
191+ val channelNum = id + 1
192+ var size = 150f
193+ if (channelNum > 99 ) {
194+ size = 100f
195+ }
196+ if (channelNum > 999 ) {
197+ size = 75f
198+ }
193199 val paint = Paint ().apply {
194- color = Color . WHITE
195- textSize = 32f
200+ color = ContextCompat .getColor(context, R .color.title_blur)
201+ textSize = size
196202 textAlign = Paint .Align .CENTER
197203 }
198- val text = String .format(" %3d" , id + 1 )
199204 val x = width / 2f
200205 val y = height / 2f - (paint.descent() + paint.ascent()) / 2
201- canvas.drawText(text , x, y, paint)
206+ canvas.drawText(channelNum.toString() , x, y, paint)
202207
203208 var urls =
204209 getUrls(
@@ -230,13 +235,15 @@ class ListAdapter(
230235 R .drawable.baseline_favorite_24
231236 )
232237 )
238+ binding.heart.setColorFilter(ContextCompat .getColor(context, R .color.heart))
233239 } else {
234240 binding.heart.setImageDrawable(
235241 ContextCompat .getDrawable(
236242 context,
237243 R .drawable.baseline_favorite_border_24
238244 )
239245 )
246+ binding.heart.setColorFilter(ContextCompat .getColor(context, R .color.title_blur))
240247 }
241248 }
242249 }
0 commit comments