BIT-1662: Fix pull to refresh on content that did not scroll (#1012)

This commit is contained in:
David Perez 2024-02-13 17:48:46 -06:00 committed by Álison Fernandes
parent cc0f6f54a5
commit 79ed894d70
5 changed files with 28 additions and 17 deletions

View file

@ -1,12 +1,13 @@
package com.x8bit.bitwarden.ui.platform.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@ -29,10 +30,10 @@ fun BitwardenErrorContent(
onTryAgainClick: (() -> Unit)? = null,
) {
Column(
modifier = modifier,
verticalArrangement = Arrangement.Center,
modifier = modifier.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Spacer(modifier = Modifier.weight(1f))
Text(
text = message,
color = MaterialTheme.colorScheme.onSurface,
@ -50,6 +51,7 @@ fun BitwardenErrorContent(
modifier = Modifier.padding(horizontal = 16.dp),
)
}
Spacer(modifier = Modifier.weight(1f))
Spacer(modifier = Modifier.navigationBarsPadding())
}
}

View file

@ -15,6 +15,8 @@ import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
@ -308,12 +310,11 @@ private fun PendingRequestsEmpty(
modifier: Modifier = Modifier,
) {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = modifier,
modifier = modifier.verticalScroll(rememberScrollState()),
) {
Spacer(modifier = Modifier.height(16.dp))
Spacer(modifier = Modifier.weight(1f))
Image(
painter = painterResource(id = R.drawable.ic_pending_requests),
contentDescription = null,
@ -333,6 +334,8 @@ private fun PendingRequestsEmpty(
.fillMaxWidth()
.padding(horizontal = 16.dp),
)
Spacer(modifier = Modifier.weight(1f))
Spacer(modifier = Modifier.navigationBarsPadding())
Spacer(modifier = Modifier.height(64.dp))
}

View file

@ -1,12 +1,13 @@
package com.x8bit.bitwarden.ui.tools.feature.send
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
@ -30,9 +31,8 @@ fun SendEmpty(
modifier: Modifier = Modifier,
) {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = modifier,
modifier = modifier.verticalScroll(rememberScrollState()),
) {
if (policyDisablesSend) {
BitwardenPolicyWarningText(
@ -71,8 +71,7 @@ fun SendEmpty(
style = MaterialTheme.typography.labelLarge,
)
}
Spacer(modifier = Modifier.navigationBarsPadding())
Spacer(modifier = Modifier.weight(1F))
Spacer(modifier = Modifier.navigationBarsPadding())
}
}

View file

@ -1,9 +1,12 @@
package com.x8bit.bitwarden.ui.vault.feature.itemlisting
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@ -44,10 +47,10 @@ private fun GenericNoItems(
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier,
verticalArrangement = Arrangement.Center,
modifier = modifier.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Spacer(modifier = Modifier.weight(1f))
Text(
textAlign = TextAlign.Center,
modifier = Modifier
@ -56,5 +59,7 @@ private fun GenericNoItems(
text = text,
style = MaterialTheme.typography.bodyMedium,
)
Spacer(modifier = Modifier.weight(1f))
Spacer(modifier = Modifier.navigationBarsPadding())
}
}

View file

@ -1,11 +1,13 @@
package com.x8bit.bitwarden.ui.vault.feature.vault
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
@ -30,8 +32,7 @@ fun VaultNoItems(
message: String = stringResource(id = R.string.no_items),
) {
Column(
modifier = modifier,
verticalArrangement = Arrangement.Center,
modifier = modifier.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
) {
if (policyDisablesSend) {
@ -73,5 +74,6 @@ fun VaultNoItems(
}
Spacer(modifier = Modifier.weight(1F))
Spacer(modifier = Modifier.navigationBarsPadding())
}
}