fix(deps): update lifecycle to v2.9.0 (#4693)
* fix(deps): update lifecycle to v2.9.0 * Remove unused code. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benoit Marty <benoit@matrix.org>
This commit is contained in:
parent
b5d1d1632e
commit
54fea47cba
2 changed files with 1 additions and 35 deletions
|
|
@ -14,7 +14,7 @@ core = "1.16.0"
|
||||||
datastore = "1.1.6"
|
datastore = "1.1.6"
|
||||||
constraintlayout = "2.2.1"
|
constraintlayout = "2.2.1"
|
||||||
constraintlayout_compose = "1.1.1"
|
constraintlayout_compose = "1.1.1"
|
||||||
lifecycle = "2.8.7"
|
lifecycle = "2.9.0"
|
||||||
activity = "1.10.1"
|
activity = "1.10.1"
|
||||||
media3 = "1.6.1"
|
media3 = "1.6.1"
|
||||||
camera = "1.4.2"
|
camera = "1.4.2"
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2023, 2024 New Vector Ltd.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
||||||
* Please see LICENSE files in the repository root for full details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.element.android.libraries.designsystem.components.keyboard
|
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.isImeVisible
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.State
|
|
||||||
import androidx.compose.runtime.rememberUpdatedState
|
|
||||||
import androidx.lifecycle.Lifecycle
|
|
||||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inspired from https://stackoverflow.com/questions/68847559/how-can-i-detect-keyboard-opening-and-closing-in-jetpack-compose
|
|
||||||
*/
|
|
||||||
enum class Keyboard {
|
|
||||||
Opened,
|
|
||||||
Closed
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: it does not work as expected...
|
|
||||||
@OptIn(ExperimentalLayoutApi::class)
|
|
||||||
@Composable
|
|
||||||
fun keyboardAsState(): State<Keyboard> {
|
|
||||||
val lifecycle = LocalLifecycleOwner.current.lifecycle
|
|
||||||
val isResumed = lifecycle.currentState == Lifecycle.State.RESUMED
|
|
||||||
return rememberUpdatedState(if (WindowInsets.isImeVisible && isResumed) Keyboard.Opened else Keyboard.Closed)
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue