diff --git a/WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SelfHostedUserComposables.kt b/WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SelfHostedUserComposables.kt index 9f848dd94368..4204493f7d7f 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SelfHostedUserComposables.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SelfHostedUserComposables.kt @@ -11,10 +11,8 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Close import androidx.compose.material3.Button @@ -177,7 +175,6 @@ fun MessageView( fun ScreenWithTopBar( title: String, onCloseClick: () -> Unit, - isScrollable: Boolean = false, closeIcon: ImageVector = Icons.Default.Close, content: @Composable () -> Unit, ) { @@ -194,18 +191,11 @@ fun ScreenWithTopBar( ) }, ) { contentPadding -> - val extraModifier = if (isScrollable) { - Modifier - .padding(contentPadding) - .verticalScroll(rememberScrollState()) - } else { - Modifier - } Column( modifier = Modifier .fillMaxSize() .imePadding() - .then(extraModifier) + .padding(contentPadding) ) { content() } @@ -233,6 +223,5 @@ private fun OfflineScreenPreview() { title = "Title", content = content, onCloseClick = {}, - isScrollable = false, ) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SelfHostedUsersScreen.kt b/WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SelfHostedUsersScreen.kt index 27a13e40d350..3b58e2ac8426 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SelfHostedUsersScreen.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SelfHostedUsersScreen.kt @@ -10,6 +10,10 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height 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.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.Close @@ -32,6 +36,7 @@ import org.wordpress.android.R import org.wordpress.android.ui.compose.components.ProgressDialog import org.wordpress.android.ui.compose.components.ProgressDialogState import org.wordpress.android.ui.selfhostedusers.SelfHostedUsersViewModel.SelfHostedUserState +import org.wordpress.android.util.AppLog import uniffi.wp_api.UserWithEditContext @Composable @@ -55,12 +60,6 @@ fun SelfHostedUsersScreen( else -> Icons.AutoMirrored.Filled.ArrowBack } - val isScrollable = when (state) { - is SelfHostedUserState.UserList -> true - is SelfHostedUserState.UserDetail -> true - else -> false - } - Crossfade( targetState = state, animationSpec = tween( @@ -71,7 +70,6 @@ fun SelfHostedUsersScreen( ScreenWithTopBar( title = title, onCloseClick = { onCloseClick() }, - isScrollable = isScrollable, closeIcon = closeIcon, ) { when (targetState) { @@ -122,9 +120,13 @@ private fun UserList( users: List, onUserClick: (UserWithEditContext) -> Unit ) { - for (user in users) { - UserListItem(user, onUserClick) - HorizontalDivider(thickness = 1.dp) + LazyColumn { + items(users) { user -> + UserListItem(user, onUserClick) + HorizontalDivider(thickness = 1.dp) + // TODO remove logging + AppLog.d(AppLog.T.MAIN, "user: ${user.id}") + } } } @@ -185,6 +187,7 @@ private fun UserDetail( modifier = Modifier .padding(all = userScreenPaddingDp) .fillMaxWidth() + .verticalScroll(rememberScrollState()) ) { Column { val avatarUrl = user.avatarUrls?.values?.firstOrNull()