mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
Add animations
- right to left swipe - left to right swipe - top down swipe
This commit is contained in:
parent
0c3a267d62
commit
68cf994c41
4 changed files with 33 additions and 3 deletions
|
@ -145,7 +145,7 @@ class HomeActivity: UIObject, AppCompatActivity(),
|
||||||
// Only open if the swipe was not from the phones top edge
|
// Only open if the swipe was not from the phones top edge
|
||||||
if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) {
|
if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) {
|
||||||
launch(downApp,this)
|
launch(downApp,this)
|
||||||
overridePendingTransition(0, 0)
|
overridePendingTransition(R.anim.top_down, android.R.anim.fade_out)
|
||||||
}
|
}
|
||||||
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) {
|
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) {
|
||||||
launch(upApp, this)
|
launch(upApp, this)
|
||||||
|
@ -153,11 +153,11 @@ class HomeActivity: UIObject, AppCompatActivity(),
|
||||||
}
|
}
|
||||||
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
||||||
launch(leftApp,this)
|
launch(leftApp,this)
|
||||||
overridePendingTransition(0, 0)
|
overridePendingTransition(R.anim.right_left, android.R.anim.fade_out)
|
||||||
}
|
}
|
||||||
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
||||||
launch(rightApp, this)
|
launch(rightApp, this)
|
||||||
overridePendingTransition(0, 0)
|
overridePendingTransition(R.anim.left_right, android.R.anim.fade_out)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
10
app/src/main/res/anim/left_right.xml
Normal file
10
app/src/main/res/anim/left_right.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:fromXDelta="-75%p"
|
||||||
|
android:toXDelta="0%p"
|
||||||
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
|
android:duration="100"/>
|
||||||
|
|
||||||
|
</set>
|
10
app/src/main/res/anim/right_left.xml
Normal file
10
app/src/main/res/anim/right_left.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:fromXDelta="75%p"
|
||||||
|
android:toXDelta="0%p"
|
||||||
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
|
android:duration="100"/>
|
||||||
|
|
||||||
|
</set>
|
10
app/src/main/res/anim/top_down.xml
Normal file
10
app/src/main/res/anim/top_down.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:fromYDelta="-75%p"
|
||||||
|
android:toYDelta="0%p"
|
||||||
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
|
android:duration="100"/>
|
||||||
|
|
||||||
|
</set>
|
Loading…
Add table
Reference in a new issue