Improve FeedBottomSheet looking and add Update color option

This commit is contained in:
Shinokuni 2024-01-12 19:49:35 +01:00
parent 5cd7ead78f
commit 7d17740713
3 changed files with 32 additions and 15 deletions

View File

@ -22,7 +22,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.readrops.app.compose.R
import com.readrops.app.compose.util.theme.LargeSpacer
@ -30,14 +29,17 @@ import com.readrops.app.compose.util.theme.MediumSpacer
import com.readrops.app.compose.util.theme.VeryShortSpacer
import com.readrops.app.compose.util.theme.spacing
import com.readrops.db.entities.Feed
import com.readrops.db.entities.Folder
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FeedModalBottomSheet(
feed: Feed,
folder: Folder?,
onDismissRequest: () -> Unit,
onOpen: () -> Unit,
onModify: () -> Unit,
onUpdateColor: () -> Unit,
onDelete: () -> Unit,
) {
ModalBottomSheet(
@ -48,13 +50,13 @@ fun FeedModalBottomSheet(
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(
horizontal = 24.dp
horizontal = MaterialTheme.spacing.largeSpacing
)
) {
AsyncImage(
model = feed.iconUrl,
contentDescription = feed.name!!,
modifier = Modifier.size(48.dp)
modifier = Modifier.size(MaterialTheme.spacing.veryLargeSpacing)
)
MediumSpacer()
@ -65,12 +67,14 @@ fun FeedModalBottomSheet(
style = MaterialTheme.typography.headlineSmall,
)
VeryShortSpacer()
if (folder != null) {
VeryShortSpacer()
Text(
text = "folder name if it exists",
style = MaterialTheme.typography.labelSmall
)
Text(
text = folder.name!!,
style = MaterialTheme.typography.labelSmall
)
}
}
}
@ -78,7 +82,7 @@ fun FeedModalBottomSheet(
Divider(
modifier = Modifier.padding(
horizontal = MaterialTheme.spacing.shortSpacing
horizontal = MaterialTheme.spacing.mediumSpacing
)
)
@ -96,6 +100,12 @@ fun FeedModalBottomSheet(
onClick = onModify
)
BottomSheetOption(
text = "Update color",
icon = ImageVector.vectorResource(R.drawable.ic_color),
onClick = onUpdateColor
)
BottomSheetOption(
text = "Delete",
icon = Icons.Default.Delete,
@ -120,8 +130,8 @@ fun BottomSheetOption(
modifier = Modifier
.fillMaxWidth()
.padding(
horizontal = 16.dp,
vertical = 8.dp
horizontal = MaterialTheme.spacing.mediumSpacing,
vertical = MaterialTheme.spacing.shortSpacing
)
) {

View File

@ -1,6 +1,5 @@
package com.readrops.app.compose.feeds
import android.util.Log
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
@ -34,6 +33,7 @@ import cafe.adriel.voyager.navigator.tab.TabOptions
import com.readrops.app.compose.R
import com.readrops.app.compose.util.components.Placeholder
import com.readrops.db.entities.Feed
import com.readrops.db.entities.Folder
import org.koin.androidx.compose.getViewModel
object FeedTab : Tab {
@ -56,16 +56,17 @@ object FeedTab : Tab {
var showDialog by remember { mutableStateOf(false) }
var selectedFeed by remember { mutableStateOf<Feed?>(null) }
var selectedFolder by remember { mutableStateOf<Folder?>(null) }
var showBottomSheet by remember { mutableStateOf(false) }
if (showBottomSheet) {
FeedModalBottomSheet(
feed = selectedFeed!!,
folder = selectedFolder,
onDismissRequest = { showBottomSheet = false },
onOpen = {
Log.d("TAG", "Content: ")
uriHandler.openUri(selectedFeed!!.siteUrl!!) },
onOpen = { uriHandler.openUri(selectedFeed!!.siteUrl!!) },
onModify = { },
onUpdateColor = {},
onDelete = {},
)
}
@ -119,6 +120,7 @@ object FeedTab : Tab {
feeds = folderWithFeeds.second,
onFeedClick = { feed ->
selectedFeed = feed
selectedFolder = folderWithFeeds.first
showBottomSheet = true
},
onFeedLongClick = { feed ->

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9c0.83,0 1.5,-0.67 1.5,-1.5 0,-0.39 -0.15,-0.74 -0.39,-1.01 -0.23,-0.26 -0.38,-0.61 -0.38,-0.99 0,-0.83 0.67,-1.5 1.5,-1.5L16,16c2.76,0 5,-2.24 5,-5 0,-4.42 -4.03,-8 -9,-8zM6.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zM9.5,8C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zM14.5,8c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zM17.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
</vector>