mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-28 17:20:46 +00:00
Fix cards visibility pre API 28
This commit is contained in:
parent
ebbe928fd2
commit
149c81722c
@ -43,11 +43,10 @@ fun DisappearingMessages(
|
|||||||
) {
|
) {
|
||||||
val scrollState = rememberScrollState()
|
val scrollState = rememberScrollState()
|
||||||
|
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier.padding(horizontal = 32.dp)) {
|
||||||
Box(modifier = Modifier.weight(1f)) {
|
Box(modifier = Modifier.weight(1f)) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 32.dp)
|
|
||||||
.padding(bottom = 20.dp)
|
.padding(bottom = 20.dp)
|
||||||
.verticalScroll(scrollState)
|
.verticalScroll(scrollState)
|
||||||
.fadingEdges(scrollState),
|
.fadingEdges(scrollState),
|
||||||
|
@ -5,6 +5,7 @@ import androidx.compose.foundation.BorderStroke
|
|||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.ScrollState
|
import androidx.compose.foundation.ScrollState
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.BoxScope
|
import androidx.compose.foundation.layout.BoxScope
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@ -115,10 +116,13 @@ fun CellWithPaddingAndMargin(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TitledRadioButton(option: OptionModel, onClick: () -> Unit) {
|
fun TitledRadioButton(option: OptionModel, onClick: () -> Unit) {
|
||||||
Row(modifier = Modifier
|
Row(
|
||||||
.clickable { if (!option.selected) onClick() }
|
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
.heightIn(min = 60.dp)
|
modifier = Modifier
|
||||||
.padding(horizontal = 34.dp)) {
|
.clickable { if (!option.selected) onClick() }
|
||||||
|
.heightIn(min = 60.dp)
|
||||||
|
.padding(horizontal = 32.dp)
|
||||||
|
) {
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.align(Alignment.CenterVertically)) {
|
.align(Alignment.CenterVertically)) {
|
||||||
@ -182,7 +186,7 @@ fun Modifier.fadingEdges(
|
|||||||
val topColors = listOf(Color.Transparent, Color.Black)
|
val topColors = listOf(Color.Transparent, Color.Black)
|
||||||
val topStartY = scrollState.value.toFloat()
|
val topStartY = scrollState.value.toFloat()
|
||||||
val topGradientHeight = min(topEdgeHeight.toPx(), topStartY)
|
val topGradientHeight = min(topEdgeHeight.toPx(), topStartY)
|
||||||
drawRect(
|
if (topGradientHeight > 0f) drawRect(
|
||||||
brush = Brush.verticalGradient(
|
brush = Brush.verticalGradient(
|
||||||
colors = topColors,
|
colors = topColors,
|
||||||
startY = topStartY,
|
startY = topStartY,
|
||||||
@ -195,7 +199,7 @@ fun Modifier.fadingEdges(
|
|||||||
val bottomEndY = size.height - scrollState.maxValue + scrollState.value
|
val bottomEndY = size.height - scrollState.maxValue + scrollState.value
|
||||||
val bottomGradientHeight =
|
val bottomGradientHeight =
|
||||||
min(bottomEdgeHeight.toPx(), scrollState.maxValue.toFloat() - scrollState.value)
|
min(bottomEdgeHeight.toPx(), scrollState.maxValue.toFloat() - scrollState.value)
|
||||||
if (bottomGradientHeight != 0f) drawRect(
|
if (bottomGradientHeight > 0f) drawRect(
|
||||||
brush = Brush.verticalGradient(
|
brush = Brush.verticalGradient(
|
||||||
colors = bottomColors,
|
colors = bottomColors,
|
||||||
startY = bottomEndY - bottomGradientHeight,
|
startY = bottomEndY - bottomGradientHeight,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user