|
|
|
@ -177,28 +177,6 @@ class SettingsLibraryScreen : SearchableSettings {
|
|
|
|
|
|
|
|
|
|
val libraryUpdateInterval by libraryUpdateIntervalPref.collectAsState()
|
|
|
|
|
|
|
|
|
|
val deviceRestrictionEntries = mapOf(
|
|
|
|
|
DEVICE_ONLY_ON_WIFI to stringResource(R.string.connected_to_wifi),
|
|
|
|
|
DEVICE_NETWORK_NOT_METERED to stringResource(R.string.network_not_metered),
|
|
|
|
|
DEVICE_CHARGING to stringResource(R.string.charging),
|
|
|
|
|
DEVICE_BATTERY_NOT_LOW to stringResource(R.string.battery_not_low),
|
|
|
|
|
)
|
|
|
|
|
val deviceRestrictions = libraryUpdateDeviceRestrictionPref.collectAsState()
|
|
|
|
|
.value
|
|
|
|
|
.sorted()
|
|
|
|
|
.map { deviceRestrictionEntries.getOrElse(it) { it } }
|
|
|
|
|
.let { if (it.isEmpty()) stringResource(R.string.none) else it.joinToString() }
|
|
|
|
|
|
|
|
|
|
val mangaRestrictionEntries = mapOf(
|
|
|
|
|
MANGA_HAS_UNREAD to stringResource(R.string.pref_update_only_completely_read),
|
|
|
|
|
MANGA_NON_READ to stringResource(R.string.pref_update_only_started),
|
|
|
|
|
MANGA_NON_COMPLETED to stringResource(R.string.pref_update_only_non_completed),
|
|
|
|
|
)
|
|
|
|
|
val mangaRestrictions = libraryUpdateMangaRestrictionPref.collectAsState()
|
|
|
|
|
.value
|
|
|
|
|
.map { mangaRestrictionEntries.getOrElse(it) { it } }
|
|
|
|
|
.let { if (it.isEmpty()) stringResource(R.string.none) else it.joinToString() }
|
|
|
|
|
|
|
|
|
|
val included by libraryUpdateCategoriesPref.collectAsState()
|
|
|
|
|
val excluded by libraryUpdateCategoriesExcludePref.collectAsState()
|
|
|
|
|
var showDialog by rememberSaveable { mutableStateOf(false) }
|
|
|
|
@ -224,7 +202,6 @@ class SettingsLibraryScreen : SearchableSettings {
|
|
|
|
|
Preference.PreferenceItem.ListPreference(
|
|
|
|
|
pref = libraryUpdateIntervalPref,
|
|
|
|
|
title = stringResource(R.string.pref_library_update_interval),
|
|
|
|
|
subtitle = "%s",
|
|
|
|
|
entries = mapOf(
|
|
|
|
|
0 to stringResource(R.string.update_never),
|
|
|
|
|
12 to stringResource(R.string.update_12hour),
|
|
|
|
@ -242,8 +219,13 @@ class SettingsLibraryScreen : SearchableSettings {
|
|
|
|
|
pref = libraryUpdateDeviceRestrictionPref,
|
|
|
|
|
enabled = libraryUpdateInterval > 0,
|
|
|
|
|
title = stringResource(R.string.pref_library_update_restriction),
|
|
|
|
|
subtitle = stringResource(R.string.restrictions, deviceRestrictions),
|
|
|
|
|
entries = deviceRestrictionEntries,
|
|
|
|
|
subtitle = stringResource(R.string.restrictions),
|
|
|
|
|
entries = mapOf(
|
|
|
|
|
DEVICE_ONLY_ON_WIFI to stringResource(R.string.connected_to_wifi),
|
|
|
|
|
DEVICE_NETWORK_NOT_METERED to stringResource(R.string.network_not_metered),
|
|
|
|
|
DEVICE_CHARGING to stringResource(R.string.charging),
|
|
|
|
|
DEVICE_BATTERY_NOT_LOW to stringResource(R.string.battery_not_low),
|
|
|
|
|
),
|
|
|
|
|
onValueChanged = {
|
|
|
|
|
// Post to event looper to allow the preference to be updated.
|
|
|
|
|
ContextCompat.getMainExecutor(context).execute { LibraryUpdateJob.setupTask(context) }
|
|
|
|
@ -253,8 +235,11 @@ class SettingsLibraryScreen : SearchableSettings {
|
|
|
|
|
Preference.PreferenceItem.MultiSelectListPreference(
|
|
|
|
|
pref = libraryUpdateMangaRestrictionPref,
|
|
|
|
|
title = stringResource(R.string.pref_library_update_manga_restriction),
|
|
|
|
|
subtitle = mangaRestrictions,
|
|
|
|
|
entries = mangaRestrictionEntries,
|
|
|
|
|
entries = mapOf(
|
|
|
|
|
MANGA_HAS_UNREAD to stringResource(R.string.pref_update_only_completely_read),
|
|
|
|
|
MANGA_NON_READ to stringResource(R.string.pref_update_only_started),
|
|
|
|
|
MANGA_NON_COMPLETED to stringResource(R.string.pref_update_only_non_completed),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Preference.PreferenceItem.TextPreference(
|
|
|
|
|
title = stringResource(R.string.categories),
|
|
|
|
|