Merge branch 'develop' into feature/fga/room-version-upgrade
This commit is contained in:
commit
88573fd2ae
116 changed files with 1287 additions and 979 deletions
|
|
@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Arrangement
|
|||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
|
@ -27,6 +28,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
* will be smaller.
|
||||
*/
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun Dp.applyScaleDown(): Dp = with(LocalDensity.current) {
|
||||
return this@applyScaleDown * fontScale.coerceAtMost(1f)
|
||||
}
|
||||
|
|
@ -37,6 +39,7 @@ fun Dp.applyScaleDown(): Dp = with(LocalDensity.current) {
|
|||
* will be bigger.
|
||||
*/
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun Dp.applyScaleUp(): Dp = with(LocalDensity.current) {
|
||||
return this@applyScaleUp * fontScale.coerceAtLeast(1f)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
package io.element.android.libraries.designsystem.text
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
|
|
@ -17,6 +18,7 @@ import androidx.compose.ui.unit.TextUnit
|
|||
* Can be used for instance to use Dp unit for text.
|
||||
*/
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun Dp.toSp(): TextUnit = with(LocalDensity.current) { toSp() }
|
||||
|
||||
/**
|
||||
|
|
@ -24,22 +26,26 @@ fun Dp.toSp(): TextUnit = with(LocalDensity.current) { toSp() }
|
|||
* Can be used for instance to use Sp unit for size.
|
||||
*/
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun TextUnit.toDp(): Dp = with(LocalDensity.current) { toDp() }
|
||||
|
||||
/**
|
||||
* Convert Px value to Dp, regarding current density.
|
||||
*/
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun Int.toDp(): Dp = with(LocalDensity.current) { toDp() }
|
||||
|
||||
/**
|
||||
* Convert Dp value to pixels, regarding current density.
|
||||
*/
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun Dp.toPx(): Float = with(LocalDensity.current) { toPx() }
|
||||
|
||||
/**
|
||||
* Convert Dp value to pixels, regarding current density.
|
||||
*/
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun Dp.roundToPx(): Int = with(LocalDensity.current) { roundToPx() }
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ package io.element.android.libraries.designsystem.utils
|
|||
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun WindowInsets.copy(
|
||||
top: Int? = null,
|
||||
right: Int? = null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue