mirror of https://github.com/Ashinch/ReadYou.git
Improved interaction of option drawers
This commit is contained in:
parent
128178ef86
commit
7d0721e80a
|
@ -13,10 +13,8 @@ import me.ash.reader.ui.component.ViewPager
|
|||
import me.ash.reader.ui.ext.collectAsStateValue
|
||||
import me.ash.reader.ui.ext.findActivity
|
||||
import me.ash.reader.ui.page.common.ExtraName
|
||||
import me.ash.reader.ui.page.home.drawer.feed.FeedOptionDrawer
|
||||
import me.ash.reader.ui.page.home.drawer.feed.FeedOptionViewAction
|
||||
import me.ash.reader.ui.page.home.drawer.feed.FeedOptionViewModel
|
||||
import me.ash.reader.ui.page.home.drawer.group.GroupOptionDrawer
|
||||
import me.ash.reader.ui.page.home.feeds.option.feed.FeedOptionViewAction
|
||||
import me.ash.reader.ui.page.home.feeds.option.feed.FeedOptionViewModel
|
||||
import me.ash.reader.ui.page.home.feeds.FeedsPage
|
||||
import me.ash.reader.ui.page.home.flow.FlowPage
|
||||
import me.ash.reader.ui.page.home.read.ReadPage
|
||||
|
@ -150,7 +148,4 @@ fun HomePage(
|
|||
),
|
||||
)
|
||||
}
|
||||
|
||||
FeedOptionDrawer()
|
||||
GroupOptionDrawer()
|
||||
}
|
|
@ -19,8 +19,8 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import me.ash.reader.data.entity.Feed
|
||||
import me.ash.reader.ui.page.home.drawer.feed.FeedOptionViewAction
|
||||
import me.ash.reader.ui.page.home.drawer.feed.FeedOptionViewModel
|
||||
import me.ash.reader.ui.page.home.feeds.option.feed.FeedOptionViewAction
|
||||
import me.ash.reader.ui.page.home.feeds.option.feed.FeedOptionViewModel
|
||||
|
||||
@OptIn(
|
||||
androidx.compose.foundation.ExperimentalFoundationApi::class,
|
||||
|
|
|
@ -38,6 +38,8 @@ import me.ash.reader.ui.ext.getName
|
|||
import me.ash.reader.ui.page.common.RouteName
|
||||
import me.ash.reader.ui.page.home.FilterBar
|
||||
import me.ash.reader.ui.page.home.FilterState
|
||||
import me.ash.reader.ui.page.home.feeds.option.feed.FeedOptionDrawer
|
||||
import me.ash.reader.ui.page.home.feeds.option.group.GroupOptionDrawer
|
||||
import me.ash.reader.ui.page.home.feeds.subscribe.SubscribeDialog
|
||||
import me.ash.reader.ui.page.home.feeds.subscribe.SubscribeViewAction
|
||||
import me.ash.reader.ui.page.home.feeds.subscribe.SubscribeViewModel
|
||||
|
@ -239,5 +241,8 @@ fun FeedsPage(
|
|||
)
|
||||
}
|
||||
)
|
||||
|
||||
FeedOptionDrawer()
|
||||
GroupOptionDrawer()
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ import androidx.hilt.navigation.compose.hiltViewModel
|
|||
import me.ash.reader.R
|
||||
import me.ash.reader.data.entity.Feed
|
||||
import me.ash.reader.data.entity.Group
|
||||
import me.ash.reader.ui.page.home.drawer.group.GroupOptionViewAction
|
||||
import me.ash.reader.ui.page.home.drawer.group.GroupOptionViewModel
|
||||
import me.ash.reader.ui.page.home.feeds.option.group.GroupOptionViewAction
|
||||
import me.ash.reader.ui.page.home.feeds.option.group.GroupOptionViewModel
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class, androidx.compose.foundation.ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package me.ash.reader.ui.page.home.drawer.feed
|
||||
package me.ash.reader.ui.page.home.feeds.option.feed
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.material.icons.Icons
|
|
@ -1,6 +1,7 @@
|
|||
package me.ash.reader.ui.page.home.drawer.feed
|
||||
package me.ash.reader.ui.page.home.feeds.option.feed
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.icons.Icons
|
||||
|
@ -19,6 +20,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import me.ash.reader.R
|
||||
import me.ash.reader.ui.component.BottomDrawer
|
||||
import me.ash.reader.ui.component.TextFieldDialog
|
||||
|
@ -39,10 +41,16 @@ fun FeedOptionDrawer(
|
|||
val feed = viewState.feed
|
||||
val toastString = stringResource(R.string.rename_toast, viewState.newName)
|
||||
|
||||
BackHandler(viewState.drawerState.isVisible) {
|
||||
scope.launch {
|
||||
viewState.drawerState.hide()
|
||||
}
|
||||
}
|
||||
|
||||
BottomDrawer(
|
||||
drawerState = viewState.drawerState,
|
||||
sheetContent = {
|
||||
Column {
|
||||
Column(modifier = Modifier.navigationBarsPadding()) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
@ -1,4 +1,4 @@
|
|||
package me.ash.reader.ui.page.home.drawer.feed
|
||||
package me.ash.reader.ui.page.home.feeds.option.feed
|
||||
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.ModalBottomSheetState
|
|
@ -1,4 +1,4 @@
|
|||
package me.ash.reader.ui.page.home.drawer.group
|
||||
package me.ash.reader.ui.page.home.feeds.option.group
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.material.icons.Icons
|
|
@ -1,4 +1,4 @@
|
|||
package me.ash.reader.ui.page.home.drawer.group
|
||||
package me.ash.reader.ui.page.home.feeds.option.group
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.material.icons.Icons
|
|
@ -1,4 +1,4 @@
|
|||
package me.ash.reader.ui.page.home.drawer.group
|
||||
package me.ash.reader.ui.page.home.feeds.option.group
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.material.icons.Icons
|
|
@ -1,4 +1,4 @@
|
|||
package me.ash.reader.ui.page.home.drawer.group
|
||||
package me.ash.reader.ui.page.home.feeds.option.group
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.material.icons.Icons
|
|
@ -1,7 +1,8 @@
|
|||
package me.ash.reader.ui.page.home.drawer.group
|
||||
package me.ash.reader.ui.page.home.feeds.option.group
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.Toast
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.animation.animateContentSize
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
|
@ -27,8 +28,10 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import com.google.accompanist.flowlayout.FlowCrossAxisAlignment
|
||||
import com.google.accompanist.flowlayout.FlowRow
|
||||
import com.google.accompanist.flowlayout.MainAxisAlignment
|
||||
import kotlinx.coroutines.launch
|
||||
import me.ash.reader.R
|
||||
import me.ash.reader.data.entity.Group
|
||||
import me.ash.reader.ui.component.BottomDrawer
|
||||
|
@ -53,10 +56,16 @@ fun GroupOptionDrawer(
|
|||
val group = viewState.group
|
||||
val toastString = stringResource(R.string.rename_toast, viewState.newName)
|
||||
|
||||
BackHandler(viewState.drawerState.isVisible) {
|
||||
scope.launch {
|
||||
viewState.drawerState.hide()
|
||||
}
|
||||
}
|
||||
|
||||
BottomDrawer(
|
||||
drawerState = viewState.drawerState,
|
||||
sheetContent = {
|
||||
Column {
|
||||
Column(modifier = Modifier.navigationBarsPadding()) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
|
@ -153,6 +162,7 @@ private fun Preset(
|
|||
) {
|
||||
FlowRow(
|
||||
mainAxisAlignment = MainAxisAlignment.Start,
|
||||
crossAxisAlignment = FlowCrossAxisAlignment.Center,
|
||||
crossAxisSpacing = 10.dp,
|
||||
mainAxisSpacing = 10.dp,
|
||||
) {
|
||||
|
@ -208,6 +218,7 @@ private fun FlowRowGroups(
|
|||
) {
|
||||
FlowRow(
|
||||
mainAxisAlignment = MainAxisAlignment.Start,
|
||||
crossAxisAlignment = FlowCrossAxisAlignment.Center,
|
||||
crossAxisSpacing = 10.dp,
|
||||
mainAxisSpacing = 10.dp,
|
||||
) {
|
|
@ -1,4 +1,4 @@
|
|||
package me.ash.reader.ui.page.home.drawer.group
|
||||
package me.ash.reader.ui.page.home.feeds.option.group
|
||||
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.ModalBottomSheetState
|
|
@ -28,6 +28,7 @@ import androidx.compose.ui.platform.LocalContext
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.google.accompanist.flowlayout.FlowCrossAxisAlignment
|
||||
import com.google.accompanist.flowlayout.FlowRow
|
||||
import com.google.accompanist.flowlayout.MainAxisAlignment
|
||||
import me.ash.reader.R
|
||||
|
@ -123,6 +124,7 @@ private fun Preset(
|
|||
Spacer(modifier = Modifier.height(10.dp))
|
||||
FlowRow(
|
||||
mainAxisAlignment = MainAxisAlignment.Start,
|
||||
crossAxisAlignment = FlowCrossAxisAlignment.Center,
|
||||
crossAxisSpacing = 10.dp,
|
||||
mainAxisSpacing = 10.dp,
|
||||
) {
|
||||
|
@ -200,6 +202,7 @@ private fun AddToGroup(
|
|||
} else {
|
||||
FlowRow(
|
||||
mainAxisAlignment = MainAxisAlignment.Start,
|
||||
crossAxisAlignment = FlowCrossAxisAlignment.Center,
|
||||
crossAxisSpacing = 10.dp,
|
||||
mainAxisSpacing = 10.dp,
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue