show current version
This commit is contained in:
parent
03a6efe179
commit
dfe446e6e1
|
|
@ -52,5 +52,5 @@ jobs:
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: ${{ steps.sign_app.outputs.signedReleaseFile }}
|
asset_path: ${{ steps.sign_app.outputs.signedReleaseFile }}
|
||||||
asset_name: my_tv.apk
|
asset_name: my-tv.apk
|
||||||
asset_content_type: application/vnd.android.package-archive
|
asset_content_type: application/vnd.android.package-archive
|
||||||
21
README.md
21
README.md
|
|
@ -0,0 +1,21 @@
|
||||||
|
# 我的电视
|
||||||
|
|
||||||
|
安卓电视直播软件,内置直播源
|
||||||
|
|
||||||
|
## 使用
|
||||||
|
|
||||||
|
下载安装[releases](https://github.com/lizongying/my-tv/releases)
|
||||||
|
|
||||||
|
## 其他
|
||||||
|
|
||||||
|
小米电视可以使用小米电视助手进行安装
|
||||||
|
|
||||||
|
如电视可以启用ADB,也可以通过ADB进行安装:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
adb install my-tv.apk
|
||||||
|
```
|
||||||
|
|
||||||
|
## 赞赏
|
||||||
|
|
||||||
|

|
||||||
|
|
@ -13,6 +13,8 @@ android {
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 11
|
versionCode 11
|
||||||
versionName "1.1"
|
versionName "1.1"
|
||||||
|
versionCode getVersionCode()
|
||||||
|
versionName getVersionName()
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|
@ -32,6 +34,26 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static def getVersionCode() {
|
||||||
|
try {
|
||||||
|
def process = 'git rev-list --count HEAD'.execute()
|
||||||
|
process.waitFor()
|
||||||
|
return process.text.toInteger()
|
||||||
|
} catch (ignored) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static def getVersionName() {
|
||||||
|
try {
|
||||||
|
def process = 'git describe --tags --always'.execute()
|
||||||
|
process.waitFor()
|
||||||
|
return process.text.trim()
|
||||||
|
} catch (ignored) {
|
||||||
|
return "1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.11.0-beta02'
|
implementation 'androidx.core:core-ktx:1.11.0-beta02'
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@ import kotlinx.coroutines.withContext
|
||||||
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 {
|
||||||
Log.d(TAG, "onCreateViewHolder")
|
|
||||||
|
|
||||||
val cardView = object :
|
val cardView = object :
|
||||||
ImageCardView(ContextThemeWrapper(parent.context, R.style.CustomImageCardTheme)) {
|
ImageCardView(ContextThemeWrapper(parent.context, R.style.CustomImageCardTheme)) {
|
||||||
override fun setSelected(selected: Boolean) {
|
override fun setSelected(selected: Boolean) {
|
||||||
|
|
@ -40,7 +38,6 @@ class CardPresenter(private val lifecycleScope: LifecycleCoroutineScope) : Prese
|
||||||
val tv = item as TV
|
val tv = item as TV
|
||||||
val cardView = viewHolder.view as ImageCardView
|
val cardView = viewHolder.view as ImageCardView
|
||||||
|
|
||||||
Log.d(TAG, "onBindViewHolder")
|
|
||||||
if (tv.videoUrl != null) {
|
if (tv.videoUrl != null) {
|
||||||
cardView.titleText = tv.title
|
cardView.titleText = tv.title
|
||||||
cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT)
|
cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT)
|
||||||
|
|
@ -57,7 +54,6 @@ class CardPresenter(private val lifecycleScope: LifecycleCoroutineScope) : Prese
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUnbindViewHolder(viewHolder: ViewHolder) {
|
override fun onUnbindViewHolder(viewHolder: ViewHolder) {
|
||||||
Log.d(TAG, "onUnbindViewHolder")
|
|
||||||
val cardView = viewHolder.view as ImageCardView
|
val cardView = viewHolder.view as ImageCardView
|
||||||
// Remove references to images so that the garbage collector can free up memory
|
// Remove references to images so that the garbage collector can free up memory
|
||||||
cardView.badgeImage = null
|
cardView.badgeImage = null
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ 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].
|
* Loads [MainFragment].
|
||||||
*/
|
*/
|
||||||
|
|
@ -64,7 +65,7 @@ class MainActivity : FragmentActivity() {
|
||||||
mainFragment.focus()
|
mainFragment.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fragmentIsHidden(): Boolean {
|
fun mainFragmentIsHidden(): Boolean {
|
||||||
return mainFragment.isHidden
|
return mainFragment.isHidden
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,12 +80,16 @@ class MainActivity : FragmentActivity() {
|
||||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||||
when (keyCode) {
|
when (keyCode) {
|
||||||
KeyEvent.KEYCODE_BACK -> {
|
KeyEvent.KEYCODE_BACK -> {
|
||||||
|
if (!mainFragmentIsHidden()) {
|
||||||
|
hideMainFragment()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
if (doubleBackToExitPressedOnce) {
|
if (doubleBackToExitPressedOnce) {
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
hideMainFragment()
|
|
||||||
this.doubleBackToExitPressedOnce = true
|
this.doubleBackToExitPressedOnce = true
|
||||||
Toast.makeText(this, "再按一次退出", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "再按一次退出", Toast.LENGTH_SHORT).show()
|
||||||
|
|
||||||
|
|
@ -112,9 +117,14 @@ class MainActivity : FragmentActivity() {
|
||||||
layoutParams.gravity = Gravity.BOTTOM
|
layoutParams.gravity = Gravity.BOTTOM
|
||||||
imageView.layoutParams = layoutParams
|
imageView.layoutParams = layoutParams
|
||||||
|
|
||||||
|
|
||||||
|
val packageInfo = packageManager.getPackageInfo(packageName, 0)
|
||||||
|
|
||||||
|
val versionName = packageInfo.versionName
|
||||||
|
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||||
builder
|
builder
|
||||||
.setTitle("https://github.com/lizongying/my-tv/releases")
|
.setTitle("当前版本: $versionName, 获取最新: https://github.com/lizongying/my-tv/releases/")
|
||||||
.setView(linearLayout)
|
.setView(linearLayout)
|
||||||
|
|
||||||
val dialog: AlertDialog = builder.create()
|
val dialog: AlertDialog = builder.create()
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,6 @@ class MainFragment : BrowseSupportFragment() {
|
||||||
) {
|
) {
|
||||||
if (item is TV) {
|
if (item is TV) {
|
||||||
Log.i(TAG, "Item: ${item.id}")
|
Log.i(TAG, "Item: ${item.id}")
|
||||||
|
|
||||||
}
|
}
|
||||||
if (itemViewHolder == null) {
|
if (itemViewHolder == null) {
|
||||||
view?.post {
|
view?.post {
|
||||||
|
|
|
||||||
|
|
@ -20,30 +20,31 @@ class PlaybackControlGlue(
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_UP -> {
|
KeyEvent.KEYCODE_DPAD_UP -> {
|
||||||
if ((context as? MainActivity)?.fragmentIsHidden() == true) {
|
if ((context as? MainActivity)?.mainFragmentIsHidden() == true) {
|
||||||
(context as? MainActivity)?.prev()
|
(context as? MainActivity)?.prev()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_DOWN -> {
|
KeyEvent.KEYCODE_DPAD_DOWN -> {
|
||||||
if ((context as? MainActivity)?.fragmentIsHidden() == true) {
|
if ((context as? MainActivity)?.mainFragmentIsHidden() == true) {
|
||||||
(context as? MainActivity)?.next()
|
(context as? MainActivity)?.next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_LEFT -> {
|
KeyEvent.KEYCODE_DPAD_LEFT -> {
|
||||||
if ((context as? MainActivity)?.fragmentIsHidden() == true) {
|
if ((context as? MainActivity)?.mainFragmentIsHidden() == true) {
|
||||||
(context as? MainActivity)?.prev()
|
(context as? MainActivity)?.prev()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
||||||
if ((context as? MainActivity)?.fragmentIsHidden() == true) {
|
if ((context as? MainActivity)?.mainFragmentIsHidden() == true) {
|
||||||
(context as? MainActivity)?.next()
|
(context as? MainActivity)?.next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onKey(v, keyCode, event)
|
return super.onKey(v, keyCode, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ class PlaybackFragment : VideoSupportFragment() {
|
||||||
try {
|
try {
|
||||||
playerAdapter?.setDataSource(Uri.parse(tv.videoUrl))
|
playerAdapter?.setDataSource(Uri.parse(tv.videoUrl))
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
// Handle the exception
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
hideControlsOverlay(false)
|
hideControlsOverlay(false)
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
Loading…
Reference in New Issue