mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Minor cleanup
This commit is contained in:
parent
f7cd3929a3
commit
392c3492b3
2 changed files with 40 additions and 35 deletions
|
@ -55,7 +55,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
||||||
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
|
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
|
||||||
val allCategories by getCategories.subscribe().collectAsState(initial = runBlocking { getCategories.await() })
|
val allCategories by getCategories.subscribe().collectAsState(initial = runBlocking { getCategories.await() })
|
||||||
|
|
||||||
return mutableListOf(
|
return listOf(
|
||||||
getCategoriesGroup(LocalNavigator.currentOrThrow, allCategories, libraryPreferences),
|
getCategoriesGroup(LocalNavigator.currentOrThrow, allCategories, libraryPreferences),
|
||||||
getGlobalUpdateGroup(allCategories, libraryPreferences),
|
getGlobalUpdateGroup(allCategories, libraryPreferences),
|
||||||
getChapterSwipeActionsGroup(libraryPreferences),
|
getChapterSwipeActionsGroup(libraryPreferences),
|
||||||
|
@ -222,27 +222,24 @@ object SettingsLibraryScreen : SearchableSettings {
|
||||||
private fun getChapterSwipeActionsGroup(
|
private fun getChapterSwipeActionsGroup(
|
||||||
libraryPreferences: LibraryPreferences,
|
libraryPreferences: LibraryPreferences,
|
||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
val chapterSwipeEndActionPref = libraryPreferences.swipeEndAction()
|
|
||||||
val chapterSwipeStartActionPref = libraryPreferences.swipeStartAction()
|
|
||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(R.string.pref_chapter_swipe),
|
title = stringResource(R.string.pref_chapter_swipe),
|
||||||
preferenceItems = listOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = chapterSwipeEndActionPref,
|
pref = libraryPreferences.swipeEndAction(),
|
||||||
title = stringResource(R.string.pref_chapter_swipe_end),
|
title = stringResource(R.string.pref_chapter_swipe_end),
|
||||||
entries = mapOf(
|
entries = mapOf(
|
||||||
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.action_disable),
|
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.disabled),
|
||||||
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark),
|
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark),
|
||||||
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(R.string.action_mark_as_read),
|
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(R.string.action_mark_as_read),
|
||||||
LibraryPreferences.ChapterSwipeAction.Download to stringResource(R.string.action_download),
|
LibraryPreferences.ChapterSwipeAction.Download to stringResource(R.string.action_download),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = chapterSwipeStartActionPref,
|
pref = libraryPreferences.swipeStartAction(),
|
||||||
title = stringResource(R.string.pref_chapter_swipe_start),
|
title = stringResource(R.string.pref_chapter_swipe_start),
|
||||||
entries = mapOf(
|
entries = mapOf(
|
||||||
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.action_disable),
|
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.disabled),
|
||||||
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark),
|
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark),
|
||||||
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(R.string.action_mark_as_read),
|
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(R.string.action_mark_as_read),
|
||||||
LibraryPreferences.ChapterSwipeAction.Download to stringResource(R.string.action_download),
|
LibraryPreferences.ChapterSwipeAction.Download to stringResource(R.string.action_download),
|
||||||
|
|
|
@ -94,37 +94,45 @@ object DebugInfoScreen : Screen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDeviceInfoGroup(): Preference.PreferenceGroup {
|
private fun getDeviceInfoGroup(): Preference.PreferenceGroup {
|
||||||
val items = mutableListOf(
|
val items = buildList {
|
||||||
Preference.PreferenceItem.TextPreference(
|
add(
|
||||||
title = "Model",
|
Preference.PreferenceItem.TextPreference(
|
||||||
subtitle = "${Build.MANUFACTURER} ${Build.MODEL} (${Build.DEVICE})",
|
title = "Model",
|
||||||
),
|
subtitle = "${Build.MANUFACTURER} ${Build.MODEL} (${Build.DEVICE})",
|
||||||
)
|
),
|
||||||
|
|
||||||
if (DeviceUtil.oneUiVersion != null) {
|
|
||||||
items += Preference.PreferenceItem.TextPreference(
|
|
||||||
title = "OneUI version",
|
|
||||||
subtitle = "${DeviceUtil.oneUiVersion}",
|
|
||||||
)
|
)
|
||||||
} else if (DeviceUtil.miuiMajorVersion != null) {
|
|
||||||
items += Preference.PreferenceItem.TextPreference(
|
if (DeviceUtil.oneUiVersion != null) {
|
||||||
title = "MIUI version",
|
add(
|
||||||
subtitle = "${DeviceUtil.miuiMajorVersion}",
|
Preference.PreferenceItem.TextPreference(
|
||||||
|
title = "OneUI version",
|
||||||
|
subtitle = "${DeviceUtil.oneUiVersion}",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
} else if (DeviceUtil.miuiMajorVersion != null) {
|
||||||
|
add(
|
||||||
|
Preference.PreferenceItem.TextPreference(
|
||||||
|
title = "MIUI version",
|
||||||
|
subtitle = "${DeviceUtil.miuiMajorVersion}",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val androidVersion = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
Build.VERSION.RELEASE_OR_PREVIEW_DISPLAY
|
||||||
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
Build.VERSION.RELEASE_OR_CODENAME
|
||||||
|
} else {
|
||||||
|
Build.VERSION.RELEASE
|
||||||
|
}
|
||||||
|
add(
|
||||||
|
Preference.PreferenceItem.TextPreference(
|
||||||
|
title = "Android version",
|
||||||
|
subtitle = "$androidVersion (${Build.DISPLAY})",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val androidVersion = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
Build.VERSION.RELEASE_OR_PREVIEW_DISPLAY
|
|
||||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
||||||
Build.VERSION.RELEASE_OR_CODENAME
|
|
||||||
} else {
|
|
||||||
Build.VERSION.RELEASE
|
|
||||||
}
|
|
||||||
items += Preference.PreferenceItem.TextPreference(
|
|
||||||
title = "Android version",
|
|
||||||
subtitle = "$androidVersion (${Build.DISPLAY})",
|
|
||||||
)
|
|
||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = "Device info",
|
title = "Device info",
|
||||||
preferenceItems = items,
|
preferenceItems = items,
|
||||||
|
|
Loading…
Reference in a new issue