This commit is contained in:
Li ZongYing 2023-12-06 20:07:27 +08:00
parent c524e6c0fb
commit 20ddba6ad7
7 changed files with 4 additions and 26 deletions

View File

@ -11,8 +11,8 @@ android {
applicationId "com.lizongying.mytv" applicationId "com.lizongying.mytv"
minSdk 23 minSdk 23
targetSdk 33 targetSdk 33
versionCode getVersionCode() versionCode VersionCode()
versionName getVersionName() versionName VersionName()
} }
buildTypes { buildTypes {
@ -32,7 +32,7 @@ android {
} }
} }
static def getVersionCode() { static def VersionCode() {
try { try {
def process = 'git rev-list --count HEAD'.execute() def process = 'git rev-list --count HEAD'.execute()
process.waitFor() process.waitFor()
@ -42,7 +42,7 @@ static def getVersionCode() {
} }
} }
static def getVersionName() { static def VersionName() {
try { try {
def process = 'git describe --tags --always'.execute() def process = 'git describe --tags --always'.execute()
process.waitFor() process.waitFor()
@ -53,7 +53,6 @@ static def getVersionName() {
} }
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.11.0-beta02' implementation 'androidx.core:core-ktx:1.11.0-beta02'
implementation 'androidx.leanback:leanback:1.0.0' implementation 'androidx.leanback:leanback:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'com.github.bumptech.glide:glide:4.11.0'

View File

@ -2,7 +2,6 @@ package com.lizongying.mytv
import android.graphics.Bitmap import android.graphics.Bitmap
import android.media.MediaMetadataRetriever import android.media.MediaMetadataRetriever
import android.util.Log
import android.view.ContextThemeWrapper import android.view.ContextThemeWrapper
import android.view.ViewGroup import android.view.ViewGroup
import androidx.leanback.widget.ImageCardView import androidx.leanback.widget.ImageCardView
@ -13,11 +12,6 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
/**
* A CardPresenter is used to generate Views and bind Objects to them on demand.
* It contains an ImageCardView.
*/
class CardPresenter(private val lifecycleScope: LifecycleCoroutineScope) : Presenter() { class CardPresenter(private val lifecycleScope: LifecycleCoroutineScope) : Presenter() {
override fun onCreateViewHolder(parent: ViewGroup): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup): ViewHolder {
@ -91,9 +85,7 @@ class CardPresenter(private val lifecycleScope: LifecycleCoroutineScope) : Prese
companion object { companion object {
private const val TAG = "CardPresenter" private const val TAG = "CardPresenter"
private const val CARD_WIDTH = 313 private const val CARD_WIDTH = 313
private const val CARD_HEIGHT = 176 private const val CARD_HEIGHT = 176
} }
} }

View File

@ -2,7 +2,6 @@ package com.lizongying.mytv
import java.io.Serializable import java.io.Serializable
data class Info( data class Info(
var rowPosition: Int = 0, var rowPosition: Int = 0,
var itemPosition: Int = 0, var itemPosition: Int = 0,

View File

@ -13,10 +13,6 @@ import android.widget.Toast
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
/**
* Loads [MainFragment].
*/
class MainActivity : FragmentActivity() { class MainActivity : FragmentActivity() {
private val playbackFragment = PlaybackFragment() private val playbackFragment = PlaybackFragment()

View File

@ -18,9 +18,6 @@ import androidx.leanback.widget.Row
import androidx.leanback.widget.RowPresenter import androidx.leanback.widget.RowPresenter
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
/**
* Loads a grid of cards with movies to browse.
*/
class MainFragment : BrowseSupportFragment() { class MainFragment : BrowseSupportFragment() {
var itemPosition: Int = 0 var itemPosition: Int = 0

View File

@ -10,7 +10,6 @@ import androidx.leanback.media.PlaybackTransportControlGlue
import androidx.leanback.widget.PlaybackControlsRow import androidx.leanback.widget.PlaybackControlsRow
import java.io.IOException import java.io.IOException
/** Handles video playback with media controls. */
class PlaybackFragment : VideoSupportFragment() { class PlaybackFragment : VideoSupportFragment() {
private lateinit var mTransportControlGlue: PlaybackTransportControlGlue<MediaPlayerAdapter> private lateinit var mTransportControlGlue: PlaybackTransportControlGlue<MediaPlayerAdapter>
@ -28,7 +27,6 @@ class PlaybackFragment : VideoSupportFragment() {
} }
override fun showControlsOverlay(runAnimation: Boolean) { override fun showControlsOverlay(runAnimation: Boolean) {
// We will do nothing here, and thus controls will never be shown
} }
fun play(tv: TV) { fun play(tv: TV) {

View File

@ -2,9 +2,6 @@ package com.lizongying.mytv
import java.io.Serializable import java.io.Serializable
/**
* Movie class represents video entity with title, description, image thumbs and video url.
*/
data class TV( data class TV(
var id: Int = 0, var id: Int = 0,
var title: String? = null, var title: String? = null,