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