From 4bf56a5918dea8ccf4063266737594bb87abddae Mon Sep 17 00:00:00 2001 From: William Brawner Date: Sat, 16 Nov 2024 16:45:34 -0700 Subject: [PATCH] fixup! Enable predictive back gesture --- .../main/java/com/wbrawner/pihelper/MainActivity.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/wbrawner/pihelper/MainActivity.kt b/app/src/main/java/com/wbrawner/pihelper/MainActivity.kt index f7e9975..2e07be2 100644 --- a/app/src/main/java/com/wbrawner/pihelper/MainActivity.kt +++ b/app/src/main/java/com/wbrawner/pihelper/MainActivity.kt @@ -4,17 +4,15 @@ import android.animation.ObjectAnimator import android.os.Build import android.os.Bundle import android.view.View -import android.view.WindowInsetsController import android.view.animation.AnticipateInterpolator +import androidx.activity.compose.BackHandler import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import androidx.compose.animation.ExperimentalAnimationApi -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.runtime.* import androidx.compose.ui.tooling.preview.Preview import androidx.core.animation.doOnEnd -import androidx.core.content.ContextCompat import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable @@ -42,6 +40,9 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) enableEdgeToEdge() setContent { + BackHandler { + store.dispatch(Action.Back) + } val launchIntent = remember { intent } LaunchedEffect(launchIntent) { ShortcutActions.fromIntentAction(launchIntent.action)?.let { action -> @@ -107,10 +108,6 @@ class MainActivity : AppCompatActivity() { } } } - - override fun onBackPressed() { - store.dispatch(Action.Back) - } } @Composable