Merge pull request #2681 from davotoula/claude/add-nav-default-button-PRxqx
Add restore-default button to bottom nav settings
This commit is contained in:
+21
-1
@@ -39,6 +39,7 @@ import androidx.compose.material3.MaterialTheme
|
|||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableFloatStateOf
|
import androidx.compose.runtime.mutableFloatStateOf
|
||||||
@@ -61,6 +62,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.commons.icons.symbols.Icon
|
import com.vitorpamplona.amethyst.commons.icons.symbols.Icon
|
||||||
import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols
|
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.NavBarCatalog
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.bottombars.NavBarItem
|
import com.vitorpamplona.amethyst.ui.navigation.bottombars.NavBarItem
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.bottombars.NavBarItemDef
|
import com.vitorpamplona.amethyst.ui.navigation.bottombars.NavBarItemDef
|
||||||
@@ -134,9 +136,27 @@ fun BottomBarSettingsContent(accountViewModel: AccountViewModel) {
|
|||||||
text = stringRes(R.string.bottom_bar_settings_description),
|
text = stringRes(R.string.bottom_bar_settings_description),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = Color.Gray,
|
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 = {
|
||||||
|
draggedItemIndex = -1
|
||||||
|
dragOffset = 0f
|
||||||
|
save(initialRows(DefaultBottomBarItems))
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
Text(stringRes(R.string.bottom_bar_settings_restore_default))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
items.forEachIndexed { index, row ->
|
items.forEachIndexed { index, row ->
|
||||||
val rowIsDragging = draggedItemIndex == index
|
val rowIsDragging = draggedItemIndex == index
|
||||||
val targetElevation = if (rowIsDragging) 8f else 0f
|
val targetElevation = if (rowIsDragging) 8f else 0f
|
||||||
|
|||||||
@@ -1735,6 +1735,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_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_available">Available</string>
|
||||||
<string name="bottom_bar_settings_reorder">Reorder</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">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_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>
|
<string name="home_tab_everything">Everything</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user