fixup! Enable predictive back gesture

This commit is contained in:
William Brawner 2024-11-16 16:45:34 -07:00
parent d533682af6
commit 4bf56a5918
Signed by: wbrawner
GPG key ID: 8FF12381C6C90D35

View file

@ -4,17 +4,15 @@ import android.animation.ObjectAnimator
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.WindowInsetsController
import android.view.animation.AnticipateInterpolator import android.view.animation.AnticipateInterpolator
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.core.animation.doOnEnd import androidx.core.animation.doOnEnd
import androidx.core.content.ContextCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.navigation.compose.NavHost import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable import androidx.navigation.compose.composable
@ -42,6 +40,9 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
enableEdgeToEdge() enableEdgeToEdge()
setContent { setContent {
BackHandler {
store.dispatch(Action.Back)
}
val launchIntent = remember { intent } val launchIntent = remember { intent }
LaunchedEffect(launchIntent) { LaunchedEffect(launchIntent) {
ShortcutActions.fromIntentAction(launchIntent.action)?.let { action -> ShortcutActions.fromIntentAction(launchIntent.action)?.let { action ->
@ -107,10 +108,6 @@ class MainActivity : AppCompatActivity() {
} }
} }
} }
override fun onBackPressed() {
store.dispatch(Action.Back)
}
} }
@Composable @Composable