Add Bitwarden Horizontal Divider (#3967)

This commit is contained in:
David Perez 2024-09-25 14:27:24 -05:00 committed by GitHub
parent caa0c613a5
commit ad154b6c91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 55 additions and 54 deletions

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@ -37,6 +36,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect
import com.x8bit.bitwarden.ui.platform.base.util.standardHorizontalMargin
import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar
import com.x8bit.bitwarden.ui.platform.components.card.BitwardenActionCard
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
@ -115,7 +115,7 @@ fun MasterPasswordGuidanceScreen(
),
)
}
HorizontalDivider(color = MaterialTheme.colorScheme.outline)
BitwardenHorizontalDivider(color = MaterialTheme.colorScheme.outline)
Column(
modifier = Modifier
.fillMaxWidth()

View file

@ -15,7 +15,6 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@ -37,6 +36,7 @@ import com.x8bit.bitwarden.R
import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect
import com.x8bit.bitwarden.ui.platform.base.util.standardHorizontalMargin
import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
@ -117,7 +117,7 @@ private fun NeverLoseAccessContent(
modifier = Modifier.padding(horizontal = 24.dp),
)
Spacer(modifier = Modifier.height(24.dp))
HorizontalDivider(color = MaterialTheme.colorScheme.outline)
BitwardenHorizontalDivider(color = MaterialTheme.colorScheme.outline)
Spacer(modifier = Modifier.height(16.dp))
AccountRecoveryTipRow(
title = stringResource(R.string.create_a_hint),
@ -128,7 +128,7 @@ private fun NeverLoseAccessContent(
modifier = Modifier.padding(horizontal = 16.dp),
)
Spacer(modifier = Modifier.height(16.dp))
HorizontalDivider(color = MaterialTheme.colorScheme.outline)
BitwardenHorizontalDivider(color = MaterialTheme.colorScheme.outline)
Spacer(modifier = Modifier.height(16.dp))
AccountRecoveryTipRow(
title = stringResource(R.string.write_your_password_down),

View file

@ -22,7 +22,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@ -52,6 +51,7 @@ import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenLogoutConfirma
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenRemovalConfirmationDialog
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenSelectionDialog
import com.x8bit.bitwarden.ui.platform.components.dialog.row.BitwardenBasicDialogRow
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
import com.x8bit.bitwarden.ui.platform.components.model.AccountSummary
import com.x8bit.bitwarden.ui.platform.components.scrim.BitwardenAnimatedScrim
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
@ -240,10 +240,7 @@ private fun AnimatedAccountSwitcher(
.fillMaxWidth()
.padding(horizontal = 16.dp),
)
HorizontalDivider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
)
BitwardenHorizontalDivider()
}
if (accountSummaries.size < MAXIMUM_ACCOUNT_LIMIT && isAddAccountAvailable) {
item {

View file

@ -0,0 +1,30 @@
package com.x8bit.bitwarden.ui.platform.components.divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
/**
* A divider line.
*
* @param modifier The [Modifier] to be applied to this divider.
* @param thickness The thickness of this divider. Using [Dp.Hairline] will produce a single pixel
* divider regardless of screen density.
* @param color The color of this divider.
*/
@Composable
fun BitwardenHorizontalDivider(
modifier: Modifier = Modifier,
thickness: Dp = 1.dp,
color: Color = MaterialTheme.colorScheme.outlineVariant,
) {
HorizontalDivider(
modifier = modifier,
thickness = thickness,
color = color,
)
}

View file

@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.ripple
@ -19,6 +18,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
/**
* Represents a clickable row of text and can contains an optional [content] that appears to the
@ -88,11 +88,7 @@ fun BitwardenTextRow(
content?.invoke()
}
if (withDivider) {
HorizontalDivider(
modifier = Modifier.padding(start = 16.dp),
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
)
BitwardenHorizontalDivider(modifier = Modifier.padding(start = 16.dp))
}
}
}

View file

@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
@ -32,6 +31,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.standardHorizontalMargin
import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar
import com.x8bit.bitwarden.ui.platform.components.appbar.NavigationIcon
import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText
import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
@ -123,14 +123,14 @@ private fun FeatureFlagContent(
modifier = Modifier.standardHorizontalMargin(),
)
Spacer(modifier = Modifier.height(8.dp))
HorizontalDivider()
BitwardenHorizontalDivider()
featureFlagMap.forEach { featureFlag ->
featureFlag.key.ListItemContent(
currentValue = featureFlag.value,
onValueChange = onValueChange,
modifier = Modifier.standardHorizontalMargin(),
)
HorizontalDivider()
BitwardenHorizontalDivider()
}
Spacer(modifier = Modifier.height(12.dp))
BitwardenFilledButton(
@ -156,7 +156,7 @@ private fun OnboardingOverrideContent(
modifier = Modifier.standardHorizontalMargin(),
)
Spacer(modifier = Modifier.height(8.dp))
HorizontalDivider()
BitwardenHorizontalDivider()
Spacer(modifier = Modifier.height(12.dp))
BitwardenFilledButton(
label = stringResource(R.string.restart_onboarding_cta),

View file

@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@ -43,6 +42,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect
import com.x8bit.bitwarden.ui.platform.base.util.Text
import com.x8bit.bitwarden.ui.platform.base.util.asText
import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
import com.x8bit.bitwarden.ui.platform.components.row.BitwardenExternalLinkRow
import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold
import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenWideSwitch
@ -278,11 +278,7 @@ private fun CopyRow(
tint = MaterialTheme.colorScheme.onSurface,
)
}
HorizontalDivider(
modifier = Modifier.padding(start = 16.dp),
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
)
BitwardenHorizontalDivider(modifier = Modifier.padding(start = 16.dp))
}
}

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
@ -36,6 +35,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect
import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar
import com.x8bit.bitwarden.ui.platform.components.appbar.action.BitwardenOverflowActionItem
import com.x8bit.bitwarden.ui.platform.components.appbar.action.OverflowMenuItemData
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter
import kotlinx.collections.immutable.persistentListOf
@ -173,11 +173,7 @@ private fun PasswordHistoryContent(
.fillMaxWidth()
.padding(horizontal = 16.dp),
)
HorizontalDivider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
modifier = Modifier.fillMaxWidth(),
)
BitwardenHorizontalDivider(modifier = Modifier.fillMaxWidth())
}
item {
Spacer(modifier = Modifier.navigationBarsPadding())

View file

@ -7,8 +7,6 @@ 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.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@ -21,6 +19,7 @@ import androidx.compose.ui.unit.dp
import com.x8bit.bitwarden.R
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenMasterPasswordDialog
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderTextWithSupportLabel
import com.x8bit.bitwarden.ui.platform.components.listitem.BitwardenGroupItem
import com.x8bit.bitwarden.ui.platform.components.listitem.BitwardenListItem
@ -172,9 +171,7 @@ fun VaultItemListingContent(
if (state.shouldShowDivider) {
item {
HorizontalDivider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
BitwardenHorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(all = 16.dp),

View file

@ -6,14 +6,13 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.x8bit.bitwarden.R
import com.x8bit.bitwarden.ui.platform.components.divider.BitwardenHorizontalDivider
import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderTextWithSupportLabel
import com.x8bit.bitwarden.ui.platform.components.listitem.BitwardenGroupItem
import com.x8bit.bitwarden.ui.platform.components.model.toIconResources
@ -112,9 +111,7 @@ fun VaultContent(
}
item {
HorizontalDivider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
BitwardenHorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(all = 16.dp),
@ -198,9 +195,7 @@ fun VaultContent(
if (state.folderItems.isNotEmpty()) {
item {
HorizontalDivider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
BitwardenHorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(all = 16.dp),
@ -238,9 +233,7 @@ fun VaultContent(
if (state.noFolderItems.isNotEmpty()) {
item {
HorizontalDivider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
BitwardenHorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(all = 16.dp),
@ -287,9 +280,7 @@ fun VaultContent(
if (state.collectionItems.isNotEmpty()) {
item {
HorizontalDivider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
BitwardenHorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(all = 16.dp),
@ -322,9 +313,7 @@ fun VaultContent(
}
item {
HorizontalDivider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
BitwardenHorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(all = 16.dp),