Better alignment and options in the UI.
This commit is contained in:
+37
-15
@@ -133,9 +133,9 @@ fun DisplayFollowList(
|
|||||||
val contacts = contactsState
|
val contacts = contactsState
|
||||||
|
|
||||||
if (contacts == null) {
|
if (contacts == null) {
|
||||||
LoadingIndicator(stringRes(R.string.fetching_follow_list))
|
LoadingIndicator(stringRes(R.string.fetching_follow_list), modifier, nav)
|
||||||
} else if (contacts.isEmpty()) {
|
} else if (contacts.isEmpty()) {
|
||||||
ErrorMessage(stringRes(R.string.no_follows_found))
|
ErrorMessage(stringRes(R.string.no_follows_found), modifier, nav)
|
||||||
} else {
|
} else {
|
||||||
PreviewList(
|
PreviewList(
|
||||||
contacts,
|
contacts,
|
||||||
@@ -222,24 +222,40 @@ private fun PreviewList(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun LoadingIndicator(message: String) {
|
private fun LoadingIndicator(
|
||||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
message: String,
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
modifier: Modifier,
|
||||||
CircularProgressIndicator(Modifier.size(40.dp), strokeWidth = 3.dp)
|
nav: INav,
|
||||||
Spacer(Modifier.height(12.dp))
|
) {
|
||||||
Text(
|
Column(modifier, horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
message,
|
Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
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
|
@Composable
|
||||||
private fun ErrorMessage(message: String) {
|
private fun ErrorMessage(
|
||||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
message: String,
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
modifier: Modifier,
|
||||||
|
nav: INav,
|
||||||
|
) {
|
||||||
|
Column(modifier) {
|
||||||
|
Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {
|
||||||
Text(
|
Text(
|
||||||
message,
|
message,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
@@ -247,6 +263,12 @@ private fun ErrorMessage(message: String) {
|
|||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
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),
|
modifier = Modifier.weight(1f),
|
||||||
accountViewModel = accountViewModel,
|
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))
|
Spacer(Modifier.height(16.dp))
|
||||||
|
|
||||||
@@ -236,7 +217,6 @@ private fun CustomShowUserSuggestionList(
|
|||||||
onSelect: (User) -> Unit,
|
onSelect: (User) -> Unit,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onEmpty: @Composable () -> Unit = {},
|
|
||||||
) {
|
) {
|
||||||
UserSearchDataSourceSubscription(viewModel.userSuggestions, accountViewModel)
|
UserSearchDataSourceSubscription(viewModel.userSuggestions, accountViewModel)
|
||||||
|
|
||||||
@@ -253,7 +233,7 @@ private fun CustomShowUserSuggestionList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomWatchResponses(viewModel, onSelect, accountViewModel, modifier, onEmpty)
|
CustomWatchResponses(viewModel, onSelect, accountViewModel, modifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -262,7 +242,6 @@ fun CustomWatchResponses(
|
|||||||
onSelect: (User) -> Unit,
|
onSelect: (User) -> Unit,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onEmpty: @Composable () -> Unit = {},
|
|
||||||
) {
|
) {
|
||||||
val suggestions by viewModel.results.collectAsStateWithLifecycle()
|
val suggestions by viewModel.results.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
@@ -280,6 +259,23 @@ fun CustomWatchResponses(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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