-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df5b006
commit 39e5cc7
Showing
8 changed files
with
135 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
## 更新日志 | ||
|
||
### v1.9.0(通用) | ||
|
||
* 减少视频播放失败情况 | ||
* 全面屏手机居中显示 | ||
|
||
### v1.8.8(通用) | ||
|
||
* 样式优化 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | ||
import android.view.WindowManager | ||
import android.widget.Toast | ||
import androidx.fragment.app.Fragment | ||
import androidx.fragment.app.FragmentActivity | ||
import androidx.lifecycle.lifecycleScope | ||
import com.lizongying.mytv.models.TVViewModel | ||
|
@@ -65,6 +66,13 @@ class MainActivity : FragmentActivity(), Request.RequestListener { | |
|
||
Request.setRequestListener(this) | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { | ||
val lp = window.attributes | ||
lp.layoutInDisplayCutoutMode = | ||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES | ||
window.setAttributes(lp) | ||
} | ||
|
||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) | ||
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) | ||
window.decorView.systemUiVisibility = | ||
|
@@ -89,28 +97,32 @@ class MainActivity : FragmentActivity(), Request.RequestListener { | |
.hide(mainFragment) | ||
.hide(errorFragment) | ||
// .hide(loadingFragment) | ||
.hide(timeFragment) | ||
.commit() | ||
} | ||
gestureDetector = GestureDetector(this, GestureListener()) | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
val connectivityManager = | ||
getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | ||
connectivityManager.registerDefaultNetworkCallback(object : | ||
ConnectivityManager.NetworkCallback() { | ||
override fun onAvailable(network: Network) { | ||
super.onAvailable(network) | ||
Log.i(TAG, "net ${Build.VERSION.SDK_INT}") | ||
if (this@MainActivity.isNetworkConnected) { | ||
Log.i(TAG, "net isNetworkConnected") | ||
ready++ | ||
} | ||
} | ||
}) | ||
} else { | ||
Log.i(TAG, "net ${Build.VERSION.SDK_INT}") | ||
ready++ | ||
} | ||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
// val connectivityManager = | ||
// getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | ||
// connectivityManager.registerDefaultNetworkCallback(object : | ||
// ConnectivityManager.NetworkCallback() { | ||
// override fun onAvailable(network: Network) { | ||
// super.onAvailable(network) | ||
// Log.i(TAG, "net ${Build.VERSION.SDK_INT}") | ||
// if ([email protected]) { | ||
// Log.i(TAG, "net isNetworkConnected") | ||
// ready++ | ||
// } | ||
// } | ||
// }) | ||
// } else { | ||
// Log.i(TAG, "net ${Build.VERSION.SDK_INT}") | ||
// ready++ | ||
// } | ||
|
||
showTime() | ||
mainFragment.changeMenu() | ||
} | ||
|
||
fun showInfoFragment(tvViewModel: TVViewModel) { | ||
|
@@ -211,6 +223,7 @@ class MainActivity : FragmentActivity(), Request.RequestListener { | |
handler.removeCallbacks(hideSetting) | ||
handler.postDelayed(hideSetting, delayHideSetting) | ||
showTime() | ||
mainFragment.changeMenu() | ||
} | ||
|
||
fun settingNeverHide() { | ||
|
@@ -238,20 +251,37 @@ class MainActivity : FragmentActivity(), Request.RequestListener { | |
fun fragmentReady(tag: String) { | ||
ready++ | ||
Log.i(TAG, "ready $tag $ready ") | ||
if (ready == 8) { | ||
if (ready == 7) { | ||
mainFragment.fragmentReady() | ||
showTime() | ||
} | ||
} | ||
|
||
private fun showTime() { | ||
Log.i(TAG, "showTime ${SP.time}") | ||
if (SP.time) { | ||
timeFragment.show() | ||
showFragment(timeFragment) | ||
} else { | ||
timeFragment.hide() | ||
hideFragment(timeFragment) | ||
} | ||
} | ||
|
||
private fun showFragment(fragment: Fragment) { | ||
if (!fragment.isHidden) { | ||
return | ||
} | ||
mainFragment.changeStyle() | ||
|
||
supportFragmentManager.beginTransaction() | ||
.show(fragment) | ||
.commitNow() | ||
} | ||
|
||
private fun hideFragment(fragment: Fragment) { | ||
if (fragment.isHidden) { | ||
return | ||
} | ||
|
||
supportFragmentManager.beginTransaction() | ||
.hide(fragment) | ||
.commitNow() | ||
} | ||
|
||
override fun onTouchEvent(event: MotionEvent?): Boolean { | ||
|
@@ -326,6 +356,7 @@ class MainActivity : FragmentActivity(), Request.RequestListener { | |
if (settingFragment.isVisible) { | ||
settingFragment.dismiss() | ||
showTime() | ||
mainFragment.changeMenu() | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters