Fix media viewer not being dismissed with reduced motion enabled (#5555)
This is also called 'remove animations' in some Android versions. It seems like the associated coroutine dispatcher never allows the `delay` calls to complete, or maybe they take too long and the coroutine is cancelled before they finish.
This commit is contained in:
parent
ebe94f873e
commit
c0d6862b6e
2 changed files with 26 additions and 1 deletions
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright 2025 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.androidutils.system
|
||||
|
||||
import android.content.Context
|
||||
import android.provider.Settings
|
||||
|
||||
fun Context.getAnimationScale(): Float {
|
||||
return Settings.Global.getFloat(contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, 1.0f)
|
||||
}
|
||||
|
||||
fun Context.areAnimationsEnabled(): Boolean {
|
||||
return getAnimationScale() > 0f
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue