generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/main' into tutorial…
…-base # Conflicts: # app/src/main/kotlin/com/x8bit/bitwarden/authenticator/data/platform/datasource/disk/SettingsDiskSource.kt # app/src/main/kotlin/com/x8bit/bitwarden/authenticator/data/platform/datasource/disk/SettingsDiskSourceImpl.kt # app/src/main/kotlin/com/x8bit/bitwarden/authenticator/data/platform/repository/SettingsRepository.kt # app/src/main/kotlin/com/x8bit/bitwarden/authenticator/data/platform/repository/SettingsRepositoryImpl.kt # app/src/main/res/values/strings.xml
- Loading branch information
Showing
19 changed files
with
1,037 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...m/x8bit/bitwarden/authenticator/ui/platform/components/appbar/BitwardenMediumTopAppBar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.x8bit.bitwarden.authenticator.ui.platform.components.appbar | ||
|
||
import androidx.compose.foundation.layout.RowScope | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.MediumTopAppBar | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.material3.TopAppBarScrollBehavior | ||
import androidx.compose.material3.rememberTopAppBarState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.semantics.semantics | ||
import androidx.compose.ui.semantics.testTag | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.x8bit.bitwarden.authenticator.R | ||
|
||
/** | ||
* A custom Bitwarden-themed medium top app bar with support for actions. | ||
* | ||
* This app bar wraps around Material 3's [MediumTopAppBar] and customizes its appearance | ||
* and behavior according to the app theme. | ||
* It provides a title and an optional set of actions on the trailing side. | ||
* These actions are arranged within a custom action row tailored to the app's design requirements. | ||
* | ||
* @param title The text to be displayed as the title of the app bar. | ||
* @param scrollBehavior Defines the scrolling behavior of the app bar. It controls how the app bar | ||
* behaves in conjunction with scrolling content. | ||
* @param actions A lambda containing the set of actions (usually icons or similar) to display | ||
* in the app bar's trailing side. This lambda extends [RowScope], allowing flexibility in | ||
* defining the layout of the actions. | ||
*/ | ||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun BitwardenMediumTopAppBar( | ||
title: String, | ||
scrollBehavior: TopAppBarScrollBehavior, | ||
modifier: Modifier = Modifier, | ||
actions: @Composable RowScope.() -> Unit = {}, | ||
) { | ||
MediumTopAppBar( | ||
colors = TopAppBarDefaults.largeTopAppBarColors( | ||
containerColor = MaterialTheme.colorScheme.surface, | ||
scrolledContainerColor = MaterialTheme.colorScheme.surfaceContainer, | ||
navigationIconContentColor = MaterialTheme.colorScheme.onSurface, | ||
titleContentColor = MaterialTheme.colorScheme.onSurface, | ||
actionIconContentColor = MaterialTheme.colorScheme.onSurfaceVariant, | ||
), | ||
scrollBehavior = scrollBehavior, | ||
title = { | ||
Text( | ||
text = title, | ||
style = MaterialTheme.typography.titleLarge, | ||
modifier = Modifier.semantics { testTag = "PageTitleLabel" }, | ||
) | ||
}, | ||
modifier = modifier.semantics { testTag = "HeaderBarComponent" }, | ||
actions = actions, | ||
) | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Preview(showBackground = true) | ||
@Composable | ||
private fun BitwardenMediumTopAppBar_preview() { | ||
MaterialTheme { | ||
BitwardenMediumTopAppBar( | ||
title = "Preview Title", | ||
scrollBehavior = TopAppBarDefaults | ||
.exitUntilCollapsedScrollBehavior( | ||
rememberTopAppBarState(), | ||
), | ||
actions = { | ||
IconButton(onClick = { }) { | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_more), | ||
contentDescription = "", | ||
tint = MaterialTheme.colorScheme.onSurface, | ||
) | ||
} | ||
}, | ||
) | ||
} | ||
} |
Oops, something went wrong.