some info style
This commit is contained in:
parent
3eb6757543
commit
286cec465a
|
|
@ -34,7 +34,7 @@ class InfoFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun show(tvViewModel: TVViewModel) {
|
fun show(tvViewModel: TVViewModel) {
|
||||||
Log.i("", "show")
|
Log.i(TAG, "show")
|
||||||
binding.textView.text = tvViewModel.title.value
|
binding.textView.text = tvViewModel.title.value
|
||||||
Glide.with(this)
|
Glide.with(this)
|
||||||
.load(tvViewModel.logo.value)
|
.load(tvViewModel.logo.value)
|
||||||
|
|
@ -51,13 +51,13 @@ class InfoFragment : Fragment() {
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
Log.i("", "onPause")
|
Log.i(TAG, "onPause")
|
||||||
// Cancel the delayed task when the fragment is paused
|
// Cancel the delayed task when the fragment is paused
|
||||||
handler.removeCallbacks(removeRunnable)
|
handler.removeCallbacks(removeRunnable)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val removeRunnable = Runnable {
|
private val removeRunnable = Runnable {
|
||||||
Log.i("", "hide")
|
Log.i(TAG, "hide")
|
||||||
view?.visibility = View.GONE
|
view?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -214,9 +214,6 @@ class MainActivity : FragmentActivity() {
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_CENTER -> {
|
KeyEvent.KEYCODE_DPAD_CENTER -> {
|
||||||
Log.i(TAG, "KEYCODE_DPAD_CENTER")
|
Log.i(TAG, "KEYCODE_DPAD_CENTER")
|
||||||
// if (mainFragment.isHidden) {
|
|
||||||
// mainFragment.checkProgram()
|
|
||||||
// }
|
|
||||||
switchMainFragment()
|
switchMainFragment()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,28 +243,28 @@ class MainActivity : FragmentActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_LEFT -> {
|
KeyEvent.KEYCODE_DPAD_LEFT -> {
|
||||||
if (mainFragment.isHidden) {
|
// if (mainFragment.isHidden) {
|
||||||
prevSource()
|
// prevSource()
|
||||||
} else {
|
// } else {
|
||||||
// if (mainFragment.tvListViewModel.getTVViewModelCurrent()
|
//// if (mainFragment.tvListViewModel.getTVViewModelCurrent()
|
||||||
// ?.getItemPosition() == 0
|
//// ?.getItemPosition() == 0
|
||||||
// ) {
|
//// ) {
|
||||||
//// mainFragment.toLastPosition()
|
////// mainFragment.toLastPosition()
|
||||||
// hideMainFragment()
|
//// hideMainFragment()
|
||||||
// }
|
//// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
||||||
if (mainFragment.isHidden) {
|
// if (mainFragment.isHidden) {
|
||||||
nextSource()
|
// nextSource()
|
||||||
} else {
|
// } else {
|
||||||
// if (mainFragment.tvListViewModel.getTVViewModelCurrent()
|
//// if (mainFragment.tvListViewModel.getTVViewModelCurrent()
|
||||||
// ?.getItemPosition() == mainFragment.tvListViewModel.maxNum[mainFragment.selectedPosition] - 1
|
//// ?.getItemPosition() == mainFragment.tvListViewModel.maxNum[mainFragment.selectedPosition] - 1
|
||||||
// ) {
|
//// ) {
|
||||||
// mainFragment.toFirstPosition()
|
//// mainFragment.toFirstPosition()
|
||||||
// }
|
//// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,17 +88,17 @@ class PlayerFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onStart() {
|
||||||
super.onPause()
|
super.onStart()
|
||||||
if (playerView != null) {
|
if (playerView != null) {
|
||||||
playerView!!.player?.stop()
|
playerView!!.player?.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onStop() {
|
||||||
super.onResume()
|
super.onStop()
|
||||||
if (playerView != null) {
|
if (playerView != null) {
|
||||||
playerView!!.player?.play()
|
playerView!!.player?.stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ object Utils {
|
||||||
return SimpleDateFormat(format, Locale.CHINA).format(Date())
|
return SimpleDateFormat(format, Locale.CHINA).format(Date())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDateTimestamp(): Int {
|
fun getDateTimestamp(): Long {
|
||||||
return (Date().time / 1000).toInt()
|
return Date().time / 1000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,11 +2,10 @@ package com.lizongying.mytv.api
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.util.Log
|
|
||||||
import com.lizongying.mytv.Encryptor
|
import com.lizongying.mytv.Encryptor
|
||||||
import com.lizongying.mytv.MainActivity
|
import com.lizongying.mytv.MainActivity
|
||||||
|
import com.lizongying.mytv.Utils.getDateTimestamp
|
||||||
import com.lizongying.mytv.models.TVViewModel
|
import com.lizongying.mytv.models.TVViewModel
|
||||||
import java.util.Date
|
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
|
@ -84,7 +83,7 @@ class YSP(var context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTimeStr(): String {
|
private fun getTimeStr(): String {
|
||||||
return (Date().time / 1000).toString()
|
return getDateTimestamp().toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun generateGuid(): String {
|
fun generateGuid(): String {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import androidx.media3.exoplayer.hls.HlsMediaSource
|
||||||
import com.lizongying.mytv.TV
|
import com.lizongying.mytv.TV
|
||||||
import com.lizongying.mytv.Utils.getDateTimestamp
|
import com.lizongying.mytv.Utils.getDateTimestamp
|
||||||
import com.lizongying.mytv.proto.Ysp.cn.yangshipin.omstv.common.proto.programModel.Program
|
import com.lizongying.mytv.proto.Ysp.cn.yangshipin.omstv.common.proto.programModel.Program
|
||||||
import java.util.Date
|
|
||||||
|
|
||||||
class TVViewModel(private var tv: TV) : ViewModel() {
|
class TVViewModel(private var tv: TV) : ViewModel() {
|
||||||
private var mapping = mapOf(
|
private var mapping = mapOf(
|
||||||
|
|
@ -232,7 +231,7 @@ class TVViewModel(private var tv: TV) : ViewModel() {
|
||||||
private var rowPosition: Int = 0
|
private var rowPosition: Int = 0
|
||||||
private var itemPosition: Int = 0
|
private var itemPosition: Int = 0
|
||||||
|
|
||||||
var programUpdateTime: Int = 0
|
var programUpdateTime: Long = 0
|
||||||
|
|
||||||
private val _programId = MutableLiveData<String>()
|
private val _programId = MutableLiveData<String>()
|
||||||
val programId: LiveData<String>
|
val programId: LiveData<String>
|
||||||
|
|
@ -379,13 +378,9 @@ class TVViewModel(private var tv: TV) : ViewModel() {
|
||||||
return mapping[tv.title]
|
return mapping[tv.title]
|
||||||
}
|
}
|
||||||
|
|
||||||
// fun getProgram(): MutableList<Program>? {
|
|
||||||
// _program.value = (_program.value?.filter { it.et > (Date().time / 1000) })?.toMutableList()
|
|
||||||
// return _program.value?.subList(0, 2)
|
|
||||||
// }
|
|
||||||
|
|
||||||
fun getProgramOne(): Program? {
|
fun getProgramOne(): Program? {
|
||||||
val programNew = (_program.value?.filter { it.et > (Date().time / 1000) })?.toMutableList()
|
val programNew =
|
||||||
|
(_program.value?.filter { it.et > getDateTimestamp() })?.toMutableList()
|
||||||
if (programNew != null && _program.value != programNew) {
|
if (programNew != null && _program.value != programNew) {
|
||||||
_program.value = programNew
|
_program.value = programNew
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,14 @@
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:textColor="#FFEEEEEE"
|
android:textColor="#FFEEEEEE"
|
||||||
android:textSize="20sp" />
|
android:textSize="22sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/info_desc"
|
android:id="@+id/info_desc"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="8dp"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="#B3EEEEEE"
|
android:textColor="#B3EEEEEE"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue