Format project

This commit is contained in:
Benoit Marty 2022-12-09 10:25:11 +01:00
parent e9a3dec6e9
commit a413b635d1
142 changed files with 840 additions and 518 deletions

View file

@ -6,7 +6,6 @@ import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.remember
import io.element.android.x.core.BuildConfig
// Note the inline function below which ensures that this function is essentially
// copied at the call site to ensure that its logging only recompositions from the
// original call site.
@ -19,4 +18,4 @@ inline fun LogCompositions(tag: String, msg: String) {
}
}
class Ref(var value: Int)
class Ref(var value: Int)

View file

@ -12,7 +12,7 @@ import androidx.lifecycle.LifecycleOwner
fun OnLifecycleEvent(onEvent: (owner: LifecycleOwner, event: Lifecycle.Event) -> Unit) {
val eventHandler = rememberUpdatedState(onEvent)
val lifecycleOwner = rememberUpdatedState(LocalLifecycleOwner.current)
DisposableEffect(lifecycleOwner.value) {
val lifecycle = lifecycleOwner.value.lifecycle
val observer = LifecycleEventObserver { owner, event ->
@ -24,4 +24,4 @@ fun OnLifecycleEvent(onEvent: (owner: LifecycleOwner, event: Lifecycle.Event) ->
lifecycle.removeObserver(observer)
}
}
}
}

View file

@ -5,7 +5,6 @@ import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@Composable
public fun textFieldState(stateValue: String): MutableState<String> =
remember(stateValue) { mutableStateOf(stateValue) }
remember(stateValue) { mutableStateOf(stateValue) }

View file

@ -24,18 +24,18 @@ class DimensionConverter(val resources: Resources) {
@Px
fun dpToPx(dp: Int): Int {
return TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
dp.toFloat(),
resources.displayMetrics
TypedValue.COMPLEX_UNIT_DIP,
dp.toFloat(),
resources.displayMetrics
).toInt()
}
@Px
fun spToPx(sp: Int): Int {
return TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_SP,
sp.toFloat(),
resources.displayMetrics
TypedValue.COMPLEX_UNIT_SP,
sp.toFloat(),
resources.displayMetrics
).toInt()
}

View file

@ -35,9 +35,9 @@ fun View.showKeyboard(andRequestFocus: Boolean = false) {
fun View.setHorizontalPadding(padding: Int) {
setPadding(
padding,
paddingTop,
padding,
paddingBottom
padding,
paddingTop,
padding,
paddingBottom
)
}