From 064d588b28c9ad38576e653ff3e8f87328383d6b Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Sun, 19 May 2024 22:31:38 +0200 Subject: [PATCH] Use adaptiveIconPainterResource to load mipmap icons in some places --- .../app/compose/account/AccountTab.kt | 3 +- .../compose/feeds/dialogs/AddFeedDialog.kt | 28 +++++++++---------- .../com/readrops/app/compose/more/MoreTab.kt | 3 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/appcompose/src/main/java/com/readrops/app/compose/account/AccountTab.kt b/appcompose/src/main/java/com/readrops/app/compose/account/AccountTab.kt index 8517fab4..da959ba5 100644 --- a/appcompose/src/main/java/com/readrops/app/compose/account/AccountTab.kt +++ b/appcompose/src/main/java/com/readrops/app/compose/account/AccountTab.kt @@ -48,6 +48,7 @@ import com.readrops.app.compose.R import com.readrops.app.compose.account.credentials.AccountCredentialsScreen import com.readrops.app.compose.account.selection.AccountSelectionDialog import com.readrops.app.compose.account.selection.AccountSelectionScreen +import com.readrops.app.compose.account.selection.adaptiveIconPainterResource import com.readrops.app.compose.timelime.ErrorListDialog import com.readrops.app.compose.util.components.ErrorDialog import com.readrops.app.compose.util.components.SelectableIconText @@ -256,7 +257,7 @@ object AccountTab : Tab { modifier = Modifier.fillMaxWidth() ) { Image( - painter = painterResource(id = R.drawable.ic_freshrss), + painter = adaptiveIconPainterResource(id = R.drawable.ic_freshrss), contentDescription = null, modifier = Modifier.size(48.dp) ) diff --git a/appcompose/src/main/java/com/readrops/app/compose/feeds/dialogs/AddFeedDialog.kt b/appcompose/src/main/java/com/readrops/app/compose/feeds/dialogs/AddFeedDialog.kt index e2fd83e8..16344c7d 100644 --- a/appcompose/src/main/java/com/readrops/app/compose/feeds/dialogs/AddFeedDialog.kt +++ b/appcompose/src/main/java/com/readrops/app/compose/feeds/dialogs/AddFeedDialog.kt @@ -1,5 +1,7 @@ package com.readrops.app.compose.feeds.dialogs +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Clear import androidx.compose.material3.DropdownMenuItem @@ -19,8 +21,10 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.readrops.app.compose.R +import com.readrops.app.compose.account.selection.adaptiveIconPainterResource import com.readrops.app.compose.feeds.FeedScreenModel import com.readrops.app.compose.util.components.BaseDialog import com.readrops.app.compose.util.theme.LargeSpacer @@ -82,14 +86,12 @@ fun AddFeedDialog( viewModel.setAddFeedDialogSelectedAccount(account) }, leadingIcon = { - Icon( - painter = painterResource( - id = if (state.selectedAccount.isLocal) { - R.drawable.ic_rss_feed_grey - } else - state.selectedAccount.accountType!!.iconRes + Image( + painter = adaptiveIconPainterResource( + id = state.selectedAccount.accountType!!.iconRes ), - contentDescription = null + contentDescription = null, + modifier = Modifier.size(24.dp) ) } ) @@ -104,14 +106,12 @@ fun AddFeedDialog( ExposedDropdownMenuDefaults.TrailingIcon(expanded = isExpanded) }, leadingIcon = { - Icon( - painter = painterResource( - id = if (state.selectedAccount.isLocal) { - R.drawable.ic_rss_feed_grey - } else - state.selectedAccount.accountType!!.iconRes + Image( + painter = adaptiveIconPainterResource( + id = state.selectedAccount.accountType!!.iconRes ), - contentDescription = null + contentDescription = null, + modifier = Modifier.size(24.dp) ) }, modifier = Modifier.menuAnchor() diff --git a/appcompose/src/main/java/com/readrops/app/compose/more/MoreTab.kt b/appcompose/src/main/java/com/readrops/app/compose/more/MoreTab.kt index 8450dd28..d1aa8b4f 100644 --- a/appcompose/src/main/java/com/readrops/app/compose/more/MoreTab.kt +++ b/appcompose/src/main/java/com/readrops/app/compose/more/MoreTab.kt @@ -16,6 +16,7 @@ import cafe.adriel.voyager.navigator.tab.Tab import cafe.adriel.voyager.navigator.tab.TabOptions import com.readrops.app.compose.BuildConfig import com.readrops.app.compose.R +import com.readrops.app.compose.account.selection.adaptiveIconPainterResource import com.readrops.app.compose.util.components.SelectableIconText import com.readrops.app.compose.util.theme.LargeSpacer import com.readrops.app.compose.util.theme.MediumSpacer @@ -41,7 +42,7 @@ object MoreTab : Tab { LargeSpacer() Image( - painter = painterResource(id = R.drawable.ic_freshrss), + painter = adaptiveIconPainterResource(id = R.mipmap.ic_launcher_round), contentDescription = null, modifier = Modifier.size(64.dp) )