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.
This commit is contained in:
Claude
2026-05-01 08:59:17 +00:00
parent 8f843be41b
commit c8818ed317
2 changed files with 18 additions and 1 deletions
@@ -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
+1
View File
@@ -1734,6 +1734,7 @@
<string name="bottom_bar_settings_description">Drag to reorder. Toggle to add or remove an item from the bottom bar. With zero items the bottom bar is hidden.</string>
<string name="bottom_bar_settings_available">Available</string>
<string name="bottom_bar_settings_reorder">Reorder</string>
<string name="bottom_bar_settings_restore_default">Restore Default</string>
<string name="home_tabs_settings">Home Tabs</string>
<string name="home_tabs_settings_description">Pick which tabs appear on the Home screen. When only one tab is active the tab bar is hidden.</string>
<string name="home_tab_everything">Everything</string>