mirror of
https://github.com/lizongying/my-tv.git
synced 2026-11-02 17:46:35 +08:00
phoenix epg
This commit is contained in:
@@ -25,7 +25,7 @@ import kotlinx.coroutines.launch
|
||||
import java.security.MessageDigest
|
||||
|
||||
|
||||
class MainActivity : FragmentActivity() {
|
||||
class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
|
||||
private var ready = 0
|
||||
private var playerFragment = PlayerFragment()
|
||||
@@ -39,24 +39,17 @@ class MainActivity : FragmentActivity() {
|
||||
private lateinit var gestureDetector: GestureDetector
|
||||
|
||||
private val handler = Handler()
|
||||
private val delayHideMain: Long = 5000
|
||||
private val delayHideMain: Long = 10000
|
||||
private val delayHideSetting: Long = 10000
|
||||
|
||||
init {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val utilsJob = async(start = CoroutineStart.LAZY) { Utils.init() }
|
||||
|
||||
utilsJob.start()
|
||||
|
||||
utilsJob.await()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Log.i(TAG, "onCreate")
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
Request.onCreate()
|
||||
Request.setRequestListener(this)
|
||||
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
window.decorView.systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
@@ -78,7 +71,13 @@ class MainActivity : FragmentActivity() {
|
||||
} else {
|
||||
packageInfo.versionCode.toLong()
|
||||
}
|
||||
settingFragment = SettingFragment(versionName, versionCode, SP.channelReversal, SP.channelNum, SP.bootStartup)
|
||||
settingFragment = SettingFragment(
|
||||
versionName,
|
||||
versionCode,
|
||||
SP.channelReversal,
|
||||
SP.channelNum,
|
||||
SP.bootStartup
|
||||
)
|
||||
}
|
||||
|
||||
fun showInfoFragment(tvViewModel: TVViewModel) {
|
||||
@@ -172,7 +171,7 @@ class MainActivity : FragmentActivity() {
|
||||
fun fragmentReady() {
|
||||
ready++
|
||||
Log.i(TAG, "ready $ready")
|
||||
if (ready == 4) {
|
||||
if (ready == 5) {
|
||||
mainFragment.fragmentReady()
|
||||
}
|
||||
}
|
||||
@@ -519,6 +518,15 @@ class MainActivity : FragmentActivity() {
|
||||
handler.removeCallbacks(hideMain)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Request.onDestroy()
|
||||
}
|
||||
|
||||
override fun onRequestFinished() {
|
||||
fragmentReady()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val TAG = "MainActivity"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user