From 99225a11db1031eaab292ac5350fa7334f4c2b29 Mon Sep 17 00:00:00 2001 From: Jonas Kalderstam Date: Thu, 18 Apr 2024 21:43:58 +0200 Subject: [PATCH] Fixed deprecation warnings --- .../ui/compose/editfeed/EditFeedScreen.kt | 14 +- .../feeder/ui/compose/feed/FeedScreen.kt | 14 +- .../ui/compose/feedarticle/ArticleScreen.kt | 7 +- .../ui/compose/ompl/OpmlImportScreen.kt | 4 +- .../ui/compose/readaloud/ReadAloudPlayer.kt | 4 +- .../ui/compose/searchfeed/SearchFeedScreen.kt | 4 +- .../feeder/ui/compose/settings/Settings.kt | 610 +++++++++--------- .../feeder/ui/compose/sync/SyncScreen.kt | 4 +- 8 files changed, 330 insertions(+), 331 deletions(-) diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/editfeed/EditFeedScreen.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/editfeed/EditFeedScreen.kt index 8def9d0d7..4507d1124 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/editfeed/EditFeedScreen.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/editfeed/EditFeedScreen.kt @@ -22,9 +22,9 @@ import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack -import androidx.compose.material3.Divider +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -216,7 +216,7 @@ fun EditFeedScreen( navigationIcon = { IconButton(onClick = onNavigateUp) { Icon( - Icons.Default.ArrowBack, + Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.go_back), ) } @@ -310,9 +310,7 @@ fun EditFeedView( rightFocusRequester = rightFocusRequester, ) - Divider( - modifier = Modifier.fillMaxWidth(), - ) + HorizontalDivider(modifier = Modifier.fillMaxWidth()) RightContent( viewState = viewState, @@ -516,9 +514,7 @@ fun ColumnScope.RightContent( description = stringResource(id = R.string.only_enable_for_bad_id_feeds), icon = null, ) { viewState.alternateId = it } - Divider( - modifier = Modifier.fillMaxWidth(), - ) + HorizontalDivider(modifier = Modifier.fillMaxWidth()) GroupTitle( startingSpace = false, height = 48.dp, diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feed/FeedScreen.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feed/FeedScreen.kt index 2cbbb4f21..222ea7a59 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feed/FeedScreen.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feed/FeedScreen.kt @@ -53,11 +53,11 @@ import androidx.compose.material.icons.filled.Menu import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.Refresh import androidx.compose.material.icons.filled.Settings -import androidx.compose.material3.Divider import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -683,7 +683,7 @@ fun FeedScreen( Text(stringResource(id = R.string.mark_all_as_read)) }, ) - Divider() + HorizontalDivider() DropdownMenuItem( onClick = { onRefreshAll() @@ -699,7 +699,7 @@ fun FeedScreen( Text(stringResource(id = R.string.synchronize_feeds)) }, ) - Divider() + HorizontalDivider() DropdownMenuItem( onClick = { onShowToolbarMenu(false) @@ -749,7 +749,7 @@ fun FeedScreen( Text(stringResource(id = R.string.delete_feed)) }, ) - Divider() + HorizontalDivider() DropdownMenuItem( onClick = { onShowToolbarMenu(false) @@ -795,7 +795,7 @@ fun FeedScreen( Text(stringResource(id = R.string.export_saved_articles)) }, ) - Divider() + HorizontalDivider() DropdownMenuItem( onClick = { onShowToolbarMenu(false) @@ -811,7 +811,7 @@ fun FeedScreen( Text(stringResource(id = R.string.action_settings)) }, ) - Divider() + HorizontalDivider() DropdownMenuItem( onClick = { onShowToolbarMenu(false) @@ -1280,7 +1280,7 @@ fun FeedListContent( viewState.feedItemStyle != FeedItemStyle.COMPACT_CARD ) { if (itemIndex < pagedFeedItems.itemCount - 1) { - Divider( + HorizontalDivider( modifier = Modifier .height(1.dp) diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt index 6d63171de..a875655fc 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt @@ -20,7 +20,8 @@ import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.Article import androidx.compose.material.icons.filled.Article import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.OpenInBrowser @@ -220,7 +221,7 @@ fun ArticleScreen( navigationIcon = { IconButton(onClick = onNavigateUp) { Icon( - Icons.Default.ArrowBack, + Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.go_back), ) } @@ -231,7 +232,7 @@ fun ArticleScreen( onClick = onToggleFullText, ) { Icon( - Icons.Default.Article, + Icons.AutoMirrored.Filled.Article, contentDescription = stringResource(R.string.fetch_full_article), ) } diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/ompl/OpmlImportScreen.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/ompl/OpmlImportScreen.kt index b6aa740dc..3b6ad4732 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/ompl/OpmlImportScreen.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/ompl/OpmlImportScreen.kt @@ -17,7 +17,7 @@ import androidx.compose.foundation.layout.statusBars import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -166,7 +166,7 @@ fun OpmlImportScreen( navigationIcon = { IconButton(onClick = onNavigateUp) { Icon( - Icons.Default.ArrowBack, + Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.go_back), ) } diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/readaloud/ReadAloudPlayer.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/readaloud/ReadAloudPlayer.kt index 24962bf72..507f65a6a 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/readaloud/ReadAloudPlayer.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/readaloud/ReadAloudPlayer.kt @@ -16,11 +16,11 @@ import androidx.compose.material.icons.filled.PlayArrow import androidx.compose.material.icons.filled.SkipNext import androidx.compose.material.icons.filled.Stop import androidx.compose.material.icons.filled.Translate -import androidx.compose.material3.Divider import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Text @@ -203,7 +203,7 @@ fun TTSPlayer( }, ) } - Divider() + HorizontalDivider() for (lang in languages.item) { DropdownMenuItem( onClick = { diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/searchfeed/SearchFeedScreen.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/searchfeed/SearchFeedScreen.kt index dba606275..12b6806da 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/searchfeed/SearchFeedScreen.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/searchfeed/SearchFeedScreen.kt @@ -23,7 +23,7 @@ import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material3.Card import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.ExperimentalMaterial3Api @@ -131,7 +131,7 @@ fun SearchFeedScreen( navigationIcon = { IconButton(onClick = onNavigateUp) { Icon( - Icons.Default.ArrowBack, + Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.go_back), ) } diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/settings/Settings.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/settings/Settings.kt index fddce10ef..06eeb1ca8 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/settings/Settings.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/settings/Settings.kt @@ -28,11 +28,11 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material.ContentAlpha import androidx.compose.material.LocalContentAlpha import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack -import androidx.compose.material3.Divider +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -110,7 +110,7 @@ fun SettingsScreen( onNavigateUp: () -> Unit, onNavigateToSyncScreen: () -> Unit, settingsViewModel: SettingsViewModel, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val viewState by settingsViewModel.viewState.collectAsStateWithLifecycle() @@ -122,9 +122,9 @@ fun SettingsScreen( Scaffold( modifier = - modifier - .nestedScroll(scrollBehavior.nestedScrollConnection) - .windowInsetsPadding(WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal)), + modifier + .nestedScroll(scrollBehavior.nestedScrollConnection) + .windowInsetsPadding(WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal)), contentWindowInsets = WindowInsets.statusBars, topBar = { SensibleTopAppBar( @@ -133,13 +133,13 @@ fun SettingsScreen( navigationIcon = { IconButton(onClick = onNavigateUp) { Icon( - Icons.Default.ArrowBack, - contentDescription = stringResource(R.string.go_back) + Icons.AutoMirrored.Filled.ArrowBack, + contentDescription = stringResource(R.string.go_back), ) } - } + }, ) - } + }, ) { padding -> SettingsList( currentThemeValue = viewState.currentTheme.asThemeOption(), @@ -204,7 +204,7 @@ fun SettingsScreen( onStartActivity = { intent -> activityLauncher.startActivity(false, intent) }, - modifier = Modifier.padding(padding) + modifier = Modifier.padding(padding), ) } } @@ -269,7 +269,7 @@ private fun SettingsScreenPreview() { showReadingTime = false, onShowReadingTimeChanged = {}, onStartActivity = {}, - modifier = Modifier + modifier = Modifier, ) } } @@ -330,105 +330,107 @@ fun SettingsList( showReadingTime: Boolean, onShowReadingTimeChanged: (Boolean) -> Unit, onStartActivity: (intent: Intent) -> Unit, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val scrollState = rememberScrollState() val dimens = LocalDimens.current - val isAndroidQAndAbove = remember { - Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q - } - val isAndroidSAndAbove = remember { - Build.VERSION.SDK_INT >= Build.VERSION_CODES.S - } + val isAndroidQAndAbove = + remember { + Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q + } + val isAndroidSAndAbove = + remember { + Build.VERSION.SDK_INT >= Build.VERSION_CODES.S + } Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = - modifier - .padding(horizontal = dimens.margin) - .fillMaxWidth() - .verticalScroll(scrollState) + modifier + .padding(horizontal = dimens.margin) + .fillMaxWidth() + .verticalScroll(scrollState), ) { MenuSetting( currentValue = currentThemeValue, values = - immutableListHolderOf( - ThemeOptions.SYSTEM.asThemeOption(), - ThemeOptions.DAY.asThemeOption(), - ThemeOptions.NIGHT.asThemeOption(), - ThemeOptions.E_INK.asThemeOption() - ), + immutableListHolderOf( + ThemeOptions.SYSTEM.asThemeOption(), + ThemeOptions.DAY.asThemeOption(), + ThemeOptions.NIGHT.asThemeOption(), + ThemeOptions.E_INK.asThemeOption(), + ), title = stringResource(id = R.string.theme), - onSelection = onThemeChanged + onSelection = onThemeChanged, ) SwitchSetting( title = stringResource(id = R.string.dynamic_theme_use), checked = useDynamicTheme, description = - when { - isAndroidSAndAbove -> { - null - } + when { + isAndroidSAndAbove -> { + null + } - else -> { - stringResource( - id = R.string.only_available_on_android_n, - "12" - ) - } - }, + else -> { + stringResource( + id = R.string.only_available_on_android_n, + "12", + ) + } + }, enabled = isAndroidSAndAbove, - onCheckedChanged = onUseDynamicTheme + onCheckedChanged = onUseDynamicTheme, ) MenuSetting( title = stringResource(id = R.string.dark_theme_preference), currentValue = currentDarkThemePreference, values = - immutableListHolderOf( - DarkThemePreferences.BLACK.asDarkThemeOption(), - DarkThemePreferences.DARK.asDarkThemeOption() - ), - onSelection = onDarkThemePreferenceChanged + immutableListHolderOf( + DarkThemePreferences.BLACK.asDarkThemeOption(), + DarkThemePreferences.DARK.asDarkThemeOption(), + ), + onSelection = onDarkThemePreferenceChanged, ) ListDialogSetting( title = stringResource(id = R.string.block_list), dialogTitle = { Column( - verticalArrangement = Arrangement.spacedBy(8.dp) + verticalArrangement = Arrangement.spacedBy(8.dp), ) { Text( text = stringResource(id = R.string.block_list), - style = MaterialTheme.typography.titleLarge + style = MaterialTheme.typography.titleLarge, ) Text( text = stringResource(id = R.string.block_list_description), - style = MaterialTheme.typography.bodyMedium + style = MaterialTheme.typography.bodyMedium, ) Text( text = "feeder feed?r fe*er", - style = MaterialTheme.typography.bodySmall.copy(fontFamily = FontFamily.Monospace) + style = MaterialTheme.typography.bodySmall.copy(fontFamily = FontFamily.Monospace), ) } }, currentValue = blockListValue, onAddItem = onBlockListAdd, - onRemoveItem = onBlockListRemove + onRemoveItem = onBlockListRemove, ) NotificationsSetting( items = feedsSettings, - onToggleItem = onToggleNotification + onToggleItem = onToggleNotification, ) - Divider(modifier = Modifier.width(dimens.maxContentWidth)) + HorizontalDivider(modifier = Modifier.width(dimens.maxContentWidth)) GroupTitle { innerModifier -> Text( stringResource(id = R.string.text_scale), - modifier = innerModifier + modifier = innerModifier, ) } @@ -436,106 +438,106 @@ fun SettingsList( currentValue = textScale, onValueChange = setTextScale, valueRange = 1f..2f, - steps = 9 + steps = 9, ) - Divider(modifier = Modifier.width(dimens.maxContentWidth)) + HorizontalDivider(modifier = Modifier.width(dimens.maxContentWidth)) GroupTitle { innerModifier -> Text( stringResource(id = R.string.synchronization), - modifier = innerModifier + modifier = innerModifier, ) } MenuSetting( currentValue = currentSyncFrequencyValue.asSyncFreqOption(), values = - ImmutableHolder( - SyncFrequency.values().map { - it.asSyncFreqOption() - } - ), + ImmutableHolder( + SyncFrequency.values().map { + it.asSyncFreqOption() + }, + ), title = stringResource(id = R.string.check_for_updates), onSelection = { onSyncFrequencyChanged(it.syncFrequency) - } + }, ) SwitchSetting( title = stringResource(id = R.string.on_startup), checked = syncOnStartupValue, - onCheckedChanged = onSyncOnStartupChanged + onCheckedChanged = onSyncOnStartupChanged, ) SwitchSetting( title = stringResource(id = R.string.only_on_wifi), checked = syncOnlyOnWifiValue, - onCheckedChanged = onSyncOnlyOnWifiChanged + onCheckedChanged = onSyncOnlyOnWifiChanged, ) SwitchSetting( title = stringResource(id = R.string.only_when_charging), checked = syncOnlyWhenChargingValue, - onCheckedChanged = onSyncOnlyWhenChargingChanged + onCheckedChanged = onSyncOnlyWhenChargingChanged, ) MenuSetting( currentValue = maxItemsPerFeedValue, values = - immutableListHolderOf( - 50, - 100, - 200, - 500, - 1000 - ), + immutableListHolderOf( + 50, + 100, + 200, + 500, + 1000, + ), title = stringResource(id = R.string.max_feed_items), - onSelection = onMaxItemsPerFeedChanged + onSelection = onMaxItemsPerFeedChanged, ) ExternalSetting( currentValue = - when (batteryOptimizationIgnoredValue) { - true -> stringResource(id = R.string.battery_optimization_disabled) - false -> stringResource(id = R.string.battery_optimization_enabled) - }, - title = stringResource(id = R.string.battery_optimization) + when (batteryOptimizationIgnoredValue) { + true -> stringResource(id = R.string.battery_optimization_disabled) + false -> stringResource(id = R.string.battery_optimization_enabled) + }, + title = stringResource(id = R.string.battery_optimization), ) { onStartActivity(Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS)) } ExternalSetting( currentValue = "", - title = stringResource(id = R.string.device_sync) + title = stringResource(id = R.string.device_sync), ) { onOpenSyncSettings() } - Divider(modifier = Modifier.width(dimens.maxContentWidth)) + HorizontalDivider(modifier = Modifier.width(dimens.maxContentWidth)) GroupTitle { innerModifier -> Text( stringResource(id = R.string.article_list_settings), - modifier = innerModifier + modifier = innerModifier, ) } MenuSetting( currentValue = currentSortingValue, values = - immutableListHolderOf( - SortingOptions.NEWEST_FIRST.asSortOption(), - SortingOptions.OLDEST_FIRST.asSortOption() - ), + immutableListHolderOf( + SortingOptions.NEWEST_FIRST.asSortOption(), + SortingOptions.OLDEST_FIRST.asSortOption(), + ), title = stringResource(id = R.string.sort), - onSelection = onSortingChanged + onSelection = onSortingChanged, ) SwitchSetting( title = stringResource(id = R.string.show_fab), checked = showFabValue, - onCheckedChanged = onShowFabChanged + onCheckedChanged = onShowFabChanged, ) if (isCompactDevice()) { @@ -545,7 +547,7 @@ fun SettingsList( values = ImmutableHolder(FeedItemStyle.values().map { it.asFeedItemStyleOption() }), onSelection = { onFeedItemStyleChanged(it.feedItemStyle) - } + }, ) } @@ -553,13 +555,13 @@ fun SettingsList( title = stringResource(id = R.string.max_lines), currentValue = maxLines, values = ImmutableHolder(listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)), - onSelection = setMaxLines + onSelection = setMaxLines, ) SwitchSetting( title = stringResource(id = R.string.show_only_title), checked = showOnlyTitle, - onCheckedChanged = onShowOnlyTitle + onCheckedChanged = onShowOnlyTitle, ) MenuSetting( @@ -568,61 +570,61 @@ fun SettingsList( values = ImmutableHolder(SwipeAsRead.values().map { it.asSwipeAsReadOption() }), onSelection = { onSwipeAsReadOptionChanged(it.swipeAsRead) - } + }, ) SwitchSetting( title = stringResource(id = R.string.mark_as_read_on_scroll), checked = isMarkAsReadOnScroll, - onCheckedChanged = onMarkAsReadOnScroll + onCheckedChanged = onMarkAsReadOnScroll, ) SwitchSetting( title = stringResource(id = R.string.show_thumbnails), checked = showThumbnailsValue, - onCheckedChanged = onShowThumbnailsChanged + onCheckedChanged = onShowThumbnailsChanged, ) SwitchSetting( title = stringResource(id = R.string.show_reading_time), checked = showReadingTime, - onCheckedChanged = onShowReadingTimeChanged + onCheckedChanged = onShowReadingTimeChanged, ) - Divider(modifier = Modifier.width(dimens.maxContentWidth)) + HorizontalDivider(modifier = Modifier.width(dimens.maxContentWidth)) GroupTitle { innerModifier -> Text( stringResource(id = R.string.reader_settings), - modifier = innerModifier + modifier = innerModifier, ) } MenuSetting( currentValue = currentItemOpenerValue.asItemOpenerOption(), values = - immutableListHolderOf( - ItemOpener.READER.asItemOpenerOption(), - ItemOpener.CUSTOM_TAB.asItemOpenerOption(), - ItemOpener.DEFAULT_BROWSER.asItemOpenerOption() - ), + immutableListHolderOf( + ItemOpener.READER.asItemOpenerOption(), + ItemOpener.CUSTOM_TAB.asItemOpenerOption(), + ItemOpener.DEFAULT_BROWSER.asItemOpenerOption(), + ), title = stringResource(id = R.string.open_item_by_default_with), onSelection = { onItemOpenerChanged(it.itemOpener) - } + }, ) MenuSetting( currentValue = currentLinkOpenerValue.asLinkOpenerOption(), values = - immutableListHolderOf( - LinkOpener.CUSTOM_TAB.asLinkOpenerOption(), - LinkOpener.DEFAULT_BROWSER.asLinkOpenerOption() - ), + immutableListHolderOf( + LinkOpener.CUSTOM_TAB.asLinkOpenerOption(), + LinkOpener.DEFAULT_BROWSER.asLinkOpenerOption(), + ), title = stringResource(id = R.string.open_links_with), onSelection = { onLinkOpenerChanged(it.linkOpener) - } + }, ) val notCompactScreen = LocalConfiguration.current.smallestScreenWidthDp >= 600 @@ -631,31 +633,31 @@ fun SettingsList( SwitchSetting( title = stringResource(id = R.string.open_browser_in_split_screen), checked = isOpenAdjacent, - onCheckedChanged = onOpenAdjacent + onCheckedChanged = onOpenAdjacent, ) } - Divider(modifier = Modifier.width(dimens.maxContentWidth)) + HorizontalDivider(modifier = Modifier.width(dimens.maxContentWidth)) GroupTitle { innerModifier -> Text( stringResource(id = R.string.image_loading), - modifier = innerModifier + modifier = innerModifier, ) } SwitchSetting( title = stringResource(id = R.string.only_on_wifi), checked = loadImageOnlyOnWifiValue, - onCheckedChanged = onLoadImageOnlyOnWifiChanged + onCheckedChanged = onLoadImageOnlyOnWifiChanged, ) - Divider(modifier = Modifier.width(dimens.maxContentWidth)) + HorizontalDivider(modifier = Modifier.width(dimens.maxContentWidth)) GroupTitle { innerModifier -> Text( stringResource(id = R.string.text_to_speech), - modifier = innerModifier + modifier = innerModifier, ) } @@ -663,16 +665,16 @@ fun SettingsList( title = stringResource(id = R.string.use_detect_language), checked = useDetectLanguage, description = - when { - isAndroidQAndAbove -> stringResource(id = R.string.description_for_read_aloud) - else -> - stringResource( - id = R.string.only_available_on_android_n, - "10" - ) - }, + when { + isAndroidQAndAbove -> stringResource(id = R.string.description_for_read_aloud) + else -> + stringResource( + id = R.string.only_available_on_android_n, + "10", + ) + }, enabled = isAndroidQAndAbove, - onCheckedChanged = onUseDetectLanguageChanged + onCheckedChanged = onUseDetectLanguageChanged, ) Spacer(modifier = Modifier.navigationBarsPadding()) @@ -684,34 +686,34 @@ fun GroupTitle( modifier: Modifier = Modifier, startingSpace: Boolean = true, height: Dp = 64.dp, - title: @Composable (Modifier) -> Unit + title: @Composable (Modifier) -> Unit, ) { val dimens = LocalDimens.current Row( modifier = - modifier - .width(dimens.maxContentWidth), - verticalAlignment = Alignment.CenterVertically + modifier + .width(dimens.maxContentWidth), + verticalAlignment = Alignment.CenterVertically, ) { if (startingSpace) { Box( modifier = - Modifier - .width(64.dp) - .height(height) + Modifier + .width(64.dp) + .height(height), ) } Box( modifier = - Modifier - .height(height), - contentAlignment = Alignment.CenterStart + Modifier + .height(height), + contentAlignment = Alignment.CenterStart, ) { ProvideTextStyle( value = - MaterialTheme.typography.labelMedium.merge( - TextStyle(color = MaterialTheme.colorScheme.primary) - ) + MaterialTheme.typography.labelMedium.merge( + TextStyle(color = MaterialTheme.colorScheme.primary), + ), ) { title(Modifier.semantics { heading() }) } @@ -725,22 +727,22 @@ fun ExternalSetting( title: String, modifier: Modifier = Modifier, icon: @Composable () -> Unit = {}, - onClick: () -> Unit + onClick: () -> Unit, ) { val dimens = LocalDimens.current Row( modifier = - modifier - .width(dimens.maxContentWidth) - .clickable { onClick() } - .semantics { - role = Role.Button - }, - verticalAlignment = Alignment.CenterVertically + modifier + .width(dimens.maxContentWidth) + .clickable { onClick() } + .semantics { + role = Role.Button + }, + verticalAlignment = Alignment.CenterVertically, ) { Box( modifier = Modifier.size(64.dp), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { icon() @@ -753,7 +755,7 @@ fun ExternalSetting( }, subtitle = { Text(currentValue) - } + }, ) } } @@ -765,24 +767,24 @@ fun MenuSetting( values: ImmutableHolder>, modifier: Modifier = Modifier, icon: @Composable () -> Unit = {}, - onSelection: (T) -> Unit + onSelection: (T) -> Unit, ) { var expanded by rememberSaveable { mutableStateOf(false) } val dimens = LocalDimens.current val closeMenuText = stringResource(id = R.string.close_menu) Row( modifier = - modifier - .width(dimens.maxContentWidth) - .clickable { expanded = !expanded } - .semantics { - role = Role.Button - }, - verticalAlignment = Alignment.CenterVertically + modifier + .width(dimens.maxContentWidth) + .clickable { expanded = !expanded } + .semantics { + role = Role.Button + }, + verticalAlignment = Alignment.CenterVertically, ) { Box( modifier = Modifier.size(64.dp), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { icon() @@ -795,16 +797,16 @@ fun MenuSetting( }, subtitle = { Text(currentValue.toString()) - } + }, ) DropdownMenu( expanded = expanded, onDismissRequest = { expanded = false }, modifier = - Modifier.onKeyEventLikeEscape { - expanded = false - } + Modifier.onKeyEventLikeEscape { + expanded = false + }, ) { // Hidden button for TalkBack DropdownMenuItem( @@ -813,12 +815,12 @@ fun MenuSetting( }, text = {}, modifier = - Modifier - .height(0.dp) - .safeSemantics { - contentDescription = closeMenuText - role = Role.Button - } + Modifier + .height(0.dp) + .safeSemantics { + contentDescription = closeMenuText + role = Role.Button + }, ) for (value in values.item) { DropdownMenuItem( @@ -832,17 +834,17 @@ fun MenuSetting( MaterialTheme.typography.bodyLarge.merge( TextStyle( fontWeight = FontWeight.Bold, - color = MaterialTheme.colorScheme.secondary - ) + color = MaterialTheme.colorScheme.secondary, + ), ) } else { MaterialTheme.typography.bodyLarge } Text( value.toString(), - style = style + style = style, ) - } + }, ) } } @@ -857,23 +859,23 @@ fun ListDialogSetting( onAddItem: (String) -> Unit, modifier: Modifier = Modifier, icon: @Composable () -> Unit = {}, - onRemoveItem: (String) -> Unit + onRemoveItem: (String) -> Unit, ) { var expanded by rememberSaveable { mutableStateOf(false) } val dimens = LocalDimens.current Row( modifier = - modifier - .width(dimens.maxContentWidth) - .clickable { expanded = !expanded } - .semantics { - role = Role.Button - }, - verticalAlignment = Alignment.CenterVertically + modifier + .width(dimens.maxContentWidth) + .clickable { expanded = !expanded } + .semantics { + role = Role.Button + }, + verticalAlignment = Alignment.CenterVertically, ) { Box( modifier = Modifier.size(64.dp), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { icon() @@ -888,9 +890,9 @@ fun ListDialogSetting( Text( text = currentValue.item.joinToString(" ", limit = 5), overflow = TextOverflow.Ellipsis, - maxLines = 1 + maxLines = 1, ) - } + }, ) if (expanded) { @@ -901,7 +903,7 @@ fun ListDialogSetting( expanded = false }, onAddItem = onAddItem, - onRemoveItem = onRemoveItem + onRemoveItem = onRemoveItem, ) } } @@ -913,14 +915,14 @@ fun NotificationsSetting( items: ImmutableHolder>, onToggleItem: (Long, Boolean) -> Unit, modifier: Modifier = Modifier, - icon: @Composable () -> Unit = {} + icon: @Composable () -> Unit = {}, ) { var expanded by rememberSaveable { mutableStateOf(false) } val notificationsPermissionState = rememberApiPermissionState( permission = "android.permission.POST_NOTIFICATIONS", - minimumApiLevel = 33 + minimumApiLevel = 33, ) { value -> expanded = value } @@ -944,29 +946,29 @@ fun NotificationsSetting( val dimens = LocalDimens.current Row( modifier = - modifier - .width(dimens.maxContentWidth) - .clickable { - when (notificationsPermissionState.status) { - is PermissionStatus.Denied -> { - if (notificationsPermissionState.status.shouldShowRationale) { - permissionDismissed = false - } else { - notificationsPermissionState.launchPermissionRequest() + modifier + .width(dimens.maxContentWidth) + .clickable { + when (notificationsPermissionState.status) { + is PermissionStatus.Denied -> { + if (notificationsPermissionState.status.shouldShowRationale) { + permissionDismissed = false + } else { + notificationsPermissionState.launchPermissionRequest() + } } - } - PermissionStatus.Granted -> expanded = true + PermissionStatus.Granted -> expanded = true + } } - } - .semantics { - role = Role.Button - }, - verticalAlignment = Alignment.CenterVertically + .semantics { + role = Role.Button + }, + verticalAlignment = Alignment.CenterVertically, ) { Box( modifier = Modifier.size(64.dp), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { icon() @@ -980,20 +982,20 @@ fun NotificationsSetting( subtitle = { Text( text = - when (permissionDenied) { - true -> stringResource(id = R.string.explanation_permission_notifications) - false -> { - items.item.asSequence() - .filter { it.notify } - .map { it.title } - .take(4) - .joinToString(", ", limit = 3) - } - }, + when (permissionDenied) { + true -> stringResource(id = R.string.explanation_permission_notifications) + false -> { + items.item.asSequence() + .filter { it.notify } + .map { it.title } + .take(4) + .joinToString(", ", limit = 3) + } + }, overflow = TextOverflow.Ellipsis, - maxLines = 1 + maxLines = 1, ) - } + }, ) if (shouldShowExplanationForPermission && !permissionDismissed) { @@ -1001,7 +1003,7 @@ fun NotificationsSetting( explanation = R.string.explanation_permission_notifications, onDismiss = { permissionDismissed = true - } + }, ) { notificationsPermissionState.launchPermissionRequest() } @@ -1010,14 +1012,14 @@ fun NotificationsSetting( title = { Text( text = stringResource(id = R.string.notify_for_new_items), - style = MaterialTheme.typography.titleLarge + style = MaterialTheme.typography.titleLarge, ) }, onToggleItem = onToggleItem, items = items, onDismiss = { expanded = false - } + }, ) } } @@ -1030,7 +1032,7 @@ fun RadioButtonSetting( modifier: Modifier = Modifier, icon: (@Composable () -> Unit)? = {}, minHeight: Dp = 64.dp, - onClick: () -> Unit + onClick: () -> Unit, ) { val stateLabel = if (selected) { @@ -1041,20 +1043,20 @@ fun RadioButtonSetting( val dimens = LocalDimens.current Row( modifier = - modifier - .width(dimens.maxContentWidth) - .heightIn(min = minHeight) - .clickable { onClick() } - .safeSemantics(mergeDescendants = true) { - role = Role.RadioButton - stateDescription = stateLabel - }, - verticalAlignment = Alignment.CenterVertically + modifier + .width(dimens.maxContentWidth) + .heightIn(min = minHeight) + .clickable { onClick() } + .safeSemantics(mergeDescendants = true) { + role = Role.RadioButton + stateDescription = stateLabel + }, + verticalAlignment = Alignment.CenterVertically, ) { if (icon != null) { Box( modifier = Modifier.size(64.dp), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { icon() @@ -1065,7 +1067,7 @@ fun RadioButtonSetting( TitleAndSubtitle( title = { Text(title) - } + }, ) Spacer(modifier = Modifier.width(8.dp)) @@ -1073,7 +1075,7 @@ fun RadioButtonSetting( RadioButton( selected = selected, onClick = onClick, - modifier = Modifier.clearAndSetSemantics { } + modifier = Modifier.clearAndSetSemantics { }, ) } } @@ -1086,33 +1088,33 @@ fun SwitchSetting( description: String? = null, icon: @Composable (() -> Unit)? = {}, enabled: Boolean = true, - onCheckedChanged: (Boolean) -> Unit + onCheckedChanged: (Boolean) -> Unit, ) { val context = LocalContext.current val dimens = LocalDimens.current Row( modifier = - modifier - .width(dimens.maxContentWidth) - .heightIn(min = 64.dp) - .clickable( - enabled = enabled, - onClick = { onCheckedChanged(!checked) } - ) - .safeSemantics(mergeDescendants = true) { - stateDescription = - when (checked) { - true -> context.getString(androidx.compose.ui.R.string.on) - else -> context.getString(androidx.compose.ui.R.string.off) - } - role = Role.Switch - }, - verticalAlignment = Alignment.CenterVertically + modifier + .width(dimens.maxContentWidth) + .heightIn(min = 64.dp) + .clickable( + enabled = enabled, + onClick = { onCheckedChanged(!checked) }, + ) + .safeSemantics(mergeDescendants = true) { + stateDescription = + when (checked) { + true -> context.getString(androidx.compose.ui.R.string.on) + else -> context.getString(androidx.compose.ui.R.string.off) + } + role = Role.Switch + }, + verticalAlignment = Alignment.CenterVertically, ) { if (icon != null) { Box( modifier = Modifier.size(64.dp), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { icon() @@ -1125,9 +1127,9 @@ fun SwitchSetting( Text(title) }, subtitle = - description?.let { - { Text(it) } - } + description?.let { + { Text(it) } + }, ) Spacer(modifier = Modifier.width(8.dp)) @@ -1136,7 +1138,7 @@ fun SwitchSetting( checked = checked, onCheckedChange = onCheckedChanged, modifier = Modifier.clearAndSetSemantics { }, - enabled = enabled + enabled = enabled, ) } } @@ -1147,7 +1149,7 @@ fun ScaleSetting( onValueChange: (Float) -> Unit, valueRange: ClosedFloatingPointRange, steps: Int, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val dimens = LocalDimens.current val safeCurrentValue = currentValue.coerceIn(valueRange) @@ -1156,32 +1158,32 @@ fun ScaleSetting( Column( verticalArrangement = Arrangement.spacedBy(8.dp), modifier = - modifier - .width(dimens.maxContentWidth) - .heightIn(min = 64.dp) - .padding(start = 64.dp) - .safeSemantics(mergeDescendants = true) { - stateDescription = "%.1fx".format(safeCurrentValue) - } + modifier + .width(dimens.maxContentWidth) + .heightIn(min = 64.dp) + .padding(start = 64.dp) + .safeSemantics(mergeDescendants = true) { + stateDescription = "%.1fx".format(safeCurrentValue) + }, ) { Surface( modifier = - Modifier - .fillMaxWidth() - .padding(horizontal = 8.dp), - tonalElevation = 3.dp + Modifier + .fillMaxWidth() + .padding(horizontal = 8.dp), + tonalElevation = 3.dp, ) { Text( "Lorem ipsum dolor sit amet.", style = - MaterialTheme.typography.bodyLarge - .merge( - TextStyle( - color = MaterialTheme.colorScheme.onSurface, - fontSize = MaterialTheme.typography.bodyLarge.fontSize * currentValue - ) - ), - modifier = Modifier.padding(4.dp) + MaterialTheme.typography.bodyLarge + .merge( + TextStyle( + color = MaterialTheme.colorScheme.onSurface, + fontSize = MaterialTheme.typography.bodyLarge.fontSize * currentValue, + ), + ), + modifier = Modifier.padding(4.dp), ) } SliderWithEndLabels( @@ -1190,31 +1192,31 @@ fun ScaleSetting( Text( "A", style = - MaterialTheme.typography.bodyLarge - .merge( - TextStyle( - fontSize = MaterialTheme.typography.bodyLarge.fontSize * valueRange.start - ) - ), - modifier = Modifier.alignByBaseline() + MaterialTheme.typography.bodyLarge + .merge( + TextStyle( + fontSize = MaterialTheme.typography.bodyLarge.fontSize * valueRange.start, + ), + ), + modifier = Modifier.alignByBaseline(), ) }, endLabel = { Text( "A", style = - MaterialTheme.typography.bodyLarge - .merge( - TextStyle( - fontSize = MaterialTheme.typography.bodyLarge.fontSize * valueRange.endInclusive - ) - ), - modifier = Modifier.alignByBaseline() + MaterialTheme.typography.bodyLarge + .merge( + TextStyle( + fontSize = MaterialTheme.typography.bodyLarge.fontSize * valueRange.endInclusive, + ), + ), + modifier = Modifier.alignByBaseline(), ) }, valueRange = valueRange, steps = steps, - onValueChange = onValueChange + onValueChange = onValueChange, ) } } @@ -1222,11 +1224,11 @@ fun ScaleSetting( @Composable private fun RowScope.TitleAndSubtitle( title: @Composable () -> Unit, - subtitle: (@Composable () -> Unit)? = null + subtitle: (@Composable () -> Unit)? = null, ) { Column( modifier = Modifier.weight(1f), - verticalArrangement = Arrangement.Center + verticalArrangement = Arrangement.Center, ) { ProvideTextStyle(value = MaterialTheme.typography.titleMedium) { title() @@ -1244,13 +1246,13 @@ private fun RowScope.TitleAndSubtitle( fun ThemeOptions.asThemeOption() = ThemeOption( currentTheme = this, - name = stringResource(id = stringId) + name = stringResource(id = stringId), ) @Immutable data class ThemeOption( val currentTheme: ThemeOptions, - val name: String + val name: String, ) { override fun toString() = name } @@ -1259,13 +1261,13 @@ data class ThemeOption( fun DarkThemePreferences.asDarkThemeOption() = DarkThemeOption( darkThemePreferences = this, - name = stringResource(id = stringId) + name = stringResource(id = stringId), ) @Immutable data class DarkThemeOption( val darkThemePreferences: DarkThemePreferences, - val name: String + val name: String, ) { override fun toString() = name } @@ -1274,13 +1276,13 @@ data class DarkThemeOption( fun SortingOptions.asSortOption() = SortOption( currentSorting = this, - name = stringResource(id = stringId) + name = stringResource(id = stringId), ) @Immutable data class SortOption( val currentSorting: SortingOptions, - val name: String + val name: String, ) { override fun toString() = name } @@ -1288,7 +1290,7 @@ data class SortOption( @Immutable data class FeedItemStyleOption( val feedItemStyle: FeedItemStyle, - val name: String + val name: String, ) { override fun toString() = name } @@ -1296,7 +1298,7 @@ data class FeedItemStyleOption( @Immutable data class SwipeAsReadOption( val swipeAsRead: SwipeAsRead, - val name: String + val name: String, ) { override fun toString() = name } @@ -1304,7 +1306,7 @@ data class SwipeAsReadOption( @Immutable data class SyncFreqOption( val syncFrequency: SyncFrequency, - val name: String + val name: String, ) { override fun toString() = name } @@ -1313,13 +1315,13 @@ data class SyncFreqOption( fun SyncFrequency.asSyncFreqOption() = SyncFreqOption( syncFrequency = this, - name = stringResource(id = stringId) + name = stringResource(id = stringId), ) @Immutable data class ItemOpenerOption( val itemOpener: ItemOpener, - val name: String + val name: String, ) { override fun toString() = name } @@ -1328,13 +1330,13 @@ data class ItemOpenerOption( fun ItemOpener.asItemOpenerOption() = ItemOpenerOption( itemOpener = this, - name = stringResource(id = stringId) + name = stringResource(id = stringId), ) @Immutable data class LinkOpenerOption( val linkOpener: LinkOpener, - val name: String + val name: String, ) { override fun toString() = name } @@ -1343,19 +1345,19 @@ data class LinkOpenerOption( fun LinkOpener.asLinkOpenerOption() = LinkOpenerOption( linkOpener = this, - name = stringResource(id = stringId) + name = stringResource(id = stringId), ) @Composable fun FeedItemStyle.asFeedItemStyleOption() = FeedItemStyleOption( feedItemStyle = this, - name = stringResource(id = stringId) + name = stringResource(id = stringId), ) @Composable fun SwipeAsRead.asSwipeAsReadOption() = SwipeAsReadOption( swipeAsRead = this, - name = stringResource(id = stringId) + name = stringResource(id = stringId), ) diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/sync/SyncScreen.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/sync/SyncScreen.kt index f4223325f..6f30c69a8 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/sync/SyncScreen.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/sync/SyncScreen.kt @@ -33,7 +33,7 @@ import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material3.AlertDialog @@ -136,7 +136,7 @@ private fun SyncScaffold( navigationIcon = { IconButton(onClick = onNavigateUp) { Icon( - Icons.Default.ArrowBack, + Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.go_back), ) }