Skip to content

Commit 7821e8f

Browse files
committed
optimize
1 parent 3109a61 commit 7821e8f

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

app/build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ dependencies {
100100
// For HLS playback support with ExoPlayer
101101
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
102102

103+
// 21:2.9.0 17:2.6.4
104+
def retrofit2_version = "2.9.0"
105+
103106
implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
104-
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
105-
implementation 'com.squareup.retrofit2:converter-protobuf:2.9.0'
106-
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
107+
implementation "com.squareup.retrofit2:converter-gson:$retrofit2_version"
108+
implementation "com.squareup.retrofit2:converter-protobuf:$retrofit2_version"
109+
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
107110
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
108111
implementation 'androidx.core:core-ktx:1.11.0-beta02'
109112
implementation 'androidx.leanback:leanback:1.2.0-alpha02'

app/src/main/java/com/lizongying/mytv/PlayerFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class PlayerFragment : Fragment() {
2424
private var _binding: PlayerBinding? = null
2525
private var playerView: PlayerView? = null
2626
private var tvViewModel: TVViewModel? = null
27+
private val aspectRatio = 16f / 9f
2728

2829
override fun onCreateView(
2930
inflater: LayoutInflater, container: ViewGroup?,
@@ -43,10 +44,9 @@ class PlayerFragment : Fragment() {
4344
playerView!!.player?.playWhenReady = true
4445
playerView!!.player?.addListener(object : Player.Listener {
4546
override fun onVideoSizeChanged(videoSize: VideoSize) {
46-
val aspectRatio = 16f / 9f
47-
val layoutParams = playerView?.layoutParams
4847
val ratio = playerView?.measuredWidth?.div(playerView?.measuredHeight!!)
4948
if (ratio != null) {
49+
val layoutParams = playerView?.layoutParams
5050
if (ratio < aspectRatio) {
5151
layoutParams?.height =
5252
(playerView?.measuredWidth?.div(aspectRatio))?.toInt()

app/src/main/java/com/lizongying/mytv/Request.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ class Request {
169169
.enqueue(object : Callback<Info> {
170170
override fun onResponse(call: Call<Info>, response: Response<Info>) {
171171
if (response.isSuccessful) {
172-
val info = response.body()
173-
val token = info?.data?.token
172+
val token = response.body()?.data?.token
174173
Log.i(TAG, "info success $token")
175174
val cookie =
176175
"guid=1; vplatform=109; yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=$token"

app/src/main/java/com/lizongying/mytv/models/TVListViewModel.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.lizongying.mytv.models
22

3-
import android.content.SharedPreferences
43
import androidx.lifecycle.LiveData
54
import androidx.lifecycle.MutableLiveData
65
import androidx.lifecycle.ViewModel

0 commit comments

Comments
 (0)