From c8818ed317e14e54a5584d9387b4c873653ba8de Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 1 May 2026 08:59:17 +0000 Subject: [PATCH] feat(settings): add restore-default button to bottom nav settings Lets users who have over-customized the bottom navigation bar return to the fresh-install layout (Home, Messages, Video, Discover, Notifications) without manually toggling each item. --- .../settings/BottomBarSettingsScreen.kt | 18 +++++++++++++++++- amethyst/src/main/res/values/strings.xml | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/BottomBarSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/BottomBarSettingsScreen.kt index 27ae9d32a..6af0696f2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/BottomBarSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/BottomBarSettingsScreen.kt @@ -39,6 +39,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Switch import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableFloatStateOf @@ -61,6 +62,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.ui.navigation.bottombars.DefaultBottomBarItems import com.vitorpamplona.amethyst.ui.navigation.bottombars.NavBarCatalog import com.vitorpamplona.amethyst.ui.navigation.bottombars.NavBarItem import com.vitorpamplona.amethyst.ui.navigation.bottombars.NavBarItemDef @@ -134,9 +136,23 @@ fun BottomBarSettingsContent(accountViewModel: AccountViewModel) { text = stringRes(R.string.bottom_bar_settings_description), style = MaterialTheme.typography.bodyMedium, color = Color.Gray, - modifier = Modifier.padding(bottom = 16.dp, start = Size20dp, end = Size20dp), + modifier = Modifier.padding(bottom = 8.dp, start = Size20dp, end = Size20dp), ) + Row( + modifier = + Modifier + .fillMaxWidth() + .padding(bottom = 8.dp, start = Size20dp, end = Size20dp), + horizontalArrangement = Arrangement.End, + ) { + TextButton( + onClick = { save(initialRows(DefaultBottomBarItems)) }, + ) { + Text(stringRes(R.string.bottom_bar_settings_restore_default)) + } + } + items.forEachIndexed { index, row -> val rowIsDragging = draggedItemIndex == index val targetElevation = if (rowIsDragging) 8f else 0f diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index a30b9e49d..18bf2c01b 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -1734,6 +1734,7 @@ Drag to reorder. Toggle to add or remove an item from the bottom bar. With zero items the bottom bar is hidden. Available Reorder + Restore Default Home Tabs Pick which tabs appear on the Home screen. When only one tab is active the tab bar is hidden. Everything