Add animations

- right to left swipe
- left to right swipe
- top down swipe
This commit is contained in:
Finn M Glas 2020-06-18 10:17:04 +02:00
parent 0c3a267d62
commit 68cf994c41
No known key found for this signature in database
GPG key ID: 902A30146014DFBF
4 changed files with 33 additions and 3 deletions

View file

@ -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

View 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>

View 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>

View 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>