feat: improve settings screen
Signed-off-by: Infi <wingit@geist.ga>
This commit is contained in:
parent
ccd9433773
commit
822ec031cc
|
|
@ -4,13 +4,15 @@ import android.widget.Toast
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Build
|
import androidx.compose.material.icons.filled.Build
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
import androidx.compose.material.icons.filled.Info
|
import androidx.compose.material.icons.filled.Info
|
||||||
import androidx.compose.material.icons.filled.Settings
|
import androidx.compose.material.icons.filled.Settings
|
||||||
import androidx.compose.material3.Divider
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
@ -43,95 +45,123 @@ fun SettingsScreen(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(10.dp)
|
.padding(10.dp)
|
||||||
) {
|
.verticalScroll(rememberScrollState())
|
||||||
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")
|
|
||||||
) {
|
|
||||||
navController.navigate("settings/appearance")
|
|
||||||
}
|
|
||||||
|
|
||||||
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",
|
|
||||||
modifier = modifier
|
|
||||||
)
|
|
||||||
},
|
|
||||||
label = { textStyle ->
|
|
||||||
Text(text = "Debug", style = textStyle)
|
|
||||||
},
|
|
||||||
modifier = Modifier.testTag("settings_view_debug")
|
|
||||||
) {
|
) {
|
||||||
navController.navigate("settings/debug")
|
Text(
|
||||||
|
text = stringResource(id = R.string.settings_category_general),
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
modifier = Modifier.padding(bottom = 10.dp, start = 10.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
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")
|
||||||
|
) {
|
||||||
|
navController.navigate("settings/appearance")
|
||||||
|
}
|
||||||
|
|
||||||
|
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",
|
||||||
|
modifier = modifier
|
||||||
|
)
|
||||||
|
},
|
||||||
|
label = { textStyle ->
|
||||||
|
Text(text = "Debug", style = textStyle)
|
||||||
|
},
|
||||||
|
modifier = Modifier.testTag("settings_view_debug")
|
||||||
|
) {
|
||||||
|
navController.navigate("settings/debug")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Divider()
|
|
||||||
|
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -264,6 +264,10 @@
|
||||||
<string name="spark_sidebar_settings_tutorial_description_2">Then long tap your profile picture to open the settings.</string>
|
<string name="spark_sidebar_settings_tutorial_description_2">Then long tap your profile picture to open the settings.</string>
|
||||||
<string name="spark_sidebar_settings_tutorial_acknowledge">Got it</string>
|
<string name="spark_sidebar_settings_tutorial_acknowledge">Got it</string>
|
||||||
|
|
||||||
|
<string name="settings_category_general">General</string>
|
||||||
|
<string name="settings_category_miscellaneous">Miscellaneous</string>
|
||||||
|
<string name="settings_category_last" translatable="false">Revolt v%1$s</string>
|
||||||
|
|
||||||
<string name="settings_appearance">Appearance</string>
|
<string name="settings_appearance">Appearance</string>
|
||||||
<string name="settings_appearance_theme">Theme</string>
|
<string name="settings_appearance_theme">Theme</string>
|
||||||
<string name="settings_appearance_theme_none">System</string>
|
<string name="settings_appearance_theme_none">System</string>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue