Refactor some Screens to be classes
Not really much point in keeping these as singletons. Hopefully allows for these to be GC-ed after closing them.
This commit is contained in:
parent
dfbbbadfac
commit
c9a1bd86b5
4 changed files with 22 additions and 13 deletions
|
@ -114,7 +114,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||
),
|
||||
Preference.PreferenceItem.TextPreference(
|
||||
title = stringResource(R.string.pref_debug_info),
|
||||
onClick = { navigator.push(DebugInfoScreen) },
|
||||
onClick = { navigator.push(DebugInfoScreen()) },
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -28,9 +28,11 @@ import eu.kanade.tachiyomi.util.system.copyToClipboard
|
|||
import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator
|
||||
import tachiyomi.presentation.core.components.material.Scaffold
|
||||
|
||||
object BackupSchemaScreen : Screen() {
|
||||
class BackupSchemaScreen : Screen() {
|
||||
|
||||
const val title = "Backup file schema"
|
||||
companion object {
|
||||
const val title = "Backup file schema"
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
|
|
|
@ -18,7 +18,8 @@ import eu.kanade.tachiyomi.R
|
|||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import kotlinx.coroutines.guava.await
|
||||
|
||||
object DebugInfoScreen : Screen() {
|
||||
class DebugInfoScreen : Screen() {
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
|
@ -29,11 +30,11 @@ object DebugInfoScreen : Screen() {
|
|||
listOf(
|
||||
Preference.PreferenceItem.TextPreference(
|
||||
title = WorkerInfoScreen.title,
|
||||
onClick = { navigator.push(WorkerInfoScreen) },
|
||||
onClick = { navigator.push(WorkerInfoScreen()) },
|
||||
),
|
||||
Preference.PreferenceItem.TextPreference(
|
||||
title = BackupSchemaScreen.title,
|
||||
onClick = { navigator.push(BackupSchemaScreen) },
|
||||
onClick = { navigator.push(BackupSchemaScreen()) },
|
||||
),
|
||||
getAppInfoGroup(),
|
||||
getDeviceInfoGroup(),
|
||||
|
@ -67,11 +68,15 @@ object DebugInfoScreen : Screen() {
|
|||
@Composable
|
||||
@ReadOnlyComposable
|
||||
private fun getWebViewVersion(): String {
|
||||
val webView = WebView.getCurrentWebViewPackage() ?: return "how did you get here?"
|
||||
val pm = LocalContext.current.packageManager
|
||||
val label = webView.applicationInfo.loadLabel(pm)
|
||||
val version = webView.versionName
|
||||
return "$label $version"
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val webView = WebView.getCurrentWebViewPackage() ?: return "how did you get here?"
|
||||
val pm = LocalContext.current.packageManager
|
||||
val label = webView.applicationInfo.loadLabel(pm)
|
||||
val version = webView.versionName
|
||||
return "$label $version"
|
||||
} else {
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
|
@ -43,9 +43,11 @@ import kotlinx.coroutines.flow.stateIn
|
|||
import tachiyomi.presentation.core.components.material.Scaffold
|
||||
import tachiyomi.presentation.core.util.plus
|
||||
|
||||
object WorkerInfoScreen : Screen() {
|
||||
class WorkerInfoScreen : Screen() {
|
||||
|
||||
const val title = "Worker info"
|
||||
companion object {
|
||||
const val title = "Worker info"
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
|
|
Reference in a new issue