From f95525252d1646ef42b304a893a039cc32f462e7 Mon Sep 17 00:00:00 2001 From: Li ZongYing Date: Mon, 29 Apr 2024 13:57:45 +0800 Subject: [PATCH] fix parse m3u --- app/src/main/AndroidManifest.xml | 1 - .../main/java/com/lizongying/mytv0/MainActivity.kt | 3 --- .../main/java/com/lizongying/mytv0/models/TVList.kt | 13 +++++++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 595e7778..412abb86 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -51,5 +51,4 @@ - \ No newline at end of file diff --git a/app/src/main/java/com/lizongying/mytv0/MainActivity.kt b/app/src/main/java/com/lizongying/mytv0/MainActivity.kt index 0d91550e..90ca76b4 100644 --- a/app/src/main/java/com/lizongying/mytv0/MainActivity.kt +++ b/app/src/main/java/com/lizongying/mytv0/MainActivity.kt @@ -599,9 +599,6 @@ class MainActivity : FragmentActivity() { override fun onStop() { super.onStop() - SP.positionGroup = TVList.groupModel.position.value!! - SP.position = TVList.position.value!! - Log.i(TAG, "position ${TVList.position.value!!} saved") } companion object { diff --git a/app/src/main/java/com/lizongying/mytv0/models/TVList.kt b/app/src/main/java/com/lizongying/mytv0/models/TVList.kt index 82755bb7..9653d3e4 100644 --- a/app/src/main/java/com/lizongying/mytv0/models/TVList.kt +++ b/app/src/main/java/com/lizongying/mytv0/models/TVList.kt @@ -37,7 +37,7 @@ object TVList { groupModel.addTVListModel(TVListModel("全部频道")) - if (SP.configAutoLoad) { + if (SP.configAutoLoad && !SP.config.isNullOrEmpty()) { SP.config?.let { update(it) } @@ -142,14 +142,14 @@ object TVList { Log.i("info", "$title $name $group $logo $uris") val tv = TV( 0, - name!!, + name ?: "", title, "", - logo!!, + logo ?: "", "", uris, mapOf(), - group!!, + group ?: "", listOf(), ) @@ -240,6 +240,11 @@ object TVList { // set a new position or retry when position same listModel[position].setReady() + + SP.positionGroup = groupModel.position.value!! + SP.position = position + Log.i(TAG, "saved $position") + return true }