Better alignment and options in the UI.
This commit is contained in:
+37
-15
@@ -133,9 +133,9 @@ fun DisplayFollowList(
|
||||
val contacts = contactsState
|
||||
|
||||
if (contacts == null) {
|
||||
LoadingIndicator(stringRes(R.string.fetching_follow_list))
|
||||
LoadingIndicator(stringRes(R.string.fetching_follow_list), modifier, nav)
|
||||
} else if (contacts.isEmpty()) {
|
||||
ErrorMessage(stringRes(R.string.no_follows_found))
|
||||
ErrorMessage(stringRes(R.string.no_follows_found), modifier, nav)
|
||||
} else {
|
||||
PreviewList(
|
||||
contacts,
|
||||
@@ -222,24 +222,40 @@ private fun PreviewList(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun LoadingIndicator(message: String) {
|
||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
CircularProgressIndicator(Modifier.size(40.dp), strokeWidth = 3.dp)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
Text(
|
||||
message,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
private fun LoadingIndicator(
|
||||
message: String,
|
||||
modifier: Modifier,
|
||||
nav: INav,
|
||||
) {
|
||||
Column(modifier, horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
CircularProgressIndicator(Modifier.size(40.dp), strokeWidth = 3.dp)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
Text(
|
||||
message,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
|
||||
TextButton(onClick = { nav.popUpTo(Route.Home, Route.Home::class) }) { Text(stringRes(R.string.skip_for_now)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ErrorMessage(message: String) {
|
||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
private fun ErrorMessage(
|
||||
message: String,
|
||||
modifier: Modifier,
|
||||
nav: INav,
|
||||
) {
|
||||
Column(modifier) {
|
||||
Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {
|
||||
Text(
|
||||
message,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
@@ -247,6 +263,12 @@ private fun ErrorMessage(message: String) {
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
|
||||
TextButton(onClick = { nav.popUpTo(Route.Home, Route.Home::class) }) { Text(stringRes(R.string.skip_for_now)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-24
@@ -175,26 +175,7 @@ private fun InputSelectUserBody(
|
||||
},
|
||||
modifier = Modifier.weight(1f),
|
||||
accountViewModel = accountViewModel,
|
||||
) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
modifier = Modifier.weight(1f).padding(24.dp),
|
||||
) {
|
||||
Text(
|
||||
stringRes(R.string.tip),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
Spacer(Modifier.height(5.dp))
|
||||
Text(
|
||||
stringRes(R.string.import_follows_tips),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
|
||||
@@ -236,7 +217,6 @@ private fun CustomShowUserSuggestionList(
|
||||
onSelect: (User) -> Unit,
|
||||
accountViewModel: AccountViewModel,
|
||||
modifier: Modifier = Modifier,
|
||||
onEmpty: @Composable () -> Unit = {},
|
||||
) {
|
||||
UserSearchDataSourceSubscription(viewModel.userSuggestions, accountViewModel)
|
||||
|
||||
@@ -253,7 +233,7 @@ private fun CustomShowUserSuggestionList(
|
||||
}
|
||||
}
|
||||
|
||||
CustomWatchResponses(viewModel, onSelect, accountViewModel, modifier, onEmpty)
|
||||
CustomWatchResponses(viewModel, onSelect, accountViewModel, modifier)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -262,7 +242,6 @@ fun CustomWatchResponses(
|
||||
onSelect: (User) -> Unit,
|
||||
accountViewModel: AccountViewModel,
|
||||
modifier: Modifier = Modifier,
|
||||
onEmpty: @Composable () -> Unit = {},
|
||||
) {
|
||||
val suggestions by viewModel.results.collectAsStateWithLifecycle()
|
||||
|
||||
@@ -280,6 +259,23 @@ fun CustomWatchResponses(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
onEmpty()
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
modifier = modifier.padding(24.dp),
|
||||
) {
|
||||
Text(
|
||||
stringRes(R.string.tip),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
Spacer(Modifier.height(5.dp))
|
||||
Text(
|
||||
stringRes(R.string.import_follows_tips),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user