generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 28
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 bottomba…
…r-navigation # Conflicts: # app/src/main/kotlin/com/x8bit/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingGraphNavigation.kt # app/src/main/res/values/strings.xml
- Loading branch information
Showing
23 changed files
with
1,473 additions
and
6 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
50 changes: 50 additions & 0 deletions
50
...in/com/x8bit/bitwarden/authenticator/ui/authenticator/feature/search/ItemSearchContent.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,50 @@ | ||
package com.x8bit.bitwarden.authenticator.ui.authenticator.feature.search | ||
|
||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.navigationBarsPadding | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.x8bit.bitwarden.authenticator.ui.authenticator.feature.search.handlers.SearchHandlers | ||
|
||
/** | ||
* The content state for the item search screen. | ||
*/ | ||
@Composable | ||
fun ItemSearchContent( | ||
viewState: ItemSearchState.ViewState.Content, | ||
searchHandlers: SearchHandlers, | ||
modifier: Modifier = Modifier, | ||
) { | ||
LazyColumn(modifier = modifier) { | ||
items(viewState.displayItems) { | ||
VaultVerificationCodeItem( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding( | ||
start = 16.dp, | ||
// There is some built-in padding to the menu button that makes up | ||
// the visual difference here. | ||
end = 12.dp, | ||
), | ||
authCode = it.authCode, | ||
issuer = it.issuer, | ||
periodSeconds = it.periodSeconds, | ||
timeLeftSeconds = it.timeLeftSeconds, | ||
alertThresholdSeconds = it.alertThresholdSeconds, | ||
supportingLabel = it.supportingLabel, | ||
startIcon = it.startIcon, | ||
onCopyClick = { searchHandlers.onItemClick(it.id) }, | ||
onItemClick = { searchHandlers.onItemClick(it.id) }, | ||
) | ||
} | ||
|
||
item { | ||
Spacer(modifier = Modifier.navigationBarsPadding()) | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
...m/x8bit/bitwarden/authenticator/ui/authenticator/feature/search/ItemSearchEmptyContent.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,62 @@ | ||
package com.x8bit.bitwarden.authenticator.ui.authenticator.feature.search | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.navigationBarsPadding | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
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.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import com.x8bit.bitwarden.authenticator.R | ||
|
||
/** | ||
* The empty state for the item search screen. | ||
*/ | ||
@Composable | ||
fun ItemSearchEmptyContent( | ||
viewState: ItemSearchState.ViewState.Empty, | ||
modifier: Modifier = Modifier, | ||
) { | ||
Column( | ||
modifier = modifier, | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_search_24px), | ||
contentDescription = null, | ||
tint = MaterialTheme.colorScheme.onSurfaceVariant, | ||
modifier = Modifier | ||
.size(74.dp) | ||
.padding(horizontal = 16.dp), | ||
) | ||
|
||
Spacer(modifier = Modifier.height(24.dp)) | ||
|
||
viewState.message?.let { | ||
Text( | ||
textAlign = TextAlign.Center, | ||
modifier = Modifier | ||
.semantics { testTag = "NoSearchResultsLabel" } | ||
.fillMaxWidth() | ||
.padding(horizontal = 16.dp), | ||
text = it(), | ||
style = MaterialTheme.typography.bodyMedium, | ||
) | ||
} | ||
|
||
Spacer(modifier = Modifier.navigationBarsPadding()) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...com/x8bit/bitwarden/authenticator/ui/authenticator/feature/search/ItemSearchNavigation.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,29 @@ | ||
package com.x8bit.bitwarden.authenticator.ui.authenticator.feature.search | ||
|
||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import com.x8bit.bitwarden.authenticator.ui.platform.base.util.composableWithSlideTransitions | ||
|
||
const val ITEM_SEARCH_ROUTE = "item_search" | ||
|
||
/** | ||
* Add item search destination to the nav graph. | ||
*/ | ||
fun NavGraphBuilder.itemSearchDestination( | ||
onNavigateBack: () -> Unit, | ||
) { | ||
composableWithSlideTransitions( | ||
route = ITEM_SEARCH_ROUTE, | ||
) { | ||
ItemSearchScreen( | ||
onNavigateBack = onNavigateBack | ||
) | ||
} | ||
} | ||
|
||
/** | ||
* Navigate to the item search screen. | ||
*/ | ||
fun NavController.navigateToSearch() { | ||
navigate(route = ITEM_SEARCH_ROUTE) | ||
} |
Oops, something went wrong.