fix: layout fixes for self user overview
Signed-off-by: Infi <wingit@geist.ga>
This commit is contained in:
parent
b4f468132a
commit
bf8acdcb05
|
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
|
|
@ -83,23 +84,26 @@ fun SelfUserOverview() {
|
|||
userId = selfUser.id ?: ULID.makeSpecial(0),
|
||||
avatar = selfUser.avatar,
|
||||
size = 48.dp,
|
||||
presence = presenceFromStatus(selfUser.status?.presence ?: "offline"),
|
||||
presence = presenceFromStatus(selfUser.status?.presence ?: "Offline"),
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
|
||||
Text(text = AnnotatedString.Builder().apply {
|
||||
if (selfUser.displayName != null) {
|
||||
pushStyle(SpanStyle(fontWeight = FontWeight.Bold))
|
||||
append(selfUser.displayName)
|
||||
Text(
|
||||
text = AnnotatedString.Builder().apply {
|
||||
if (selfUser.displayName != null) {
|
||||
pushStyle(SpanStyle(fontWeight = FontWeight.Bold))
|
||||
append(selfUser.displayName)
|
||||
pop()
|
||||
append("\n")
|
||||
}
|
||||
append("${selfUser.username}")
|
||||
pushStyle(SpanStyle(fontWeight = FontWeight.ExtraLight))
|
||||
append("#${selfUser.discriminator}")
|
||||
pop()
|
||||
append("\n")
|
||||
}
|
||||
append("${selfUser.username}")
|
||||
pushStyle(SpanStyle(fontWeight = FontWeight.ExtraLight))
|
||||
append("#${selfUser.discriminator}")
|
||||
pop()
|
||||
}.toAnnotatedString())
|
||||
}.toAnnotatedString(),
|
||||
color = if (profile?.background != null) Color.White else LocalContentColor.current,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -44,144 +44,149 @@ fun SettingsScreen(
|
|||
navController.popBackStack()
|
||||
})
|
||||
|
||||
SelfUserOverview()
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(10.dp)
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_category_general),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(bottom = 10.dp, start = 10.dp)
|
||||
)
|
||||
SelfUserOverview()
|
||||
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_palette_24dp),
|
||||
contentDescription =
|
||||
stringResource(id = R.string.settings_appearance),
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_appearance),
|
||||
style = textStyle
|
||||
)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_appearance")
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(10.dp)
|
||||
) {
|
||||
navController.navigate("settings/appearance")
|
||||
}
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_category_general),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(bottom = 10.dp, start = 10.dp)
|
||||
)
|
||||
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_category_miscellaneous),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(bottom = 10.dp, start = 10.dp, top = 20.dp)
|
||||
)
|
||||
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Info,
|
||||
contentDescription = stringResource(id = R.string.about),
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(text = stringResource(id = R.string.about), style = textStyle)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_about")
|
||||
) {
|
||||
navController.navigate("about")
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Settings,
|
||||
contentDescription = "Debug",
|
||||
painter = painterResource(id = R.drawable.ic_palette_24dp),
|
||||
contentDescription =
|
||||
stringResource(id = R.string.settings_appearance),
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(text = "Debug", style = textStyle)
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_appearance),
|
||||
style = textStyle
|
||||
)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_debug")
|
||||
modifier = Modifier.testTag("settings_view_appearance")
|
||||
) {
|
||||
navController.navigate("settings/debug")
|
||||
navController.navigate("settings/appearance")
|
||||
}
|
||||
}
|
||||
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Settings,
|
||||
contentDescription = "Closed Beta Updater",
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(text = "Closed Beta Updater", style = textStyle)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_updater")
|
||||
) {
|
||||
navController.navigate("settings/updater")
|
||||
}
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_category_miscellaneous),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(bottom = 10.dp, start = 10.dp, top = 20.dp)
|
||||
)
|
||||
|
||||
Text(
|
||||
text = stringResource(
|
||||
id = R.string.settings_category_last,
|
||||
BuildConfig.VERSION_NAME
|
||||
),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(bottom = 10.dp, start = 10.dp, top = 20.dp)
|
||||
)
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Info,
|
||||
contentDescription = stringResource(id = R.string.about),
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(text = stringResource(id = R.string.about), style = textStyle)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_about")
|
||||
) {
|
||||
navController.navigate("about")
|
||||
}
|
||||
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Build,
|
||||
contentDescription = stringResource(id = R.string.settings_feedback),
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_feedback),
|
||||
style = textStyle
|
||||
)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_feedback")
|
||||
) {
|
||||
navController.navigate("settings/feedback")
|
||||
}
|
||||
if (BuildConfig.DEBUG) {
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Settings,
|
||||
contentDescription = "Debug",
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(text = "Debug", style = textStyle)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_debug")
|
||||
) {
|
||||
navController.navigate("settings/debug")
|
||||
}
|
||||
}
|
||||
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Close,
|
||||
contentDescription = stringResource(id = R.string.logout),
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(text = stringResource(id = R.string.logout), style = textStyle)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_logout")
|
||||
) {
|
||||
Toast
|
||||
.makeText(
|
||||
navController.context,
|
||||
"Not implemented yet",
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
.show()
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Settings,
|
||||
contentDescription = "Closed Beta Updater",
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(text = "Closed Beta Updater", style = textStyle)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_updater")
|
||||
) {
|
||||
navController.navigate("settings/updater")
|
||||
}
|
||||
|
||||
Text(
|
||||
text = stringResource(
|
||||
id = R.string.settings_category_last,
|
||||
BuildConfig.VERSION_NAME
|
||||
),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(bottom = 10.dp, start = 10.dp, top = 20.dp)
|
||||
)
|
||||
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Build,
|
||||
contentDescription = stringResource(id = R.string.settings_feedback),
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_feedback),
|
||||
style = textStyle
|
||||
)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_feedback")
|
||||
) {
|
||||
navController.navigate("settings/feedback")
|
||||
}
|
||||
|
||||
SheetClickable(
|
||||
icon = { modifier ->
|
||||
Icon(
|
||||
imageVector = Icons.Default.Close,
|
||||
contentDescription = stringResource(id = R.string.logout),
|
||||
modifier = modifier
|
||||
)
|
||||
},
|
||||
label = { textStyle ->
|
||||
Text(text = stringResource(id = R.string.logout), style = textStyle)
|
||||
},
|
||||
modifier = Modifier.testTag("settings_view_logout")
|
||||
) {
|
||||
Toast
|
||||
.makeText(
|
||||
navController.context,
|
||||
"Not implemented yet",
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue