diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml
new file mode 100644
index 00000000..49739644
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug.yml
@@ -0,0 +1,83 @@
+name: Bug 反馈
+description: 反馈一个 Bug
+labels: [ "bug" ]
+title: "[BUG] "
+body:
+ - type: checkboxes
+ id: checklist
+ attributes:
+ label: 检查清单
+ description: 确保我们的错误报告表单适合您。
+ options:
+ - label: 之前没有人提交过类似或相同的 bug report。
+ required: true
+ - label: 我正在使用本软件的最新版本。
+ required: true
+ - type: dropdown
+ id: version
+ attributes:
+ label: my-ty 版本
+ description: 请选择正在使用的版本
+ options:
+ - 最新稳定版
+ - 最新 CI 版
+ validations:
+ required: true
+ - type: textarea
+ id: bug
+ attributes:
+ label: Bug 描述
+ description: 请描述 bug 详情
+ placeholder: |
+ e.g. Crashed when generating snapshot.
+ validations:
+ required: true
+ - type: textarea
+ id: expected
+ attributes:
+ label: 预期行为
+ description: 你预期会发生什么?
+ placeholder: |
+ e.g. A New snapshot!
+ validations:
+ required: true
+ - type: textarea
+ id: actual
+ attributes:
+ label: 实际行为
+ description: 反而发生了什么?
+ placeholder: |
+ e.g. Crashed.
+ validations:
+ required: true
+ - type: textarea
+ id: steps
+ attributes:
+ label: 复现步骤
+ description: 如何复现这个 bug。
+ placeholder: |
+ 1. Open the app
+ 2. Crashed
+
+ What an app.
+ - type: input
+ id: ui
+ attributes:
+ label: UI / OS
+ description: 你的电视系统 UI 或 OS 或 品牌
+ placeholder: TCL / XIAOMI / PHONE / etc.
+ validations:
+ required: true
+ - type: input
+ id: android
+ attributes:
+ label: Android 版本
+ description: 你的 Android 版本
+ placeholder: "12"
+ validations:
+ required: true
+ - type: textarea
+ id: additional
+ attributes:
+ label: 额外信息
+ description: 任何你觉得值得说的。
diff --git a/.github/ISSUE_TEMPLATE/fr.yml b/.github/ISSUE_TEMPLATE/fr.yml
new file mode 100644
index 00000000..e409ba49
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/fr.yml
@@ -0,0 +1,36 @@
+name: 功能(新频道)请求
+description: 提出一个建议
+labels: [ "enhancement" ]
+title: "[FR] "
+body:
+ - type: checkboxes
+ id: checklist
+ attributes:
+ label: 检查清单
+ description: 确保我们的错误报告表单适合您。
+ options:
+ - label: 之前没有人提交过类似或相同的功能请求。
+ required: true
+ - label: 这个建议不会背离 LibChecker 的初衷。
+ required: true
+ - type: textarea
+ id: propose
+ attributes:
+ label: 改进目的
+ description: 改进有什么用
+ placeholder: |
+ Show your idea here.
+ validations:
+ required: true
+ - type: textarea
+ id: solution
+ attributes:
+ label: 解决方案
+ description: 你会怎么完成这个改进?
+ placeholder: |
+ How to do it on your opinion? Or left this blank
+ - type: textarea
+ id: addition
+ attributes:
+ label: 额外信息
+ description: 任何你觉得值得说的。
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..71beb31b
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,59 @@
+name: build
+
+on:
+ push:
+ tags:
+ - 'v*'
+
+permissions:
+ contents: write
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+
+ - name: Run build with Gradle wrapper
+ run: ./gradlew assembleRelease -PIS_SO_BUILD=false
+
+ - name: Sign app APK
+ id: sign_app
+ uses: r0adkll/sign-android-release@v1
+ with:
+ releaseDirectory: app/build/outputs/apk/release
+ alias: ${{ secrets.ALIAS }}
+ signingKeyBase64: ${{ secrets.KEYSTORE }}
+ keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
+ keyPassword: ${{ secrets.ALIAS_PASSWORD }}
+ env:
+ # override default build-tools version (29.0.3) -- optional
+ BUILD_TOOLS_VERSION: "34.0.0"
+
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ github.ref }}
+ release_name: Release ${{ github.ref }}
+ draft: false
+ prerelease: false
+
+ - name: Upload Release Asset
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_path: ${{ steps.sign_app.outputs.signedReleaseFile }}
+ asset_name: my-tv-${{ github.ref_name }}.apk
+ asset_content_type: application/vnd.android.package-archive
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..565a5412
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,16 @@
+*.iml
+.gradle
+.idea
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..ff59e088
--- /dev/null
+++ b/README.md
@@ -0,0 +1,39 @@
+# 我的电视·〇
+
+电视播放软件,可以自定义源
+
+## 使用
+
+下载安装 [releases](https://github.com/lizongying/my-tv-0/releases/)
+
+更多地址 [my-tv](https://lyrics.run/my-tv-0.html)
+
+
+
+## 更新日志
+
+### v1.0.0
+
+* 基本视频播放
+
+## 其他
+
+小米电视可以使用小米电视助手进行安装
+
+如电视可以启用ADB,也可以通过ADB进行安装:
+
+```shell
+adb install my-tv-0.apk
+```
+
+## TODO
+
+* 音量不同
+* 收藏夹
+* 自定义源
+* 节目增加预告
+* 频道列表优化
+
+## 赞赏
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 00000000..42afabfd
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 00000000..9f75202a
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,69 @@
+plugins {
+ id("com.android.application")
+ id("org.jetbrains.kotlin.android")
+}
+
+android {
+ namespace = "com.lizongying.mytv0"
+ compileSdk = 34
+
+ defaultConfig {
+ applicationId = "com.lizongying.mytv0"
+ minSdk = 23
+ targetSdk = 34
+ versionCode = 1
+ versionName = "1.0"
+
+
+ }
+
+ buildFeatures {
+ viewBinding = true
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+}
+
+dependencies {
+ val media3Version = "1.3.0-rc01"
+ implementation("androidx.media3:media3-ui:$media3Version")
+
+ // For media playback using ExoPlayer
+ implementation("androidx.media3:media3-exoplayer:$media3Version")
+
+ // For HLS playback support with ExoPlayer
+ implementation("androidx.media3:media3-exoplayer-hls:$media3Version")
+
+ implementation("androidx.core:core-ktx:1.12.0")
+ implementation("androidx.leanback:leanback:1.0.0")
+ implementation("com.github.bumptech.glide:glide:4.11.0")
+
+ // 21:2.9.0 17:2.6.4
+ val retrofit2Version = "2.6.4"
+ implementation("com.squareup.retrofit2:converter-gson:$retrofit2Version")
+ implementation ("com.squareup.retrofit2:converter-protobuf:$retrofit2Version")
+ implementation ("com.squareup.retrofit2:retrofit:$retrofit2Version")
+
+ // For yunos
+ val exoplayerVersion = "2.13.3"
+ implementation("com.google.android.exoplayer:exoplayer-ui:$exoplayerVersion")
+ implementation("com.google.android.exoplayer:exoplayer-core:$exoplayerVersion")
+ implementation("com.google.android.exoplayer:exoplayer-hls:$exoplayerVersion")
+
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0-RC")
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 00000000..481bb434
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
new file mode 100644
index 00000000..4a5e1303
Binary files /dev/null and b/app/release/app-release.apk differ
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
new file mode 100644
index 00000000..856af11e
--- /dev/null
+++ b/app/release/output-metadata.json
@@ -0,0 +1,20 @@
+{
+ "version": 3,
+ "artifactType": {
+ "type": "APK",
+ "kind": "Directory"
+ },
+ "applicationId": "com.lizongying.mytv0",
+ "variantName": "release",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "attributes": [],
+ "versionCode": 1,
+ "versionName": "1.0",
+ "outputFile": "app-release.apk"
+ }
+ ],
+ "elementType": "File"
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..df25072d
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/CategoryAdapter.kt b/app/src/main/java/com/lizongying/mytv0/CategoryAdapter.kt
new file mode 100644
index 00000000..253e5501
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/CategoryAdapter.kt
@@ -0,0 +1,150 @@
+package com.lizongying.mytv0
+
+import android.content.Context
+import android.util.Log
+import android.view.KeyEvent
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.core.content.ContextCompat
+import androidx.recyclerview.widget.RecyclerView
+import com.lizongying.mytv0.databinding.CategoryItemBinding
+import com.lizongying.mytv0.models.TVCategoryModel
+import com.lizongying.mytv0.models.TVListModel
+
+
+class CategoryAdapter(
+ private val context: Context,
+ private val recyclerView: RecyclerView,
+ private var tvCategoryModel: TVCategoryModel,
+) :
+ RecyclerView.Adapter() {
+
+ private var listener: ItemListener? = null
+ private var focused: View? = null
+ private var defaultFocused = false
+ var defaultFocus: Int = -1
+
+ var visiable = false
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+ val inflater = LayoutInflater.from(context)
+ val binding = CategoryItemBinding.inflate(inflater, parent, false)
+ binding.root.isFocusable = true
+ binding.root.isFocusableInTouchMode = true
+ return ViewHolder(context, binding)
+ }
+
+ fun focusable(able: Boolean) {
+ recyclerView.isFocusable = able
+ recyclerView.isFocusableInTouchMode = able
+ if (able) {
+ recyclerView.descendantFocusability = ViewGroup.FOCUS_BEFORE_DESCENDANTS
+ } else {
+ recyclerView.descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
+ }
+ }
+
+ fun clear() {
+ focused?.clearFocus()
+ recyclerView.invalidate()
+ }
+
+ override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) {
+ val tvListModel = tvCategoryModel.getTVListModel(position)!!
+ val view = viewHolder.itemView
+ view.tag = position
+
+ if (!defaultFocused && position == defaultFocus) {
+ view.requestFocus()
+ defaultFocused = true
+ }
+
+ val onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
+ listener?.onItemFocusChange(tvListModel, hasFocus)
+
+ if (hasFocus) {
+ viewHolder.focus(true)
+ focused = view
+ if (visiable) {
+ if (position != tvCategoryModel.position.value) {
+ tvCategoryModel.setPosition(position)
+ }
+ } else {
+ visiable = true
+ }
+ } else {
+ viewHolder.focus(false)
+ }
+ }
+
+ view.onFocusChangeListener = onFocusChangeListener
+
+ view.setOnClickListener { _ ->
+ listener?.onItemClicked(tvListModel)
+ }
+
+ view.setOnKeyListener { v, keyCode, event: KeyEvent? ->
+ if (event?.action == KeyEvent.ACTION_DOWN) {
+ if (keyCode == KeyEvent.KEYCODE_DPAD_UP && position == 0) {
+ recyclerView.smoothScrollToPosition(getItemCount() - 1)
+ }
+
+ if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN && position == getItemCount() - 1) {
+ recyclerView.smoothScrollToPosition(0)
+ }
+
+ return@setOnKeyListener listener?.onKey(keyCode) ?: false
+ }
+ false
+ }
+
+ viewHolder.bind(tvListModel.getName())
+ }
+
+ override fun getItemCount() = tvCategoryModel.size()
+
+ class ViewHolder(private val context: Context, private val binding: CategoryItemBinding) :
+ RecyclerView.ViewHolder(binding.root) {
+ fun bind(text: String) {
+ binding.textView.text = text
+ }
+
+ fun focus(hasFocus: Boolean) {
+ if (hasFocus) {
+ binding.textView.setTextColor(ContextCompat.getColor(context, R.color.white))
+ } else {
+ binding.textView.setTextColor(
+ ContextCompat.getColor(
+ context,
+ R.color.description_blur
+ )
+ )
+ }
+ }
+ }
+
+ fun toPosition(position: Int) {
+ recyclerView.post {
+ Log.i(TAG, "category smoothScrollToPosition $position")
+ recyclerView.scrollToPosition(position)
+ recyclerView.getChildAt(position)?.isSelected
+ recyclerView.getChildAt(position)?.requestFocus()
+ }
+ }
+
+ interface ItemListener {
+ fun onItemFocusChange(tvListModel: TVListModel, hasFocus: Boolean)
+ fun onItemClicked(tvListModel: TVListModel)
+ fun onKey(keyCode: Int): Boolean
+ }
+
+ fun setItemListener(listener: ItemListener) {
+ this.listener = listener
+ }
+
+ companion object {
+ private const val TAG = "CategoryAdapter"
+ }
+}
+
diff --git a/app/src/main/java/com/lizongying/mytv0/ChannelFragment.kt b/app/src/main/java/com/lizongying/mytv0/ChannelFragment.kt
new file mode 100644
index 00000000..33ef706e
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/ChannelFragment.kt
@@ -0,0 +1,82 @@
+package com.lizongying.mytv0
+
+import android.os.Bundle
+import android.os.Handler
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lizongying.mytv0.databinding.ChannelBinding
+import com.lizongying.mytv0.models.TVModel
+
+class ChannelFragment : Fragment() {
+ private var _binding: ChannelBinding? = null
+ private val binding get() = _binding!!
+
+ private val handler = Handler()
+ private val delay: Long = 3000
+ private var channel = 0
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ _binding = ChannelBinding.inflate(inflater, container, false)
+ _binding!!.root.visibility = View.GONE
+ return binding.root
+ }
+
+ fun show(tvViewModel: TVModel) {
+ handler.removeCallbacks(hideRunnable)
+ handler.removeCallbacks(playRunnable)
+ binding.channelContent.text = (tvViewModel.tv.id.plus(1)).toString()
+ view?.visibility = View.VISIBLE
+ handler.postDelayed(hideRunnable, delay)
+ }
+
+ fun show(channel: String) {
+ this.channel = "${binding.channelContent.text}$channel".toInt()
+ handler.removeCallbacks(hideRunnable)
+ handler.removeCallbacks(playRunnable)
+ if (binding.channelContent.text == "") {
+ binding.channelContent.text = channel
+ view?.visibility = View.VISIBLE
+ handler.postDelayed(playRunnable, delay)
+ } else {
+ handler.postDelayed(playRunnable, 0)
+ }
+ }
+
+ override fun onResume() {
+ super.onResume()
+ if (view?.visibility == View.VISIBLE) {
+ handler.postDelayed(hideRunnable, delay)
+ }
+ }
+
+ override fun onPause() {
+ super.onPause()
+ handler.removeCallbacks(hideRunnable)
+ handler.removeCallbacks(playRunnable)
+ }
+
+ private val hideRunnable = Runnable {
+ binding.channelContent.text = ""
+ view?.visibility = View.GONE
+ }
+
+ private val playRunnable = Runnable {
+ (activity as MainActivity).play(channel - 1)
+ binding.channelContent.text = ""
+ view?.visibility = View.GONE
+ }
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
+
+ companion object {
+ private const val TAG = "ChannelFragment"
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/IgnoreSSLCertificate.kt b/app/src/main/java/com/lizongying/mytv0/IgnoreSSLCertificate.kt
new file mode 100644
index 00000000..1522e2e1
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/IgnoreSSLCertificate.kt
@@ -0,0 +1,48 @@
+package com.lizongying.mytv0
+
+import java.security.cert.X509Certificate
+import javax.net.ssl.HostnameVerifier
+import javax.net.ssl.HttpsURLConnection
+import javax.net.ssl.SSLContext
+import javax.net.ssl.TrustManager
+import javax.net.ssl.X509TrustManager
+
+object IgnoreSSLCertificate {
+
+ fun ignore() {
+ try {
+ val trustAllCerts: Array = arrayOf(
+ object : X509TrustManager {
+ override fun getAcceptedIssuers(): Array? {
+ return null
+ }
+
+ override fun checkClientTrusted(
+ certs: Array?,
+ authType: String?
+ ) {
+ }
+
+ override fun checkServerTrusted(
+ certs: Array?,
+ authType: String?
+ ) {
+ }
+ }
+ )
+
+ // Install the all-trusting trust manager
+ val sc = SSLContext.getInstance("SSL")
+ sc.init(null, trustAllCerts, java.security.SecureRandom())
+ HttpsURLConnection.setDefaultSSLSocketFactory(sc.socketFactory)
+
+ // Create all-trusting host name verifier
+ val allHostsValid = HostnameVerifier { _, _ -> true }
+
+ // Install the all-trusting host verifier
+ HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+}
diff --git a/app/src/main/java/com/lizongying/mytv0/InfoFragment.kt b/app/src/main/java/com/lizongying/mytv0/InfoFragment.kt
new file mode 100644
index 00000000..77deb4bc
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/InfoFragment.kt
@@ -0,0 +1,75 @@
+package com.lizongying.mytv0
+
+import android.graphics.Bitmap
+import android.graphics.drawable.Drawable
+import android.os.Bundle
+import android.os.Handler
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.bumptech.glide.Glide
+import com.bumptech.glide.request.target.SimpleTarget
+import com.bumptech.glide.request.transition.Transition
+import com.lizongying.mytv0.databinding.InfoBinding
+import com.lizongying.mytv0.models.TVModel
+
+
+class InfoFragment : Fragment() {
+ private var _binding: InfoBinding? = null
+ private val binding get() = _binding!!
+
+ private val handler = Handler()
+ private val delay: Long = 3000
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ _binding = InfoBinding.inflate(inflater, container, false)
+ _binding!!.root.visibility = View.GONE
+ return binding.root
+ }
+
+ fun show(tvViewModel: TVModel) {
+ binding.textView.text = tvViewModel.tv.title
+
+ when (tvViewModel.tv.title) {
+ else -> Glide.with(this)
+ .load(tvViewModel.tv.logo)
+ .into(binding.infoLogo)
+ }
+
+// val program = tvViewModel.getProgramOne()
+// if (program != null) {
+// binding.infoDesc.text = program.name
+// }
+
+ handler.removeCallbacks(removeRunnable)
+ view?.visibility = View.VISIBLE
+ handler.postDelayed(removeRunnable, delay)
+ }
+
+ override fun onResume() {
+ super.onResume()
+ handler.postDelayed(removeRunnable, delay)
+ }
+
+ override fun onPause() {
+ super.onPause()
+ handler.removeCallbacks(removeRunnable)
+ }
+
+ private val removeRunnable = Runnable {
+ view?.visibility = View.GONE
+ }
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
+
+ companion object {
+ private const val TAG = "InfoFragment"
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/InitializerProvider.kt b/app/src/main/java/com/lizongying/mytv0/InitializerProvider.kt
new file mode 100644
index 00000000..9ec0ff16
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/InitializerProvider.kt
@@ -0,0 +1,41 @@
+package com.lizongying.mytv0
+
+import android.content.ContentProvider
+import android.content.ContentValues
+import android.net.Uri
+import com.lizongying.mytv0.models.TVList
+
+internal class InitializerProvider : ContentProvider() {
+
+ // Happens before Application#onCreate.It's fine to init something here
+ override fun onCreate(): Boolean {
+ SP.init(context!!)
+ TVList.init(context!!)
+ return true
+ }
+
+ override fun query(
+ uri: Uri,
+ projection: Array?,
+ selection: String?,
+ selectionArgs: Array?,
+ sortOrder: String?,
+ ) = unsupported()
+
+ override fun getType(uri: Uri) = unsupported()
+
+ override fun insert(uri: Uri, values: ContentValues?) = unsupported()
+
+ override fun delete(uri: Uri, selection: String?, selectionArgs: Array?) =
+ unsupported()
+
+ override fun update(
+ uri: Uri,
+ values: ContentValues?,
+ selection: String?,
+ selectionArgs: Array?,
+ ) = unsupported()
+
+ private fun unsupported(errorMessage: String? = null): Nothing =
+ throw UnsupportedOperationException(errorMessage)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/ListAdapter.kt b/app/src/main/java/com/lizongying/mytv0/ListAdapter.kt
new file mode 100644
index 00000000..5c704129
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/ListAdapter.kt
@@ -0,0 +1,173 @@
+package com.lizongying.mytv0
+
+import android.content.Context
+import android.view.KeyEvent
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.view.ViewGroup.FOCUS_BEFORE_DESCENDANTS
+import android.view.ViewGroup.FOCUS_BLOCK_DESCENDANTS
+import android.view.animation.ScaleAnimation
+import androidx.core.content.ContextCompat
+import androidx.lifecycle.LifecycleOwner
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.lizongying.mytv0.databinding.ListItemBinding
+import com.lizongying.mytv0.models.TVListModel
+import com.lizongying.mytv0.models.TVModel
+
+
+class ListAdapter(
+ private val context: Context,
+ private val recyclerView: RecyclerView,
+ var tvListModel: TVListModel,
+) :
+ RecyclerView.Adapter() {
+ private var listener: ItemListener? = null
+ private var focused: View? = null
+ private var defaultFocused = false
+ var defaultFocus: Int = -1
+
+ var visiable = false
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+ val inflater = LayoutInflater.from(context)
+ val binding = ListItemBinding.inflate(inflater, parent, false)
+ return ViewHolder(context, binding)
+ }
+
+ fun focusable(able: Boolean) {
+ recyclerView.isFocusable = able
+ recyclerView.isFocusableInTouchMode = able
+ if (able) {
+ recyclerView.descendantFocusability = FOCUS_BEFORE_DESCENDANTS
+ } else {
+ recyclerView.descendantFocusability = FOCUS_BLOCK_DESCENDANTS
+ }
+ }
+
+ fun update(tvListModel: TVListModel) {
+ this.tvListModel = tvListModel
+ recyclerView.post {
+ notifyDataSetChanged()
+ }
+ }
+
+ fun clear() {
+ focused?.clearFocus()
+ recyclerView.invalidate()
+ }
+
+ override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) {
+ val tvModel = tvListModel.getTVModel(position)!!
+ val view = viewHolder.itemView
+
+ view.isFocusable = true
+ view.isFocusableInTouchMode = true
+ view.alpha = 0.8F
+
+ if (!defaultFocused && position == defaultFocus) {
+ view.requestFocus()
+ defaultFocused = true
+ }
+
+ val onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
+ listener?.onItemFocusChange(tvModel, hasFocus)
+
+ if (hasFocus) {
+ viewHolder.focus(true)
+ focused = view
+ if (visiable) {
+ if (position != tvListModel.position.value) {
+ tvListModel.setPosition(position)
+ }
+ } else {
+ visiable = true
+ }
+ } else {
+ viewHolder.focus(false)
+ }
+ }
+
+ view.onFocusChangeListener = onFocusChangeListener
+
+ view.setOnClickListener { _ ->
+ listener?.onItemClicked(tvModel)
+ }
+
+ view.setOnKeyListener { _, keyCode, event: KeyEvent? ->
+ if (event?.action == KeyEvent.ACTION_DOWN) {
+ if (keyCode == KeyEvent.KEYCODE_DPAD_UP && position == 0) {
+ recyclerView.smoothScrollToPosition(getItemCount() - 1)
+ }
+
+ if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN && position == getItemCount() - 1) {
+ recyclerView.smoothScrollToPosition(0)
+ }
+
+ return@setOnKeyListener listener?.onKey(this, keyCode) ?: false
+ }
+ false
+ }
+
+ viewHolder.bindText(tvModel.tv.title)
+
+ viewHolder.bindImage(tvModel.tv.logo)
+ }
+
+ override fun getItemCount() = tvListModel.size()
+
+ class ViewHolder(private val context: Context, private val binding: ListItemBinding) :
+ RecyclerView.ViewHolder(binding.root) {
+ fun bindText(text: String) {
+ binding.textView.text = text
+ }
+
+ fun bindImage(url: String) {
+ Glide.with(context)
+ .load(url)
+ .centerInside()
+ .into(binding.imageView)
+ }
+
+ fun focus(hasFocus: Boolean) {
+ if (hasFocus) {
+ binding.textView.setTextColor(ContextCompat.getColor(context, R.color.white))
+ binding.description.setTextColor(ContextCompat.getColor(context, R.color.white))
+ binding.root.alpha = 1.0F
+ } else {
+ binding.textView.setTextColor(ContextCompat.getColor(context, R.color.title_blur))
+ binding.description.setTextColor(
+ ContextCompat.getColor(
+ context,
+ R.color.description_blur
+ )
+ )
+ binding.root.alpha = 0.8F
+ }
+ }
+ }
+
+ fun toPosition(position: Int) {
+ recyclerView.post {
+ recyclerView.scrollToPosition(position)
+ recyclerView.getChildAt(position)?.isSelected
+ recyclerView.getChildAt(position)?.requestFocus()
+ }
+ }
+
+ interface ItemListener {
+ fun onItemFocusChange(tvModel: TVModel, hasFocus: Boolean)
+ fun onItemClicked(tvModel: TVModel)
+ fun onKey(listAdapter: ListAdapter, keyCode: Int): Boolean
+ }
+
+ fun setItemListener(listener: ItemListener) {
+ this.listener = listener
+ }
+
+ companion object {
+ private const val TAG = "ListAdapter"
+ }
+}
+
diff --git a/app/src/main/java/com/lizongying/mytv0/MainActivity.kt b/app/src/main/java/com/lizongying/mytv0/MainActivity.kt
new file mode 100644
index 00000000..d5b7f6c2
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/MainActivity.kt
@@ -0,0 +1,382 @@
+package com.lizongying.mytv0
+
+import android.content.pm.PackageInfo
+import android.content.pm.PackageManager
+import android.os.Build
+import android.os.Bundle
+import android.os.Handler
+import android.os.Looper
+import android.util.Log
+import android.view.KeyEvent
+import android.view.View
+import android.view.WindowManager
+import android.widget.Toast
+import androidx.fragment.app.FragmentActivity
+import com.lizongying.mytv0.models.TVList
+
+
+class MainActivity : FragmentActivity() {
+
+ private var playerFragment = PlayerFragment()
+ private var infoFragment = InfoFragment()
+ private var channelFragment = ChannelFragment()
+ private var menuFragment = MenuFragment()
+ private lateinit var settingFragment: SettingFragment
+
+ private val handler = Handler(Looper.myLooper()!!)
+ private val delayHideMenu = 10000L
+ private val delayHideSetting = 10000L
+
+ private var position = 0
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_main)
+
+ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+ window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
+ window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+
+ if (savedInstanceState == null) {
+ supportFragmentManager.beginTransaction()
+ .add(R.id.main_browse_fragment, playerFragment)
+ .add(R.id.main_browse_fragment, infoFragment)
+ .add(R.id.main_browse_fragment, channelFragment)
+ .add(R.id.main_browse_fragment, menuFragment)
+ .hide(menuFragment)
+ .commitNow()
+ }
+
+ TVList.listModel.forEach { tvModel ->
+ tvModel.errInfo.observe(this) { _ ->
+ if (tvModel.errInfo.value != null
+ && tvModel.tv.id == TVList.position.value
+ ) {
+ Toast.makeText(this, tvModel.errInfo.value, Toast.LENGTH_LONG)
+ .show()
+ }
+ }
+ tvModel.ready.observe(this) { _ ->
+
+ // not first time && channel is not changed
+ if (tvModel.ready.value != null
+ && tvModel.tv.id == TVList.position.value
+ ) {
+ Log.i(TAG, "info ${tvModel.tv.title}")
+ infoFragment.show(tvModel)
+ if (SP.channelNum) {
+ channelFragment.show(tvModel)
+ }
+ }
+ }
+ }
+
+ TVList.setPosition(SP.position)
+
+ val packageInfo = getPackageInfo()
+ val versionName = packageInfo.versionName
+ val versionCode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ packageInfo.longVersionCode
+ } else {
+ packageInfo.versionCode.toLong()
+ }
+ settingFragment = SettingFragment(versionName, versionCode)
+ }
+
+ fun play(position: Int) {
+ if (position > -1 && position < TVList.size()) {
+ TVList.setPosition(position)
+ } else {
+ Toast.makeText(this, "频道不存在", Toast.LENGTH_LONG).show()
+ }
+ }
+
+ fun prev() {
+ position = TVList.position.value?.dec() ?: 0
+ if (position == -1) {
+ position = TVList.size() - 1
+ }
+ TVList.setPosition(position)
+ }
+
+ fun next() {
+ position = TVList.position.value?.inc() ?: 0
+ if (position == TVList.size()) {
+ position = 0
+ }
+ TVList.setPosition(position)
+ }
+
+ fun menuActive() {
+ handler.removeCallbacks(hideMenu)
+ handler.postDelayed(hideMenu, delayHideMenu)
+ }
+
+ val hideMenu = Runnable {
+ if (!menuFragment.isHidden) {
+ supportFragmentManager.beginTransaction().hide(menuFragment).commit()
+ }
+ }
+
+ fun settingActive() {
+ handler.removeCallbacks(hideSetting)
+ handler.postDelayed(hideSetting, delayHideSetting)
+ }
+
+ private val hideSetting = Runnable {
+ if (!settingFragment.isHidden) {
+ supportFragmentManager.beginTransaction().hide(settingFragment).commit()
+ }
+ }
+
+ private fun getPackageInfo(): PackageInfo {
+ val flag = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
+ PackageManager.GET_SIGNATURES
+ } else {
+ PackageManager.GET_SIGNING_CERTIFICATES
+ }
+
+ return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
+ packageManager.getPackageInfo(packageName, flag)
+ } else {
+ packageManager.getPackageInfo(
+ packageName,
+ PackageManager.PackageInfoFlags.of(PackageManager.GET_SIGNING_CERTIFICATES.toLong())
+ )
+ }
+ }
+
+ private fun showChannel(channel: String) {
+ if (!menuFragment.isHidden) {
+ return
+ }
+
+ if (settingFragment.isVisible) {
+ return
+ }
+
+ if (SP.channelNum) {
+ channelFragment.show(channel)
+ }
+ }
+
+
+ private fun channelUp() {
+ if (menuFragment.isHidden) {
+ if (SP.channelReversal) {
+ next()
+ return
+ }
+ prev()
+ }
+ }
+
+ private fun channelDown() {
+ if (menuFragment.isHidden) {
+ if (SP.channelReversal) {
+ prev()
+ return
+ }
+ next()
+ }
+ }
+
+ private fun back() {
+ if (!menuFragment.isHidden) {
+ hideMenuFragment()
+ return
+ }
+//
+// if (doubleBackToExitPressedOnce) {
+// super.onBackPressed()
+// return
+// }
+//
+// doubleBackToExitPressedOnce = true
+// Toast.makeText(this, "再按一次退出", Toast.LENGTH_SHORT).show()
+//
+// Handler(Looper.getMainLooper()).postDelayed({
+// doubleBackToExitPressedOnce = false
+// }, 2000)
+ }
+
+
+ private fun showSetting() {
+ if (!menuFragment.isHidden) {
+ return
+ }
+
+
+// Log.i(TAG, "settingFragment ${settingFragment.isVisible}")
+// if (!settingFragment.isVisible) {
+// settingFragment.show(supportFragmentManager, "setting")
+// settingActive()
+// } else {
+// handler.removeCallbacks(hideSetting)
+// settingFragment.dismiss()
+// }
+ }
+
+ fun switchMainFragment() {
+ val transaction = supportFragmentManager.beginTransaction()
+
+ if (menuFragment.isHidden) {
+// menuFragment.setPosition()
+ transaction.show(menuFragment)
+ menuActive()
+ } else {
+ transaction.hide(menuFragment)
+ }
+
+ transaction.commit()
+ }
+
+
+ private fun showMenuFragment() {
+ supportFragmentManager.beginTransaction()
+ .show(menuFragment)
+ .commitNow()
+ menuActive()
+ }
+
+ fun hideMenuFragment() {
+ supportFragmentManager.beginTransaction()
+ .hide(menuFragment)
+ .commit()
+ }
+
+ fun onKey(keyCode: Int): Boolean {
+ Log.d(TAG, "keyCode $keyCode")
+ when (keyCode) {
+ KeyEvent.KEYCODE_0 -> {
+ showChannel("0")
+ return true
+ }
+
+ KeyEvent.KEYCODE_1 -> {
+ showChannel("1")
+ return true
+ }
+
+ KeyEvent.KEYCODE_2 -> {
+ showChannel("2")
+ return true
+ }
+
+ KeyEvent.KEYCODE_3 -> {
+ showChannel("3")
+ return true
+ }
+
+ KeyEvent.KEYCODE_4 -> {
+ showChannel("4")
+ return true
+ }
+
+ KeyEvent.KEYCODE_5 -> {
+ showChannel("5")
+ return true
+ }
+
+ KeyEvent.KEYCODE_6 -> {
+ showChannel("6")
+ return true
+ }
+
+ KeyEvent.KEYCODE_7 -> {
+ showChannel("7")
+ return true
+ }
+
+ KeyEvent.KEYCODE_8 -> {
+ showChannel("8")
+ return true
+ }
+
+ KeyEvent.KEYCODE_9 -> {
+ showChannel("9")
+ return true
+ }
+
+ KeyEvent.KEYCODE_ESCAPE -> {
+ back()
+ return true
+ }
+
+ KeyEvent.KEYCODE_BACK -> {
+ back()
+ return true
+ }
+
+ KeyEvent.KEYCODE_BOOKMARK -> {
+ showSetting()
+ return true
+ }
+
+ KeyEvent.KEYCODE_UNKNOWN -> {
+ showSetting()
+ return true
+ }
+
+ KeyEvent.KEYCODE_HELP -> {
+ showSetting()
+ return true
+ }
+
+ KeyEvent.KEYCODE_SETTINGS -> {
+ showSetting()
+ return true
+ }
+
+ KeyEvent.KEYCODE_MENU -> {
+ showSetting()
+ return true
+ }
+
+ KeyEvent.KEYCODE_ENTER -> {
+ switchMainFragment()
+ }
+
+ KeyEvent.KEYCODE_DPAD_CENTER -> {
+ switchMainFragment()
+ }
+
+ KeyEvent.KEYCODE_DPAD_UP -> {
+ channelUp()
+ }
+
+ KeyEvent.KEYCODE_CHANNEL_UP -> {
+ channelUp()
+ }
+
+ KeyEvent.KEYCODE_DPAD_DOWN -> {
+ channelDown()
+ }
+
+ KeyEvent.KEYCODE_CHANNEL_DOWN -> {
+ channelDown()
+ }
+
+ KeyEvent.KEYCODE_DPAD_LEFT -> {
+ showMenuFragment()
+ }
+
+ KeyEvent.KEYCODE_DPAD_RIGHT -> {
+ channelDown()
+ }
+ }
+ return false
+ }
+
+ override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
+ if (onKey(keyCode)) {
+ return true
+ }
+
+ return super.onKeyDown(keyCode, event)
+ }
+
+ companion object {
+ private const val TAG = "MainActivity"
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/MenuFragment.kt b/app/src/main/java/com/lizongying/mytv0/MenuFragment.kt
new file mode 100644
index 00000000..37b85aa0
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/MenuFragment.kt
@@ -0,0 +1,160 @@
+package com.lizongying.mytv0
+
+import android.os.Bundle
+import android.util.Log
+import android.view.KeyEvent
+import android.view.LayoutInflater
+import android.view.View
+import android.view.View.GONE
+import android.view.View.VISIBLE
+import android.view.ViewGroup
+import android.widget.Toast
+import androidx.core.view.isVisible
+import androidx.fragment.app.Fragment
+import androidx.recyclerview.widget.LinearLayoutManager
+import com.lizongying.mytv0.databinding.MenuBinding
+import com.lizongying.mytv0.models.TVList
+import com.lizongying.mytv0.models.TVListModel
+import com.lizongying.mytv0.models.TVModel
+
+class MenuFragment : Fragment(), CategoryAdapter.ItemListener, ListAdapter.ItemListener {
+ private var _binding: MenuBinding? = null
+ private val binding get() = _binding!!
+
+ private lateinit var categoryAdapter: CategoryAdapter
+ private lateinit var listAdapter: ListAdapter
+
+ override fun onActivityCreated(savedInstanceState: Bundle?) {
+ Log.i(TAG, "onCreate")
+ super.onActivityCreated(savedInstanceState)
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ _binding = MenuBinding.inflate(inflater, container, false)
+
+ categoryAdapter = CategoryAdapter(
+ context!!,
+ binding.category,
+ TVList.categoryModel,
+ )
+ binding.category.adapter = categoryAdapter
+ binding.category.layoutManager =
+ LinearLayoutManager(context)
+ categoryAdapter.setItemListener(this)
+
+ listAdapter = ListAdapter(
+ context!!,
+ binding.list,
+ TVList.categoryModel.getTVListModel(TVList.categoryModel.position.value!!)!!,
+ )
+ binding.list.adapter = listAdapter
+ binding.list.layoutManager =
+ LinearLayoutManager(context)
+ listAdapter.focusable(false)
+ listAdapter.setItemListener(this)
+ return binding.root
+ }
+
+ override fun onItemFocusChange(tvListModel: TVListModel, hasFocus: Boolean) {
+ if (hasFocus) {
+ (binding.list.adapter as ListAdapter).update(tvListModel)
+ (activity as MainActivity).menuActive()
+ }
+ }
+
+ override fun onItemClicked(tvListModel: TVListModel) {
+ }
+
+ override fun onItemFocusChange(tvModel: TVModel, hasFocus: Boolean) {
+ if (hasFocus) {
+ (activity as MainActivity).menuActive()
+ }
+ }
+
+ override fun onItemClicked(tvModel: TVModel) {
+ TVList.setPosition(tvModel.tv.id)
+ (activity as MainActivity).hideMenuFragment()
+ }
+
+ override fun onKey(keyCode: Int): Boolean {
+ when (keyCode) {
+ KeyEvent.KEYCODE_DPAD_RIGHT -> {
+ if (listAdapter.itemCount == 0) {
+ Toast.makeText(context, "暂无频道", Toast.LENGTH_LONG).show()
+ return true
+ }
+ binding.category.visibility = GONE
+ categoryAdapter.focusable(false)
+ listAdapter.focusable(true)
+ listAdapter.toPosition(listAdapter.tvListModel.position.value!!)
+ return true
+ }
+
+ KeyEvent.KEYCODE_DPAD_LEFT -> {
+ (activity as MainActivity).hideMenuFragment()
+ return true
+ }
+ }
+ return false
+ }
+
+ override fun onKey(listAdapter: ListAdapter, keyCode: Int): Boolean {
+ when (keyCode) {
+ KeyEvent.KEYCODE_DPAD_LEFT -> {
+ binding.category.visibility = VISIBLE
+ categoryAdapter.focusable(true)
+ listAdapter.focusable(false)
+ listAdapter.clear()
+ Log.i(TAG, "category toPosition on left")
+ categoryAdapter.toPosition(TVList.categoryModel.position.value!!)
+ return true
+ }
+ }
+ return false
+ }
+
+ override fun onHiddenChanged(hidden: Boolean) {
+ super.onHiddenChanged(hidden)
+ if (!hidden) {
+ if (binding.list.isVisible) {
+// if (binding.category.isVisible) {
+// categoryAdapter.focusable(true)
+// listAdapter.focusable(false)
+// } else {
+// categoryAdapter.focusable(false)
+// listAdapter.focusable(true)
+// }
+ Log.i(TAG, "list on show toPosition ${listAdapter.tvListModel.position.value!!}")
+ listAdapter.toPosition(listAdapter.tvListModel.position.value!!)
+ }
+ if (binding.category.isVisible) {
+// categoryAdapter.focusable(true)
+// listAdapter.focusable(false)
+ Log.i(TAG, "category on show toPosition ${TVList.categoryModel.position.value!!}")
+ categoryAdapter.toPosition(TVList.categoryModel.position.value!!)
+ }
+ } else {
+ view?.post {
+ categoryAdapter.visiable = false
+ listAdapter.visiable = false
+ }
+ }
+ }
+
+ override fun onResume() {
+ super.onResume()
+// categoryAdapter.toPosition(TVList.categoryModel.position.value!!)
+ }
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
+
+ companion object {
+ private const val TAG = "MenuFragment"
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/PlayerFragment.kt b/app/src/main/java/com/lizongying/mytv0/PlayerFragment.kt
new file mode 100644
index 00000000..e98d9c85
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/PlayerFragment.kt
@@ -0,0 +1,311 @@
+package com.lizongying.mytv0
+
+import android.os.Bundle
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.SurfaceHolder
+import android.view.SurfaceView
+import android.view.View
+import android.view.ViewGroup
+import android.view.ViewTreeObserver
+import androidx.annotation.OptIn
+import androidx.fragment.app.Fragment
+import androidx.media3.common.MediaItem
+import androidx.media3.common.MimeTypes
+import androidx.media3.common.PlaybackException
+import androidx.media3.common.Player
+import androidx.media3.common.VideoSize
+import androidx.media3.common.util.UnstableApi
+import androidx.media3.datasource.DataSource
+import androidx.media3.datasource.DataSpec
+import androidx.media3.datasource.DefaultHttpDataSource
+import androidx.media3.datasource.TransferListener
+import androidx.media3.exoplayer.DefaultRenderersFactory
+import androidx.media3.exoplayer.ExoPlayer
+import androidx.media3.exoplayer.hls.HlsMediaSource
+import androidx.media3.exoplayer.mediacodec.MediaCodecSelector
+import androidx.media3.exoplayer.mediacodec.MediaCodecUtil
+import com.google.android.exoplayer2.SimpleExoPlayer
+import com.lizongying.mytv0.databinding.PlayerBinding
+import com.lizongying.mytv0.models.TVList
+import com.lizongying.mytv0.models.TVModel
+
+
+class PlayerFragment : Fragment(), SurfaceHolder.Callback {
+ private var _binding: PlayerBinding? = null
+
+ private var player: ExoPlayer? = null
+ private var exoPlayer: SimpleExoPlayer? = null
+
+ private var videoUrl = ""
+ private var tvModel: TVModel? = null
+ private val aspectRatio = 16f / 9f
+
+ private lateinit var surfaceView: SurfaceView
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ _binding = PlayerBinding.inflate(inflater, container, false)
+ val playerView = _binding!!.playerView
+ surfaceView = _binding!!.surfaceView
+
+ if (Utils.isTmallDevice()) {
+ playerView.visibility = View.GONE
+ surfaceView.holder.addCallback(this)
+ } else {
+ surfaceView.visibility = View.GONE
+ playerView.viewTreeObserver?.addOnGlobalLayoutListener(object :
+ ViewTreeObserver.OnGlobalLayoutListener {
+ @OptIn(UnstableApi::class)
+ override fun onGlobalLayout() {
+ playerView.viewTreeObserver.removeOnGlobalLayoutListener(this)
+
+ val renderersFactory = context?.let { DefaultRenderersFactory(it) }
+ val playerMediaCodecSelector = PlayerMediaCodecSelector()
+ renderersFactory?.setMediaCodecSelector(playerMediaCodecSelector)
+
+ player = context?.let {
+ ExoPlayer.Builder(it)
+ .setRenderersFactory(renderersFactory!!)
+ .build()
+ }
+ playerView.player = player
+ player?.playWhenReady = true
+ player?.addListener(object : Player.Listener {
+ override fun onVideoSizeChanged(videoSize: VideoSize) {
+ val ratio = playerView.measuredWidth.div(playerView.measuredHeight)
+ val layoutParams = playerView.layoutParams
+ if (ratio < aspectRatio) {
+ layoutParams?.height =
+ (playerView.measuredWidth.div(aspectRatio)).toInt()
+ playerView.layoutParams = layoutParams
+ } else if (ratio > aspectRatio) {
+ layoutParams?.width =
+ (playerView.measuredHeight.times(aspectRatio)).toInt()
+ playerView.layoutParams = layoutParams
+ }
+ }
+
+ override fun onPlayerError(error: PlaybackException) {
+ super.onPlayerError(error)
+ tvModel?.setReady()
+ }
+ })
+ Log.i(TAG, "player ready")
+ ready()
+ }
+ })
+ }
+
+ return _binding!!.root
+ }
+
+ fun ready() {
+ TVList.listModel.forEach { tvModel ->
+ tvModel.ready.observe(this) { _ ->
+
+ // not first time
+ if (tvModel.ready.value != null
+ && tvModel.tv.id == TVList.position.value
+ && tvModel.videoUrl.value != null
+// && tvModel.videoUrl.value != videoUrl
+ ) {
+ play(tvModel)
+ }
+ }
+ }
+ }
+
+ @OptIn(UnstableApi::class)
+ fun play(tvModel: TVModel) {
+ videoUrl = tvModel.videoUrl.value ?: return
+ this.tvModel = tvModel
+ Log.i(TAG, "play ${tvModel.tv.title} $videoUrl")
+ player?.run {
+ IgnoreSSLCertificate.ignore()
+ val httpDataSource = DefaultHttpDataSource.Factory()
+ httpDataSource.setTransferListener(object : TransferListener {
+ override fun onTransferInitializing(
+ source: DataSource,
+ dataSpec: DataSpec,
+ isNetwork: Boolean
+ ) {
+// TODO("Not yet implemented")
+ }
+
+ override fun onTransferStart(
+ source: DataSource,
+ dataSpec: DataSpec,
+ isNetwork: Boolean
+ ) {
+ Log.d(TAG, "onTransferStart uri ${source.uri}")
+// TODO("Not yet implemented")
+ }
+
+ override fun onBytesTransferred(
+ source: DataSource,
+ dataSpec: DataSpec,
+ isNetwork: Boolean,
+ bytesTransferred: Int
+ ) {
+// TODO("Not yet implemented")
+ }
+
+ override fun onTransferEnd(
+ source: DataSource,
+ dataSpec: DataSpec,
+ isNetwork: Boolean
+ ) {
+// TODO("Not yet implemented")
+ }
+ })
+
+ val hlsMediaSource = HlsMediaSource.Factory(httpDataSource).createMediaSource(
+ MediaItem.fromUri(videoUrl)
+ )
+
+ setMediaSource(hlsMediaSource)
+
+// setMediaItem(MediaItem.fromUri(videoUrl))
+ prepare()
+ }
+ exoPlayer?.run {
+ setMediaItem(com.google.android.exoplayer2.MediaItem.fromUri(videoUrl))
+ prepare()
+ }
+ }
+
+ @OptIn(UnstableApi::class)
+ class PlayerMediaCodecSelector : MediaCodecSelector {
+ override fun getDecoderInfos(
+ mimeType: String,
+ requiresSecureDecoder: Boolean,
+ requiresTunnelingDecoder: Boolean
+ ): MutableList {
+ val infos = MediaCodecUtil.getDecoderInfos(
+ mimeType,
+ requiresSecureDecoder,
+ requiresTunnelingDecoder
+ )
+ if (mimeType == MimeTypes.VIDEO_H265 && !requiresSecureDecoder && !requiresTunnelingDecoder) {
+ if (infos.size > 0) {
+ val infosNew = infos.find { it.name == "c2.android.hevc.decoder" }
+ ?.let { mutableListOf(it) }
+ if (infosNew != null) {
+ return infosNew
+ }
+ }
+ }
+ return infos
+ }
+ }
+
+ class ExoplayerMediaCodecSelector :
+ com.google.android.exoplayer2.mediacodec.MediaCodecSelector {
+ override fun getDecoderInfos(
+ mimeType: String,
+ requiresSecureDecoder: Boolean,
+ requiresTunnelingDecoder: Boolean
+ ): MutableList {
+ val infos = com.google.android.exoplayer2.mediacodec.MediaCodecUtil.getDecoderInfos(
+ mimeType,
+ requiresSecureDecoder,
+ requiresTunnelingDecoder
+ )
+ if (mimeType == MimeTypes.VIDEO_H265 && !requiresSecureDecoder && !requiresTunnelingDecoder) {
+ if (infos.size > 0) {
+ val infosNew = infos.find { it.name == "c2.android.hevc.decoder" }
+ ?.let { mutableListOf(it) }
+ if (infosNew != null) {
+ return infosNew
+ }
+ }
+ }
+ return infos
+ }
+ }
+
+ override fun surfaceCreated(holder: SurfaceHolder) {
+ val renderersFactory =
+ context?.let { com.google.android.exoplayer2.DefaultRenderersFactory(it) }
+ val exoplayerMediaCodecSelector = ExoplayerMediaCodecSelector()
+ renderersFactory?.setMediaCodecSelector(exoplayerMediaCodecSelector)
+
+ exoPlayer = SimpleExoPlayer.Builder(requireContext(), renderersFactory!!).build()
+ exoPlayer?.setVideoSurfaceHolder(holder)
+ exoPlayer?.playWhenReady = true
+ exoPlayer?.addListener(object : com.google.android.exoplayer2.Player.EventListener {
+ override fun onPlayerError(error: com.google.android.exoplayer2.ExoPlaybackException) {
+ super.onPlayerError(error)
+ tvModel?.setReady()
+ }
+ })
+ exoPlayer?.addVideoListener(object : com.google.android.exoplayer2.video.VideoListener {
+ override fun onVideoSizeChanged(
+ width: Int, height: Int, unappliedRotationDegrees: Int, pixelWidthHeightRatio: Float
+ ) {
+ val ratio = surfaceView.measuredWidth.div(surfaceView.measuredHeight)
+ val layoutParams = surfaceView.layoutParams
+ if (ratio < aspectRatio) {
+ layoutParams?.height =
+ (surfaceView.measuredWidth.div(aspectRatio)).toInt()
+ surfaceView.layoutParams = layoutParams
+ } else if (ratio > aspectRatio) {
+ layoutParams?.width =
+ (surfaceView.measuredHeight.times(aspectRatio)).toInt()
+ surfaceView.layoutParams = layoutParams
+ }
+ }
+ })
+ Log.i(TAG, "exoPlayer ready")
+ ready()
+ }
+
+ override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
+ }
+
+ override fun surfaceDestroyed(holder: SurfaceHolder) {
+ }
+
+ override fun onStart() {
+ Log.i(TAG, "onStart")
+ super.onStart()
+ if (player?.isPlaying == false) {
+ Log.i(TAG, "replay")
+ player?.prepare()
+ player?.play()
+ }
+ if (exoPlayer?.isPlaying == false) {
+ Log.i(TAG, "replay")
+ exoPlayer?.prepare()
+ exoPlayer?.play()
+ }
+ }
+
+ override fun onPause() {
+ super.onPause()
+ if (player?.isPlaying == true) {
+ player?.stop()
+ }
+ if (exoPlayer?.isPlaying == true) {
+ exoPlayer?.stop()
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ player?.release()
+ exoPlayer?.release()
+ }
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
+
+ companion object {
+ private const val TAG = "PlayerFragment"
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/SP.kt b/app/src/main/java/com/lizongying/mytv0/SP.kt
new file mode 100644
index 00000000..856e2c5e
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/SP.kt
@@ -0,0 +1,59 @@
+package com.lizongying.mytv0
+
+
+import android.content.Context
+import android.content.SharedPreferences
+
+object SP {
+ // If Change channel with up and down in reversed order or not
+ private const val KEY_CHANNEL_REVERSAL = "channel_reversal"
+
+ // If use channel num to select channel or not
+ private const val KEY_CHANNEL_NUM = "channel_num"
+
+ // If start app on device boot or not
+ private const val KEY_BOOT_STARTUP = "boot_startup"
+
+ // Position in list of the selected channel item
+ private const val KEY_POSITION = "position"
+
+ private const val KEY_POSITION_CATEGORY = "position_category"
+
+ private const val KEY_POSITION_SUB = "position_sub"
+
+ private lateinit var sp: SharedPreferences
+
+ /**
+ * The method must be invoked as early as possible(At least before using the keys)
+ */
+ fun init(context: Context) {
+ sp = context.getSharedPreferences(
+ context.resources.getString(R.string.app_name),
+ Context.MODE_PRIVATE
+ )
+ }
+
+ var channelReversal: Boolean
+ get() = sp.getBoolean(KEY_CHANNEL_REVERSAL, false)
+ set(value) = sp.edit().putBoolean(KEY_CHANNEL_REVERSAL, value).apply()
+
+ var channelNum: Boolean
+ get() = sp.getBoolean(KEY_CHANNEL_NUM, true)
+ set(value) = sp.edit().putBoolean(KEY_CHANNEL_NUM, value).apply()
+
+ var bootStartup: Boolean
+ get() = sp.getBoolean(KEY_BOOT_STARTUP, false)
+ set(value) = sp.edit().putBoolean(KEY_BOOT_STARTUP, value).apply()
+
+ var position: Int
+ get() = sp.getInt(KEY_POSITION, 0)
+ set(value) = sp.edit().putInt(KEY_POSITION, value).apply()
+
+ var positionCategory: Int
+ get() = sp.getInt(KEY_POSITION_CATEGORY, 0)
+ set(value) = sp.edit().putInt(KEY_POSITION_CATEGORY, value).apply()
+
+ var positionSub: Int
+ get() = sp.getInt(KEY_POSITION_SUB, 0)
+ set(value) = sp.edit().putInt(KEY_POSITION_SUB, value).apply()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/SettingFragment.kt b/app/src/main/java/com/lizongying/mytv0/SettingFragment.kt
new file mode 100644
index 00000000..d0626b4b
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/SettingFragment.kt
@@ -0,0 +1,76 @@
+package com.lizongying.mytv0
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lizongying.mytv0.databinding.SettingBinding
+
+
+class SettingFragment(
+ private val versionName: String,
+ private val versionCode: Long,
+) :
+ Fragment() {
+
+ private var _binding: SettingBinding? = null
+ private val binding get() = _binding!!
+
+// private lateinit var updateManager: UpdateManager
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ _binding = SettingBinding.inflate(inflater, container, false)
+
+ _binding?.version?.text =
+ "当前版本: $versionName\n获取最新: https://github.com/lizongying/my-tv/releases/"
+
+ val switchChannelReversal = _binding?.switchChannelReversal
+ switchChannelReversal?.isChecked = SP.channelReversal
+ switchChannelReversal?.setOnCheckedChangeListener { _, isChecked ->
+ SP.channelReversal = isChecked
+ (activity as MainActivity).settingActive()
+ }
+
+ val switchChannelNum = _binding?.switchChannelNum
+ switchChannelNum?.isChecked = SP.channelNum
+ switchChannelNum?.setOnCheckedChangeListener { _, isChecked ->
+ SP.channelNum = isChecked
+ (activity as MainActivity).settingActive()
+ }
+
+ val switchBootStartup = _binding?.switchBootStartup
+ switchBootStartup?.isChecked = SP.bootStartup
+ switchBootStartup?.setOnCheckedChangeListener { _, isChecked ->
+ SP.bootStartup = isChecked
+ (activity as MainActivity).settingActive()
+ }
+
+// _binding?.checkVersion?.setOnClickListener(OnClickListenerCheckVersion(updateManager))
+
+ return binding.root
+ }
+
+ fun setVersionName(versionName: String) {
+ binding.versionName.text = versionName
+ }
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+// updateManager.destroy()
+ }
+
+ companion object {
+ const val TAG = "SettingFragment"
+ }
+}
+
diff --git a/app/src/main/java/com/lizongying/mytv0/Utils.kt b/app/src/main/java/com/lizongying/mytv0/Utils.kt
new file mode 100644
index 00000000..5d082073
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/Utils.kt
@@ -0,0 +1,79 @@
+package com.lizongying.mytv0
+
+import android.content.Context
+import android.content.res.Resources
+import android.os.Build
+import android.util.TypedValue
+import com.google.gson.Gson
+import com.lizongying.mytv0.requests.TimeResponse
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
+import java.io.File
+import java.io.IOException
+import java.text.SimpleDateFormat
+import java.util.Date
+import java.util.Locale
+
+object Utils {
+ private var between: Long = 0
+
+ fun getDateFormat(format: String): String {
+ return SimpleDateFormat(
+ format,
+ Locale.CHINA
+ ).format(Date(System.currentTimeMillis() - between))
+ }
+
+ fun getDateTimestamp(): Long {
+ return (System.currentTimeMillis() - between) / 1000
+ }
+
+ suspend fun init() {
+ var currentTimeMillis: Long = 0
+ try {
+ currentTimeMillis = getTimestampFromServer()
+ } catch (e: Exception) {
+ println("Failed to retrieve timestamp from server: ${e.message}")
+ }
+ between = System.currentTimeMillis() - currentTimeMillis
+ }
+
+ /**
+ * 从服务器获取时间戳
+ * @return Long 时间戳
+ */
+ private suspend fun getTimestampFromServer(): Long {
+ return withContext(Dispatchers.IO) {
+ val client = okhttp3.OkHttpClient.Builder()
+ .connectTimeout(500, java.util.concurrent.TimeUnit.MILLISECONDS)
+ .readTimeout(1, java.util.concurrent.TimeUnit.SECONDS).build()
+ val request = okhttp3.Request.Builder()
+ .url("https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp")
+ .build()
+ try {
+ client.newCall(request).execute().use { response ->
+ if (!response.isSuccessful) throw IOException("Unexpected code $response")
+ val string = response.body()?.string()
+ Gson().fromJson(string, TimeResponse::class.java).data.t.toLong()
+ }
+ } catch (e: IOException) {
+ // Handle network errors
+ throw IOException("Error during network request", e)
+ }
+ }
+ }
+
+ fun dpToPx(dp: Float): Int {
+ return TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, dp, Resources.getSystem().displayMetrics
+ ).toInt()
+ }
+
+ fun dpToPx(dp: Int): Int {
+ return TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, dp.toFloat(), Resources.getSystem().displayMetrics
+ ).toInt()
+ }
+
+ fun isTmallDevice() = Build.MANUFACTURER.equals("Tmall", ignoreCase = true)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/models/Program.kt b/app/src/main/java/com/lizongying/mytv0/models/Program.kt
new file mode 100644
index 00000000..cc55705e
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/models/Program.kt
@@ -0,0 +1,22 @@
+package com.lizongying.mytv0.models
+
+import java.io.Serializable
+
+data class Program(
+ var id: Int = 0,
+ var title: String = "",
+ var description: String? = null,
+ var logo: String = "",
+ var image: String? = null,
+) : Serializable {
+
+ override fun toString(): String {
+ return "Program{" +
+ "id=" + id +
+ ", title='" + title + '\'' +
+ ", description='" + description + '\'' +
+ ", logo='" + logo + '\'' +
+ ", image='" + image + '\'' +
+ '}'
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/models/TV.kt b/app/src/main/java/com/lizongying/mytv0/models/TV.kt
new file mode 100644
index 00000000..ed831c9c
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/models/TV.kt
@@ -0,0 +1,30 @@
+package com.lizongying.mytv0.models
+
+import java.io.Serializable
+
+data class TV(
+ var id: Int = 0,
+ var programId: String = "",
+ var title: String = "",
+ var description: String? = null,
+ var logo: String = "",
+ var image: String? = null,
+ var videoUrl: List,
+ var headers: Map? = null,
+ var category: String = "",
+ var child: List,
+) : Serializable {
+
+ override fun toString(): String {
+ return "TV{" +
+ "id=" + id +
+ ", programId='" + programId + '\'' +
+ ", title='" + title + '\'' +
+ ", description='" + description + '\'' +
+ ", logo='" + logo + '\'' +
+ ", image='" + image + '\'' +
+ ", videoUrl='" + videoUrl + '\'' +
+ ", category='" + category + '\'' +
+ '}'
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/models/TVCategoryModel.kt b/app/src/main/java/com/lizongying/mytv0/models/TVCategoryModel.kt
new file mode 100644
index 00000000..c61010b4
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/models/TVCategoryModel.kt
@@ -0,0 +1,45 @@
+package com.lizongying.mytv0.models
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.lizongying.mytv0.SP
+
+class TVCategoryModel : ViewModel() {
+ private val _tvCategoryModel = MutableLiveData>()
+ val tvCategoryModel: LiveData>
+ get() = _tvCategoryModel
+
+ private val _position = MutableLiveData()
+ val position: LiveData
+ get() = _position
+
+ fun setPosition(position: Int) {
+ _position.value = position
+ }
+
+ fun addTVListModel(tvListModel: TVListModel) {
+ if (_tvCategoryModel.value == null) {
+ _tvCategoryModel.value = mutableListOf(tvListModel)
+ return
+ }
+ _tvCategoryModel.value?.add(tvListModel)
+ }
+
+ fun getTVListModel(idx: Int): TVListModel? {
+ return _tvCategoryModel.value?.get(idx)
+ }
+
+ init {
+ _position.value = SP.positionCategory
+ _position.value = 2
+ }
+
+ fun size(): Int {
+ if (_tvCategoryModel.value == null) {
+ return 0
+ }
+
+ return _tvCategoryModel.value!!.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/models/TVList.kt b/app/src/main/java/com/lizongying/mytv0/models/TVList.kt
new file mode 100644
index 00000000..7efaa580
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/models/TVList.kt
@@ -0,0 +1,109 @@
+package com.lizongying.mytv0.models
+
+import android.content.Context
+import android.util.Log
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import com.lizongying.mytv0.R
+import java.io.File
+
+object TVList {
+ private const val FILE_NAME = "channels.json"
+ private lateinit var appDirectory: File
+ private lateinit var serverUrl: String
+ private lateinit var list: List
+ lateinit var listModel: List
+ lateinit var categoryModel: TVCategoryModel
+
+ private val _position = MutableLiveData()
+ val position: LiveData
+ get() = _position
+
+ fun init(context: Context) {
+ _position.value = 0
+ appDirectory = context.filesDir
+ serverUrl = context.resources.getString(R.string.server_url)
+ val file = File(appDirectory, FILE_NAME)
+ val str = if (file.exists()) {
+ file.readText()
+ } else {
+ context.resources.openRawResource(R.raw.channels).bufferedReader()
+ .use { it.readText() }
+ }
+ str2List(str)
+ }
+
+ fun update() {
+ val client = okhttp3.OkHttpClient()
+ val request = okhttp3.Request.Builder().url(serverUrl).build()
+ client.newCall(request).execute().use { response ->
+ if (response.isSuccessful) {
+ val file = File(appDirectory, FILE_NAME)
+ if (!file.exists()) {
+ file.createNewFile()
+ }
+ val str = response.body()!!.string()
+ file.writeText(str)
+ str2List(str)
+ }
+ }
+ }
+
+ private fun str2List(str: String) {
+ val type = object : com.google.gson.reflect.TypeToken>() {}.type
+ list = com.google.gson.Gson().fromJson(str, type)
+ Log.i("TVList", "$list")
+
+ listModel = list.map { tv ->
+ TVModel(tv)
+ }
+
+ val category: MutableList = mutableListOf()
+
+ var tvListModel = TVListModel("我的收藏")
+ category.add(tvListModel)
+
+ tvListModel = TVListModel("全部频道")
+ tvListModel.setTVListModel(listModel)
+ category.add(tvListModel)
+
+ val map: MutableMap> = mutableMapOf()
+ for ((id, v) in list.withIndex()) {
+ if (v.category !in map) {
+ map[v.category] = mutableListOf()
+ }
+ v.id = id
+ map[v.category]?.add(TVModel(v))
+ }
+
+ for ((k, v) in map) {
+ tvListModel = TVListModel(k)
+ for (v1 in v) {
+ tvListModel.addTVModel(v1)
+ }
+ category.add(tvListModel)
+ }
+
+ categoryModel = TVCategoryModel()
+ for (v in category) {
+ categoryModel.addTVListModel(v)
+ }
+ }
+
+ fun getTVModel(idx: Int): TVModel {
+ return listModel[idx]
+ }
+
+ fun setPosition(position: Int) {
+ if (_position.value != position) {
+ _position.value = position
+ }
+
+ // set a new position or retry when position same
+ listModel[position].setReady()
+ }
+
+ fun size(): Int {
+ return listModel.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/models/TVListModel.kt b/app/src/main/java/com/lizongying/mytv0/models/TVListModel.kt
new file mode 100644
index 00000000..2cccac4c
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/models/TVListModel.kt
@@ -0,0 +1,59 @@
+package com.lizongying.mytv0.models
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+
+class TVListModel(private val name: String) : ViewModel() {
+ fun getName(): String {
+ return name
+ }
+
+ private val _tvListModel = MutableLiveData>()
+ val tvListModel: LiveData>
+ get() = _tvListModel
+
+ private val _position = MutableLiveData()
+ val position: LiveData
+ get() = _position
+
+ fun setPosition(position: Int) {
+ _position.value = position
+ }
+
+ private val _change = MutableLiveData()
+ val change: LiveData
+ get() = _change
+
+ fun setChange() {
+ _change.value = true
+ }
+
+ fun setTVListModel(tvListModel: List) {
+ _tvListModel.value = tvListModel.toMutableList()
+ }
+
+ fun addTVModel(tvModel: TVModel) {
+ if (_tvListModel.value == null) {
+ _tvListModel.value = mutableListOf(tvModel)
+ return
+ }
+ _tvListModel.value?.add(tvModel)
+ }
+
+ fun getTVModel(idx: Int): TVModel? {
+ return _tvListModel.value?.get(idx)
+ }
+
+ init {
+ _position.value = 0
+ }
+
+ fun size(): Int {
+ if (_tvListModel.value == null) {
+ return 0
+ }
+
+ return _tvListModel.value!!.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/models/TVModel.kt b/app/src/main/java/com/lizongying/mytv0/models/TVModel.kt
new file mode 100644
index 00000000..d777d86c
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/models/TVModel.kt
@@ -0,0 +1,82 @@
+package com.lizongying.mytv0.models
+
+import android.net.Uri
+import androidx.annotation.OptIn
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import androidx.media3.common.MediaItem
+import androidx.media3.common.util.UnstableApi
+import androidx.media3.datasource.DefaultHttpDataSource
+import androidx.media3.exoplayer.hls.HlsMediaSource
+
+class TVModel(var tv: TV) : ViewModel() {
+ private val _position = MutableLiveData()
+ val position: LiveData
+ get() = _position
+
+ var retryTimes = 0
+ var retryMaxTimes = 8
+ var programUpdateTime = 0L
+
+ private val _errInfo = MutableLiveData()
+ val errInfo: LiveData
+ get() = _errInfo
+
+ fun setErrInfo(info: String) {
+ _errInfo.value = info
+ }
+
+ private var _program = MutableLiveData>()
+ val program: LiveData>
+ get() = _program
+
+ private val _videoUrl = MutableLiveData()
+ val videoUrl: LiveData
+ get() = _videoUrl
+
+ fun setVideoUrl(url: String) {
+ _videoUrl.value = url
+ }
+
+ fun getVideoUrl(): String? {
+ return _videoIndex.value?.let { tv.videoUrl[it] }
+ }
+
+ private val _ready = MutableLiveData()
+ val ready: LiveData
+ get() = _ready
+
+ fun setReady() {
+ _ready.value = true
+ }
+
+ private val _videoIndex = MutableLiveData()
+ val videoIndex: LiveData
+ get() = _videoIndex
+
+ init {
+ _position.value = 0
+ _videoIndex.value = 0
+ _videoUrl.value = getVideoUrl()
+ _program.value = mutableListOf()
+ }
+
+ fun update(t: TV) {
+ tv = t
+ }
+
+ @OptIn(UnstableApi::class)
+ fun buildSource(): HlsMediaSource {
+ val httpDataSource = DefaultHttpDataSource.Factory()
+ tv.headers?.let { httpDataSource.setDefaultRequestProperties(it) }
+
+ return HlsMediaSource.Factory(httpDataSource).createMediaSource(
+ MediaItem.fromUri(_videoUrl.value!!)
+ )
+ }
+
+ companion object {
+ private const val TAG = "TVModel"
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lizongying/mytv0/requests/TimeResponse.kt b/app/src/main/java/com/lizongying/mytv0/requests/TimeResponse.kt
new file mode 100644
index 00000000..7a66b57d
--- /dev/null
+++ b/app/src/main/java/com/lizongying/mytv0/requests/TimeResponse.kt
@@ -0,0 +1,10 @@
+package com.lizongying.mytv0.requests
+
+
+data class TimeResponse(
+ val data: Time
+) {
+ data class Time(
+ val t: String
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/appreciate.jpg b/app/src/main/res/drawable/appreciate.jpg
new file mode 100644
index 00000000..751634ac
Binary files /dev/null and b/app/src/main/res/drawable/appreciate.jpg differ
diff --git a/app/src/main/res/drawable/banner0.png b/app/src/main/res/drawable/banner0.png
new file mode 100644
index 00000000..fcc47d2c
Binary files /dev/null and b/app/src/main/res/drawable/banner0.png differ
diff --git a/app/src/main/res/drawable/default_background.xml b/app/src/main/res/drawable/default_background.xml
new file mode 100644
index 00000000..82e51a2b
--- /dev/null
+++ b/app/src/main/res/drawable/default_background.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/logo0.png b/app/src/main/res/drawable/logo0.png
new file mode 100644
index 00000000..424e0e28
Binary files /dev/null and b/app/src/main/res/drawable/logo0.png differ
diff --git a/app/src/main/res/drawable/rounded_background.xml b/app/src/main/res/drawable/rounded_background.xml
new file mode 100644
index 00000000..23bb6333
--- /dev/null
+++ b/app/src/main/res/drawable/rounded_background.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/rounded_background2.xml b/app/src/main/res/drawable/rounded_background2.xml
new file mode 100644
index 00000000..a6c40567
--- /dev/null
+++ b/app/src/main/res/drawable/rounded_background2.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 00000000..86bbdaec
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/category_item.xml b/app/src/main/res/layout/category_item.xml
new file mode 100644
index 00000000..b42540d8
--- /dev/null
+++ b/app/src/main/res/layout/category_item.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/channel.xml b/app/src/main/res/layout/channel.xml
new file mode 100644
index 00000000..7c48bd52
--- /dev/null
+++ b/app/src/main/res/layout/channel.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/info.xml b/app/src/main/res/layout/info.xml
new file mode 100644
index 00000000..25e2813f
--- /dev/null
+++ b/app/src/main/res/layout/info.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml
new file mode 100644
index 00000000..489c11a3
--- /dev/null
+++ b/app/src/main/res/layout/list_item.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/menu.xml b/app/src/main/res/layout/menu.xml
new file mode 100644
index 00000000..10dd4058
--- /dev/null
+++ b/app/src/main/res/layout/menu.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/player.xml b/app/src/main/res/layout/player.xml
new file mode 100644
index 00000000..063834b5
--- /dev/null
+++ b/app/src/main/res/layout/player.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/setting.xml b/app/src/main/res/layout/setting.xml
new file mode 100644
index 00000000..752f3845
--- /dev/null
+++ b/app/src/main/res/layout/setting.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/show.xml b/app/src/main/res/layout/show.xml
new file mode 100644
index 00000000..c3dc8abf
--- /dev/null
+++ b/app/src/main/res/layout/show.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 00000000..c209e78e
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 00000000..4f0f1d64
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 00000000..948a3070
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 00000000..28d4b77f
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 00000000..aa7d6427
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/raw/channels.json b/app/src/main/res/raw/channels.json
new file mode 100644
index 00000000..335b75e8
--- /dev/null
+++ b/app/src/main/res/raw/channels.json
@@ -0,0 +1,505 @@
+[
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/d57905b93540bd15f0c48230dbbbff7ee0d645ff539e38866e2d15c8b9f7dfcd.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV1 综合",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226231/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/20115388de0207131af17eac86c33049b95d69eaff064e55653a1b941810a006.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV2 财经",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226195/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/7b7a65c712450da3deb6ca66fbacf4f9aee00d3f20bd80eafb5ada01ec63eb3a.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV3 综艺",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226397/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/f357e58fdbcc076a3d65e1f958c942b2e14f14342c60736ceed98b092d35356a.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV4 中文国际",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226191/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/0a6a7138952675983a3d854df7688557b286d59aa06166edae51506f9204d655.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV5 体育",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226395/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/741515efda91f03f455df8a7da4ee11fa9329139c276435cf0a9e2af398d5bf2.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV6 电影",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226393/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/b29af94e295ebdf646cefb68122c429b9cd921f498ca20d2d8070252536f9ff9.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV7 国防军事",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226192/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/ad51de94426a0ba039e6dd6a8534ea98ecc813a6176bde87b4f18cc34d6d7590.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV8 电视剧",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226391/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/2ed1b4deeca179d5db806bb941790f82eb92a1b7299c1c38fe027f95a5caee5e.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV9 记录",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226197/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/aa6157ec65188cd41826e5a2f088c3d6d153205f5f6428258d12c59999e221aa.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV10 科教",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226189/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/ed12ed7c7a1034dae4350011fe039284c5d5a836506b28c9e32e3c75299625c0.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV11 戏曲",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226240/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/484083cffaa40df7e659565e8cb4d1cc740158a185512114167aa21fa0c59240.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV12 社会与法",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226190/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/266da7b43c03e2312186b4a999e0f060e8f15b10d2cc2c9aa32171819254cf1a.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV13 新闻",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226233/index.m3u8",
+ "https://live-play.cctvnews.cctv.com/cctv/merge_cctv13.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/af6b603896938dc346fbb16abfc63c12cba54b0ec9d18770a15d347d115f12d5.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV14 少儿",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226193/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/53793fa7bacd3a93ff6dc5d2758418985e1f952a316c335d663b572d8bdcd74d.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV16 奥林匹克",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226921/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/649ad76a90bfef55b05db9fe52e006487280f619089099d5dc971e387fc6eff0.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CCTV5+ 体育赛事",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226221/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/4d549e53e6d0f632d5a633d1945280797b153e588f919221a07faa869812cc89.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "风云剧场",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226950/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/a556bd7d93ce65e18f243a8892b5604f4faa994a4897315914216a710a706208.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "第一剧场",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226959/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/bb3c6c9e145d698137f5bb64a582021a01b51344b929003630eb769ea65832a9.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "世界地理",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226947/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/bbf1d024c5228b8dd128b0e3cb1717d173fab4ee84c3a4c8a57b1a215362ca3b.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "风云音乐",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226953/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/4c6b6a6d3839889f34d33db3c2f80233b26b74d3489b393487635f8704e70796.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "兵器科技",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226975/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/cd1e2bb52b06a991de168733e5ff0f1d85adc8042d40c8f393f723543e5dd08a.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "风云足球",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226984/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/cdd1b31ede7a5ad049ed53d9a072422f829e72dd062ed2c19e077fdd01699071.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "高尔夫网球",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226978/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/10e14a92478011aa6c3c8562e62127f3b1908e29fcd78e4b2b24b9e6d3ec2fbc.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "央视台球",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226956/index.m3u8"
+ ]
+ },
+ {
+ "category": "央视频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/244d72c0eb1615ed7d51c2f5db5a67f306aa3f58c05bc2d34de3aa7e956dc8c9.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "电视指南",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888893/224/3221226987/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/9bd372ca292a82ce3aa08772b07efc4af1f85c21d1f268ea33440c49e9a0a488.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "东方卫视",
+ "videoUrl": [
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226217/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/4120e89d3079d08aa17d382f69a2308ec70839b278367763c34a34666c75cb88.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "湖南卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226307/index.m3u8",
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226211/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/7a6be5a2bb1dc53a945c016ff1f525dc4a84c51db371c15c89aa55404b0ba784.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "湖北卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226477/index.m3u8",
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226194/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/ac4ed6058a87c101ae7147ebc38905d0cae047fb73fd277ee5049b84f52bda36.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "辽宁卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226546/index.m3u8",
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226201/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/380ad685c0c1d5b2c902246b8d2df6d3f9b45e2837abcfe493075bbded597a31.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "江苏卫视",
+ "videoUrl": [
+ "http://39.134.24.166/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226200/index.m3u8",
+ "http://39.134.18.195/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226200/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/3c760d0d00463855890e8a1864ea4a6b6dd66b90c29b4ac714a4b17c16519871.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "江西卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226344/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225764/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/22d403f07a7cf5410b3ad3ddb65a11aa229a32475fac213f5344c9f0ec330ca1.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "山东卫视",
+ "videoUrl": [
+ "http://39.134.18.194:80/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225771/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/28886880a4dc0f06fb7e0a528a1def0591d61a65870e29176ede0cc92033bbfd.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "广东卫视",
+ "videoUrl": [
+ "http://39.134.18.193/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225757/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/54b7e97cb816bb223fe05f3fc44da2c7820eb66e8550c19d23100f2c414ecc38.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "广西卫视",
+ "videoUrl": [
+ "http://live.gxrb.com.cn/tv/gxtvlive03/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225770/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/657651f411de2673d1770d9a78b44c1265704f7468cc41d4be7f51d630768494.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "重庆卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226409/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226202/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/74925962148a6d31c85808b6cd4e444c2a54bab393d2c5fc85e960b50e22fa86.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "河南卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226480/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225767/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/d545becdc81c60197b08c7f47380705e4665ed3fe55efc8b855e486f6e655378.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "河北卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226406/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225750/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/4eb45f4781d33d872af027dc01c941559aab55667dd99cc5c22bef7037807b13.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "贵州卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226474/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225793/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/f4f23633c578beea49a3841d88d3490100f029ee349059fa532869db889872c5.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "北京卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221225728/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226222/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/d8273ae9be698ce2db21f5b886ecac95a73429593f93713c60ed8c12c38bf0d3.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "黑龙江卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226327/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226215/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/a66c836bd98ba3e41a2e9a570d4b9c50dedc6839e9de333e2e78212ad505f37e.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "浙江卫视",
+ "videoUrl": [
+ "http://39.134.18.194:80/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226199/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/f35fa04b51b1ee4984b03578b65403570868ebca03c6c01e11b097f999a58d9b.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "安徽卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226391/index.m3u8",
+ "http://39.134.18.194:80/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226203/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/d59fec04c902e3581c617136d02d4b9b8c4cbe64272781ddd3525e80c823edb7.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "深圳卫视",
+ "videoUrl": [
+ "http://39.134.24.166/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226205/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/3276a414ae0eaa0f116f2045cd913367967d0c7c1e978e8621ac3879436c6ed7.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "四川卫视",
+ "videoUrl": [
+ "http://39.134.24.166/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225768/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/3208fe6564a293c21b711333fb3edb05bb5b406cff840573c9a8d839680a1579.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "东南卫视",
+ "videoUrl": [
+ "http://ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226341/index.m3u8",
+ "http://dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225766/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/6e060391fde0469801fc3d84dbf204b4f8d650d251f17d7595a6964c0bb99e81.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "海南卫视",
+ "videoUrl": [
+ "http://39.135.133.149:80/ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226465/index.m3u8",
+ "http://39.134.24.161:80/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225769/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "",
+ "programId": "",
+ "title": "天津卫视",
+ "videoUrl": [
+ "http://39.134.18.193:80/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221226204/index.m3u8"
+ ]
+ },
+ {
+ "category": "地方频道",
+ "logo": "",
+ "programId": "",
+ "title": "新疆卫视",
+ "videoUrl": [
+ "http://39.134.24.165:80/dbiptv.sn.chinamobile.com/PLTV/88888890/224/3221225747/index.m3u8"
+ ]
+ },
+ {
+ "category": "国际频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/a72dff758ca1c17cd0ecc8cedc11b893d208f409d5e6302faa0e9d298848abc3.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CGTN",
+ "videoUrl": [
+ "http://live.cgtn.com/1000/prog_index.m3u8"
+ ]
+ },
+ {
+ "category": "国际频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/a8d0046a47433d952bf6ed17062deb8bd2184ba9aec0f7781df6bf9487a3ffcf.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CGTN 法语频道",
+ "videoUrl": [
+ "https://livefr.cgtn.com/1000f/prog_index.m3u8"
+ ]
+ },
+ {
+ "category": "国际频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/bf0a820893cbaf20dd0333e27042e1ef9c8806e5b602b6a8c95af399db0bc77a.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CGTN 俄语频道",
+ "videoUrl": [
+ "http://liveru.cgtn.com/1000r/prog_index.m3u8"
+ ]
+ },
+ {
+ "category": "国际频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202306/2e44e2aa3e7a1cedf07fd0ae59fe69e86a60a2632660a006e3e9e7397b2d107e.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CGTN 阿拉伯语频道",
+ "videoUrl": [
+ "http://livear.cgtn.com/1000a/prog_index.m3u8"
+ ]
+ },
+ {
+ "category": "国际频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202309/7c337e3dbe64402ec7e4678a619a4a6d95144e42f35161181ff78e143b7cf67a.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CGTN 西班牙语频道",
+ "videoUrl": [
+ "http://livees.cgtn.com/500e/prog_index.m3u8",
+ "http://livees.cgtn.com/1000e/prog_index.m3u8"
+ ]
+ },
+ {
+ "category": "国际频道",
+ "logo": "https://resources.yangshipin.cn/assets/oms/image/202309/74d3ac436a7e374879578de1d87a941fbf566d39d5632b027c5097891ed32bd5.png?imageMogr2/format/webp",
+ "programId": "",
+ "title": "CGTN 纪录频道",
+ "videoUrl": [
+ "https://livedoc.cgtn.com/500d/prog_index.m3u8"
+ ]
+ }
+]
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..26ee5f23
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,14 @@
+
+ #000000
+ #DDDDDD
+ #0096a6
+ #ffaa3f
+ #ffaa3f
+ #3d3d3d
+ #000
+ #FFF
+ #D82042
+ #D82042
+ #FFEEEEEE
+ #B3EEEEEE
+
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 00000000..56d49ad8
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,4 @@
+
+
+ 1dp
+
\ No newline at end of file
diff --git a/app/src/main/res/values/server.xml b/app/src/main/res/values/server.xml
new file mode 100644
index 00000000..394661ba
--- /dev/null
+++ b/app/src/main/res/values/server.xml
@@ -0,0 +1,4 @@
+
+
+ http://localhost:8080
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..87750753
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,15 @@
+
+ 我的電視·〇
+ Error Fragment
+ Personal Settings
+ Movie
+
+
+ An error occurred
+ Dismiss
+
+ 换台反转
+ 数字选台
+ 检查更新
+ 开机自启
+
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 00000000..05b5474e
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/network.xml b/app/src/main/res/xml/network.xml
new file mode 100644
index 00000000..bb6ab93d
--- /dev/null
+++ b/app/src/main/res/xml/network.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 00000000..0da18c42
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,5 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+ id("com.android.application") version "8.2.2" apply false
+ id("org.jetbrains.kotlin.android") version "1.9.10" apply false
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 00000000..3c5031eb
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..e708b1c0
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..5c0faf18
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Dec 14 14:50:34 HKT 2023
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 00000000..4f906e0c
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 00000000..ac1b06f9
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/screenshots/appreciate.jpeg b/screenshots/appreciate.jpeg
new file mode 100644
index 00000000..05f10de8
Binary files /dev/null and b/screenshots/appreciate.jpeg differ
diff --git a/screenshots/img.png b/screenshots/img.png
new file mode 100644
index 00000000..312da813
Binary files /dev/null and b/screenshots/img.png differ
diff --git a/screenshots/zfb.jpg b/screenshots/zfb.jpg
new file mode 100644
index 00000000..9bd85104
Binary files /dev/null and b/screenshots/zfb.jpg differ
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 00000000..b1583988
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,18 @@
+pluginManagement {
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.name = "My TV 0"
+include(":app")
+
\ No newline at end of file