fix: 阅读界面屏幕方向设置无效
This commit is contained in:
@@ -573,6 +573,7 @@ sealed interface ReadBookEffect {
|
||||
data object UnregisterTimeBatteryReceiver : ReadBookEffect
|
||||
data object RegisterNetworkListener : ReadBookEffect
|
||||
data object UnregisterNetworkListener : ReadBookEffect
|
||||
data object SetOrientation : ReadBookEffect
|
||||
data object OpenBooksDirPicker : ReadBookEffect
|
||||
data object BackupNow : ReadBookEffect
|
||||
|
||||
|
||||
@@ -176,6 +176,7 @@ class ReadBookController(
|
||||
* View/Window-only resume — business logic handled by ViewModel via OnResume intent.
|
||||
*/
|
||||
fun onResume() {
|
||||
setOrientation()
|
||||
upSystemUiVisibility()
|
||||
refs?.readView?.upTime()
|
||||
screenOffTimerStart()
|
||||
@@ -742,6 +743,10 @@ class ReadBookController(
|
||||
networkChangedListener.unRegister()
|
||||
}
|
||||
|
||||
is ReadBookEffect.SetOrientation -> {
|
||||
setOrientation()
|
||||
}
|
||||
|
||||
is ReadBookEffect.BackupNow -> {
|
||||
Backup.autoBack(activity)
|
||||
}
|
||||
|
||||
@@ -1285,6 +1285,9 @@ class ReadBookViewModel(
|
||||
if (old != null && old.keepLight != preferences.keepLight) {
|
||||
_effects.tryEmit(ReadBookEffect.UpScreenTimeOut)
|
||||
}
|
||||
if (old != null && old.screenOrientation != preferences.screenOrientation) {
|
||||
_effects.tryEmit(ReadBookEffect.SetOrientation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user