fix: 静态检查修复(访问权限+生命周期清理)
1. MainActivity.notificationBanner 改为非 private (HomeFragment 需访问设置点击回调,原 private 编译报错) 2. HomeFragment.onDestroyView 补充清理 bannerView.onClick (避免 Fragment 销毁后回调泄漏) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,8 +37,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
/** 事件总线 */
|
/** 事件总线 */
|
||||||
@Inject lateinit var eventBus: EventBus
|
@Inject lateinit var eventBus: EventBus
|
||||||
|
|
||||||
/** 通知横幅 */
|
/** 通知横幅(HomeFragment 需访问设置点击回调) */
|
||||||
private lateinit var notificationBanner: NotificationBannerView
|
lateinit var notificationBanner: NotificationBannerView
|
||||||
|
|
||||||
/** Activity 协程作用域 */
|
/** Activity 协程作用域 */
|
||||||
private val activityScope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
private val activityScope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
|
|||||||
(activity as? com.xiaoqu.watch.app.MainActivity)?.let {
|
(activity as? com.xiaoqu.watch.app.MainActivity)?.let {
|
||||||
it.onSwipeDown = null
|
it.onSwipeDown = null
|
||||||
it.onBackKeyPressed = null
|
it.onBackKeyPressed = null
|
||||||
|
it.notificationBanner.onClick = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user