diff --git a/README.md b/README.md
index 7136969..a41c3c8 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,11 @@
## 更新日志
+### v1.0.8
+
+* 点击节目列表/菜单以外区域,自动隐藏节目列表/菜单
+* 解决部分情况下崩溃问题
+
### v1.0.7
* 支持rtsp直播
diff --git a/app/src/main/java/com/lizongying/mytv0/MainActivity.kt b/app/src/main/java/com/lizongying/mytv0/MainActivity.kt
index ec67d72..992bf74 100644
--- a/app/src/main/java/com/lizongying/mytv0/MainActivity.kt
+++ b/app/src/main/java/com/lizongying/mytv0/MainActivity.kt
@@ -239,8 +239,10 @@ class MainActivity : FragmentActivity() {
}
private val hideMenu = Runnable {
- if (!menuFragment.isHidden) {
- supportFragmentManager.beginTransaction().hide(menuFragment).commit()
+ if (!isFinishing && !supportFragmentManager.isStateSaved) {
+ if (!menuFragment.isHidden) {
+ supportFragmentManager.beginTransaction().hide(menuFragment).commit()
+ }
}
}
diff --git a/app/src/main/java/com/lizongying/mytv0/MenuFragment.kt b/app/src/main/java/com/lizongying/mytv0/MenuFragment.kt
index d458da0..4c279dc 100644
--- a/app/src/main/java/com/lizongying/mytv0/MenuFragment.kt
+++ b/app/src/main/java/com/lizongying/mytv0/MenuFragment.kt
@@ -76,9 +76,19 @@ class MenuFragment : Fragment(), GroupAdapter.ItemListener, ListAdapter.ItemList
}
}
+ binding.menu.setOnClickListener {
+ hideSelf()
+ }
+
return binding.root
}
+ private fun hideSelf() {
+ requireActivity().supportFragmentManager.beginTransaction()
+ .hide(this)
+ .commit()
+ }
+
override fun onItemFocusChange(tvListModel: TVListModel, hasFocus: Boolean) {
if (hasFocus) {
(binding.list.adapter as ListAdapter).update(tvListModel)
diff --git a/app/src/main/java/com/lizongying/mytv0/SettingFragment.kt b/app/src/main/java/com/lizongying/mytv0/SettingFragment.kt
index 527ab9d..d036eaa 100644
--- a/app/src/main/java/com/lizongying/mytv0/SettingFragment.kt
+++ b/app/src/main/java/com/lizongying/mytv0/SettingFragment.kt
@@ -86,6 +86,10 @@ class SettingFragment : Fragment() {
(activity as MainActivity).settingActive()
}
+ binding.setting.setOnClickListener {
+ hideSelf()
+ }
+
return binding.root
}
@@ -100,6 +104,12 @@ class SettingFragment : Fragment() {
binding.versionName.text = versionName
}
+ private fun hideSelf() {
+ requireActivity().supportFragmentManager.beginTransaction()
+ .hide(this)
+ .commit()
+ }
+
override fun onDestroyView() {
super.onDestroyView()
_binding = null
diff --git a/app/src/main/res/layout/menu.xml b/app/src/main/res/layout/menu.xml
index 77203a8..6cc9023 100644
--- a/app/src/main/res/layout/menu.xml
+++ b/app/src/main/res/layout/menu.xml
@@ -1,10 +1,13 @@
+ android:layout_height="wrap_content"
+ >
\ No newline at end of file
diff --git a/app/src/main/res/layout/setting.xml b/app/src/main/res/layout/setting.xml
index 48bddc6..53eb690 100644
--- a/app/src/main/res/layout/setting.xml
+++ b/app/src/main/res/layout/setting.xml
@@ -1,10 +1,14 @@
+