Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-30 16:48:26 +03:00
parent acf110dbcc
commit 6910f74fd9
242 changed files with 866 additions and 732 deletions

View file

@ -20,8 +20,8 @@ class DefaultDeviceFlipDetector @Inject constructor(
) : DeviceFlipDetector, DefaultLifecycleObserver {
private val sensorManager = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager
private var gravitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY)
private var isResumedState = AtomicBoolean(false)
private val gravitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY)
private val isResumedState = AtomicBoolean(false)
override fun onPause(owner: LifecycleOwner) {
isResumedState.set(false)

View file

@ -17,9 +17,9 @@ internal class FlipListener(private val action: () -> Unit) : SensorEventListene
}
override fun onSensorChanged(event: SensorEvent?) {
event?.let {
if (event != null) {
val currentTime = SystemClock.elapsedRealtime()
val zAxisValue = it.values[2]
val zAxisValue = event.values[2]
if (zAxisValue < zAxisThreshold && !isScreenDown) {
isScreenDown = true