mirror of https://github.com/readrops/Readrops.git
Improve FeedBottomSheet looking and add Update color option
This commit is contained in:
parent
5cd7ead78f
commit
7d17740713
|
@ -22,7 +22,6 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.res.vectorResource
|
import androidx.compose.ui.res.vectorResource
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
import com.readrops.app.compose.R
|
import com.readrops.app.compose.R
|
||||||
import com.readrops.app.compose.util.theme.LargeSpacer
|
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.VeryShortSpacer
|
||||||
import com.readrops.app.compose.util.theme.spacing
|
import com.readrops.app.compose.util.theme.spacing
|
||||||
import com.readrops.db.entities.Feed
|
import com.readrops.db.entities.Feed
|
||||||
|
import com.readrops.db.entities.Folder
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun FeedModalBottomSheet(
|
fun FeedModalBottomSheet(
|
||||||
feed: Feed,
|
feed: Feed,
|
||||||
|
folder: Folder?,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
onOpen: () -> Unit,
|
onOpen: () -> Unit,
|
||||||
onModify: () -> Unit,
|
onModify: () -> Unit,
|
||||||
|
onUpdateColor: () -> Unit,
|
||||||
onDelete: () -> Unit,
|
onDelete: () -> Unit,
|
||||||
) {
|
) {
|
||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
|
@ -48,13 +50,13 @@ fun FeedModalBottomSheet(
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
horizontal = 24.dp
|
horizontal = MaterialTheme.spacing.largeSpacing
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = feed.iconUrl,
|
model = feed.iconUrl,
|
||||||
contentDescription = feed.name!!,
|
contentDescription = feed.name!!,
|
||||||
modifier = Modifier.size(48.dp)
|
modifier = Modifier.size(MaterialTheme.spacing.veryLargeSpacing)
|
||||||
)
|
)
|
||||||
|
|
||||||
MediumSpacer()
|
MediumSpacer()
|
||||||
|
@ -65,12 +67,14 @@ fun FeedModalBottomSheet(
|
||||||
style = MaterialTheme.typography.headlineSmall,
|
style = MaterialTheme.typography.headlineSmall,
|
||||||
)
|
)
|
||||||
|
|
||||||
VeryShortSpacer()
|
if (folder != null) {
|
||||||
|
VeryShortSpacer()
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "folder name if it exists",
|
text = folder.name!!,
|
||||||
style = MaterialTheme.typography.labelSmall
|
style = MaterialTheme.typography.labelSmall
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +82,7 @@ fun FeedModalBottomSheet(
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
horizontal = MaterialTheme.spacing.shortSpacing
|
horizontal = MaterialTheme.spacing.mediumSpacing
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -96,6 +100,12 @@ fun FeedModalBottomSheet(
|
||||||
onClick = onModify
|
onClick = onModify
|
||||||
)
|
)
|
||||||
|
|
||||||
|
BottomSheetOption(
|
||||||
|
text = "Update color",
|
||||||
|
icon = ImageVector.vectorResource(R.drawable.ic_color),
|
||||||
|
onClick = onUpdateColor
|
||||||
|
)
|
||||||
|
|
||||||
BottomSheetOption(
|
BottomSheetOption(
|
||||||
text = "Delete",
|
text = "Delete",
|
||||||
icon = Icons.Default.Delete,
|
icon = Icons.Default.Delete,
|
||||||
|
@ -120,8 +130,8 @@ fun BottomSheetOption(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(
|
.padding(
|
||||||
horizontal = 16.dp,
|
horizontal = MaterialTheme.spacing.mediumSpacing,
|
||||||
vertical = 8.dp
|
vertical = MaterialTheme.spacing.shortSpacing
|
||||||
)
|
)
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.readrops.app.compose.feeds
|
package com.readrops.app.compose.feeds
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
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.R
|
||||||
import com.readrops.app.compose.util.components.Placeholder
|
import com.readrops.app.compose.util.components.Placeholder
|
||||||
import com.readrops.db.entities.Feed
|
import com.readrops.db.entities.Feed
|
||||||
|
import com.readrops.db.entities.Folder
|
||||||
import org.koin.androidx.compose.getViewModel
|
import org.koin.androidx.compose.getViewModel
|
||||||
|
|
||||||
object FeedTab : Tab {
|
object FeedTab : Tab {
|
||||||
|
@ -56,16 +56,17 @@ object FeedTab : Tab {
|
||||||
var showDialog by remember { mutableStateOf(false) }
|
var showDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
var selectedFeed by remember { mutableStateOf<Feed?>(null) }
|
var selectedFeed by remember { mutableStateOf<Feed?>(null) }
|
||||||
|
var selectedFolder by remember { mutableStateOf<Folder?>(null) }
|
||||||
var showBottomSheet by remember { mutableStateOf(false) }
|
var showBottomSheet by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
if (showBottomSheet) {
|
if (showBottomSheet) {
|
||||||
FeedModalBottomSheet(
|
FeedModalBottomSheet(
|
||||||
feed = selectedFeed!!,
|
feed = selectedFeed!!,
|
||||||
|
folder = selectedFolder,
|
||||||
onDismissRequest = { showBottomSheet = false },
|
onDismissRequest = { showBottomSheet = false },
|
||||||
onOpen = {
|
onOpen = { uriHandler.openUri(selectedFeed!!.siteUrl!!) },
|
||||||
Log.d("TAG", "Content: ")
|
|
||||||
uriHandler.openUri(selectedFeed!!.siteUrl!!) },
|
|
||||||
onModify = { },
|
onModify = { },
|
||||||
|
onUpdateColor = {},
|
||||||
onDelete = {},
|
onDelete = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -119,6 +120,7 @@ object FeedTab : Tab {
|
||||||
feeds = folderWithFeeds.second,
|
feeds = folderWithFeeds.second,
|
||||||
onFeedClick = { feed ->
|
onFeedClick = { feed ->
|
||||||
selectedFeed = feed
|
selectedFeed = feed
|
||||||
|
selectedFolder = folderWithFeeds.first
|
||||||
showBottomSheet = true
|
showBottomSheet = true
|
||||||
},
|
},
|
||||||
onFeedLongClick = { feed ->
|
onFeedLongClick = { feed ->
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue