Skip to content

Commit

Permalink
Show scrim on top of feeds list when feed sheet is in link entry mode…
Browse files Browse the repository at this point in the history
… and keyboard is open
  • Loading branch information
msasikanth committed Oct 15, 2023
1 parent 9c205e4 commit e6af88b
Showing 1 changed file with 56 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -72,6 +73,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -222,55 +224,68 @@ private fun BottomSheetExpandedContent(
LaunchedEffect(keyboardState) {
if (keyboardState == KeyboardState.Closed) {
focusManager.clearFocus()
exitFeedsEdit()
}
}

LazyColumn(
modifier =
Modifier.fillMaxSize()
.padding(bottom = if (imeBottomPadding > 0.dp) imeBottomPadding + 16.dp else 0.dp),
contentPadding =
PaddingValues(
start = padding.calculateStartPadding(layoutDirection),
top = padding.calculateTopPadding(),
end = padding.calculateEndPadding(layoutDirection),
bottom = padding.calculateBottomPadding() + 64.dp
)
) {
itemsIndexed(pinnedFeeds) { index, feed ->
FeedListItem(
feed = feed,
selected = selectedFeed == feed,
canShowDivider = index != pinnedFeeds.lastIndex,
canPinFeeds = true,
feedsSheetMode = feedsSheetMode,
onDeleteFeed = onDeleteFeed,
onFeedSelected = onFeedSelected,
onFeedNameChanged = onFeedNameChanged,
onFeedPinClick = onFeedPinClick
)
}
Box {
LazyColumn(
modifier =
Modifier.fillMaxSize()
.padding(bottom = if (imeBottomPadding > 0.dp) imeBottomPadding + 16.dp else 0.dp),
contentPadding =
PaddingValues(
start = padding.calculateStartPadding(layoutDirection),
top = padding.calculateTopPadding(),
end = padding.calculateEndPadding(layoutDirection),
bottom = padding.calculateBottomPadding() + 64.dp
)
) {
itemsIndexed(pinnedFeeds) { index, feed ->
FeedListItem(
feed = feed,
selected = selectedFeed == feed,
canShowDivider = index != pinnedFeeds.lastIndex,
canPinFeeds = true,
feedsSheetMode = feedsSheetMode,
onDeleteFeed = onDeleteFeed,
onFeedSelected = onFeedSelected,
onFeedNameChanged = onFeedNameChanged,
onFeedPinClick = onFeedPinClick
)
}

if (pinnedFeeds.isNotEmpty() && feeds.isNotEmpty()) {
item {
Divider(
modifier = Modifier.fillMaxWidth().padding(vertical = 16.dp),
color = AppTheme.colorScheme.tintedSurface
if (pinnedFeeds.isNotEmpty() && feeds.isNotEmpty()) {
item {
Divider(
modifier = Modifier.fillMaxWidth().padding(vertical = 16.dp),
color = AppTheme.colorScheme.tintedSurface
)
}
}

itemsIndexed(feeds) { index, feed ->
FeedListItem(
feed = feed,
selected = selectedFeed == feed,
canShowDivider = index != feeds.lastIndex,
canPinFeeds = canPinFeeds,
feedsSheetMode = feedsSheetMode,
onDeleteFeed = onDeleteFeed,
onFeedSelected = onFeedSelected,
onFeedNameChanged = onFeedNameChanged,
onFeedPinClick = onFeedPinClick
)
}
}

itemsIndexed(feeds) { index, feed ->
FeedListItem(
feed = feed,
selected = selectedFeed == feed,
canShowDivider = index != feeds.lastIndex,
canPinFeeds = canPinFeeds,
feedsSheetMode = feedsSheetMode,
onDeleteFeed = onDeleteFeed,
onFeedSelected = onFeedSelected,
onFeedNameChanged = onFeedNameChanged,
onFeedPinClick = onFeedPinClick
if (keyboardState == KeyboardState.Opened && feedsSheetMode == LinkEntry) {
// Scrim when keyboard is open
Box(
Modifier.fillMaxSize()
.padding(padding)
.background(AppTheme.colorScheme.tintedBackground.copy(alpha = 0.8f))
.pointerInput(Unit) { detectTapGestures { focusManager.clearFocus() } }
)
}
}
Expand Down

0 comments on commit e6af88b

Please sign in to comment.