[PM-21358] Migrate PaddingValuesExtensions.kt to ui module (#5201)

This commit is contained in:
Patrick Honkonen 2025-05-15 09:40:09 -04:00 committed by GitHub
parent dfd58822b7
commit b4d85e07ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 50 deletions

View File

@ -47,12 +47,12 @@ import com.bitwarden.authenticator.ui.authenticator.feature.itemlisting.ItemList
import com.bitwarden.authenticator.ui.authenticator.feature.itemlisting.ItemListingRoute
import com.bitwarden.authenticator.ui.authenticator.feature.itemlisting.itemListingGraph
import com.bitwarden.authenticator.ui.authenticator.feature.itemlisting.navigateToItemListGraph
import com.bitwarden.authenticator.ui.platform.base.util.max
import com.bitwarden.authenticator.ui.platform.components.scaffold.BitwardenScaffold
import com.bitwarden.authenticator.ui.platform.components.scrim.BitwardenAnimatedScrim
import com.bitwarden.authenticator.ui.platform.feature.settings.SettingsGraphRoute
import com.bitwarden.authenticator.ui.platform.feature.settings.navigateToSettingsGraph
import com.bitwarden.ui.platform.base.util.EventsEffect
import com.bitwarden.ui.platform.base.util.max
import com.bitwarden.ui.platform.base.util.toDp
import com.bitwarden.ui.platform.theme.RootTransitionProviders
import com.bitwarden.ui.platform.util.toObjectNavigationRoute

View File

@ -1,48 +0,0 @@
package com.bitwarden.authenticator.ui.platform.base.util
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.foundation.layout.calculateStartPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.unit.LayoutDirection
/**
* Compares the top, bottom, start, and end values to another [PaddingValues] and returns a new
* 'PaddingValues' using the maximum values of each property respectively.
*
* @param other The other values to compare against.
*/
fun PaddingValues.max(
other: PaddingValues,
direction: LayoutDirection,
): PaddingValues = PaddingValues(
top = maxOf(calculateTopPadding(), other.calculateTopPadding()),
bottom = maxOf(calculateBottomPadding(), other.calculateBottomPadding()),
start = maxOf(calculateStartPadding(direction), other.calculateStartPadding(direction)),
end = maxOf(calculateEndPadding(direction), other.calculateEndPadding(direction)),
)
/**
* Compares the top, bottom, start, and end values to a [WindowInsets] and returns a new
* 'PaddingValues' using the maximum values of each property respectively.
*
* @param windowInsets The [WindowInsets] to compare against.
*/
@Composable
fun PaddingValues.max(
windowInsets: WindowInsets,
): PaddingValues = max(windowInsets.asPaddingValues())
/**
* Compares the top, bottom, start, and end values to another [PaddingValues] and returns a new
* 'PaddingValues' using the maximum values of each property respectively.
*
* @param other The other [PaddingValues] to compare against.
*/
@Composable
fun PaddingValues.max(
other: PaddingValues,
): PaddingValues = max(other, LocalLayoutDirection.current)

View File

@ -1,4 +1,4 @@
package com.x8bit.bitwarden.ui.platform.base.util
package com.bitwarden.ui.platform.base.util
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets