Improve launch app gesture transition
This commit is contained in:
parent
738817ec14
commit
96182c88c3
@ -1,10 +1,12 @@
|
|||||||
package de.mm20.launcher2.ui.launcher
|
package de.mm20.launcher2.ui.launcher
|
||||||
|
|
||||||
import android.app.ActivityOptions
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.Rect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.core.app.ActivityOptionsCompat
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.asLiveData
|
import androidx.lifecycle.asLiveData
|
||||||
@ -211,10 +213,13 @@ class LauncherScaffoldVM : ViewModel(), KoinComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GestureAction.LaunchApp -> {
|
GestureAction.LaunchApp -> {
|
||||||
val options = ActivityOptions.makeCustomAnimation(
|
val view = (context as Activity).window.decorView
|
||||||
context,
|
val options = ActivityOptionsCompat.makeScaleUpAnimation(
|
||||||
android.R.anim.fade_in,
|
view,
|
||||||
android.R.anim.fade_out,
|
0,
|
||||||
|
0,
|
||||||
|
view.width,
|
||||||
|
view.height
|
||||||
)
|
)
|
||||||
when (gesture) {
|
when (gesture) {
|
||||||
Gesture.SwipeLeft -> gestureState.value.swipeLeftApp
|
Gesture.SwipeLeft -> gestureState.value.swipeLeftApp
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user