mirror of
https://github.com/bitwarden/android.git
synced 2025-12-13 04:42:51 -06:00
[PM-21358] Migrate PaddingValuesExtensions.kt to ui module (#5201)
This commit is contained in:
parent
dfd58822b7
commit
b4d85e07ba
@ -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.ItemListingRoute
|
||||||
import com.bitwarden.authenticator.ui.authenticator.feature.itemlisting.itemListingGraph
|
import com.bitwarden.authenticator.ui.authenticator.feature.itemlisting.itemListingGraph
|
||||||
import com.bitwarden.authenticator.ui.authenticator.feature.itemlisting.navigateToItemListGraph
|
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.scaffold.BitwardenScaffold
|
||||||
import com.bitwarden.authenticator.ui.platform.components.scrim.BitwardenAnimatedScrim
|
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.SettingsGraphRoute
|
||||||
import com.bitwarden.authenticator.ui.platform.feature.settings.navigateToSettingsGraph
|
import com.bitwarden.authenticator.ui.platform.feature.settings.navigateToSettingsGraph
|
||||||
import com.bitwarden.ui.platform.base.util.EventsEffect
|
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.base.util.toDp
|
||||||
import com.bitwarden.ui.platform.theme.RootTransitionProviders
|
import com.bitwarden.ui.platform.theme.RootTransitionProviders
|
||||||
import com.bitwarden.ui.platform.util.toObjectNavigationRoute
|
import com.bitwarden.ui.platform.util.toObjectNavigationRoute
|
||||||
|
|||||||
@ -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)
|
|
||||||
@ -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.PaddingValues
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
Loading…
x
Reference in New Issue
Block a user