Use adaptiveIconPainterResource to load mipmap icons in some places

This commit is contained in:
Shinokuni 2024-05-19 22:31:38 +02:00
parent 351409bb26
commit 064d588b28
3 changed files with 18 additions and 16 deletions

View File

@ -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)
)

View File

@ -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()

View File

@ -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)
)