Skip to content

Commit ff89218

Browse files
committed
optimize style
1 parent 32356cd commit ff89218

File tree

9 files changed

+46
-22
lines changed

9 files changed

+46
-22
lines changed

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## 更新日誌
22

3+
### v1.3.8.12-kitkat
4+
5+
* 優化樣式
6+
37
### v1.3.8.11-kitkat
48

59
* 新增視頻源後默認選中

app/src/main/java/com/lizongying/mytv0/InfoFragment.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,18 @@ class InfoFragment : Fragment() {
8484

8585
when (tvModel.tv.title) {
8686
else -> {
87-
val width = Utils.dpToPx(100)
88-
val height = Utils.dpToPx(60)
87+
val width = 300
88+
val height = 180
8989
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
9090
val canvas = Canvas(bitmap)
9191

92-
val text = "${tvModel.tv.id + 1}"
93-
var size = 100f
94-
if (tvModel.tv.id > 999) {
95-
size = 90f
92+
val channelNum = tvModel.tv.id + 1
93+
var size = 150f
94+
if (channelNum > 99) {
95+
size = 100f
96+
}
97+
if (channelNum > 999) {
98+
size = 75f
9699
}
97100
val paint = Paint().apply {
98101
color = ContextCompat.getColor(context, R.color.title_blur)
@@ -101,7 +104,7 @@ class InfoFragment : Fragment() {
101104
}
102105
val x = width / 2f
103106
val y = height / 2f - (paint.descent() + paint.ascent()) / 2
104-
canvas.drawText(text, x, y, paint)
107+
canvas.drawText(channelNum.toString(), x, y, paint)
105108

106109
val url = tvModel.tv.logo
107110
val name = tvModel.tv.name

app/src/main/java/com/lizongying/mytv0/ListAdapter.kt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.lizongying.mytv0
33
import android.content.Context
44
import android.graphics.Bitmap
55
import android.graphics.Canvas
6-
import android.graphics.Color
76
import android.graphics.Paint
87
import android.os.Handler
98
import android.os.Looper
@@ -15,7 +14,6 @@ import android.view.ViewGroup
1514
import android.view.ViewGroup.FOCUS_BEFORE_DESCENDANTS
1615
import android.view.ViewGroup.FOCUS_BLOCK_DESCENDANTS
1716
import androidx.core.content.ContextCompat
18-
import androidx.core.view.marginStart
1917
import androidx.core.view.setPadding
2018
import androidx.recyclerview.widget.LinearLayoutManager
2119
import 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
}

app/src/main/java/com/lizongying/mytv0/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ class MainActivity : AppCompatActivity() {
9797
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
9898
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
9999
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
100-
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
101-
View.SYSTEM_UI_FLAG_IMMERSIVE
100+
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
101+
// View.SYSTEM_UI_FLAG_IMMERSIVE
102102
}
103103

104104
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

app/src/main/java/com/lizongying/mytv0/ModalFragment.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class ModalFragment : DialogFragment() {
2828
dialog?.window?.apply {
2929
addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
3030
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
31+
32+
setBackgroundDrawableResource(android.R.color.transparent)
33+
34+
setLayout(binding.modalImage.layoutParams.width, WindowManager.LayoutParams.WRAP_CONTENT)
3135
}
3236
}
3337

app/src/main/java/com/lizongying/mytv0/SourcesAdapter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import android.view.LayoutInflater
66
import android.view.View
77
import android.view.ViewGroup
88
import androidx.core.content.ContextCompat
9-
import androidx.core.view.marginEnd
10-
import androidx.core.view.marginStart
119
import androidx.core.view.setPadding
1210
import androidx.recyclerview.widget.LinearLayoutManager
1311
import androidx.recyclerview.widget.RecyclerView
@@ -41,6 +39,8 @@ class SourcesAdapter(
4139
binding.heart.layoutParams.height = application.px2Px(binding.heart.layoutParams.height)
4240
binding.heart.setPadding(application.px2Px(binding.heart.paddingTop))
4341

42+
binding.heart.setColorFilter(ContextCompat.getColor(context, R.color.title_blur))
43+
4444
return ViewHolder(context, binding)
4545
}
4646

app/src/main/java/com/lizongying/mytv0/SourcesFragment.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ class SourcesFragment : DialogFragment(), SourcesAdapter.ItemListener {
2828
super.onStart()
2929
dialog?.window?.apply {
3030
addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
31-
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
31+
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
32+
View.SYSTEM_UI_FLAG_FULLSCREEN
33+
34+
setBackgroundDrawableResource(android.R.color.transparent)
35+
36+
setLayout(binding.list.layoutParams.width, WindowManager.LayoutParams.WRAP_CONTENT)
3237
}
3338
}
3439

app/src/main/res/layout/sources.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
android:id="@+id/sources"
66
android:layout_width="wrap_content"
77
android:layout_height="wrap_content"
8-
android:background="@color/description_blur"
98
>
109
<TextView
1110
android:id="@+id/content"
@@ -20,13 +19,15 @@
2019
android:visibility="gone"
2120
android:text="@string/no_video_source"
2221
app:layout_constraintStart_toStartOf="parent"
22+
app:layout_constraintEnd_toEndOf="parent"
2323
app:layout_constraintTop_toTopOf="parent"
2424
/>
2525
<androidx.recyclerview.widget.RecyclerView
2626
android:id="@+id/list"
2727
android:layout_width="600dp"
2828
android:layout_height="400dp"
2929
app:layout_constraintStart_toStartOf="parent"
30+
app:layout_constraintEnd_toEndOf="parent"
3031
app:layout_constraintTop_toTopOf="parent"
3132
>
3233
</androidx.recyclerview.widget.RecyclerView>

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version_code": 16975883, "version_name": "v1.3.8.11-kitkat"}
1+
{"version_code": 16975884, "version_name": "v1.3.8.12-kitkat"}

0 commit comments

Comments
 (0)