From 68cf994c4147e7f8af8cac0a640dacc3cc1b9f89 Mon Sep 17 00:00:00 2001 From: Finn M Glas Date: Thu, 18 Jun 2020 10:17:04 +0200 Subject: [PATCH] Add animations - right to left swipe - left to right swipe - top down swipe --- .../main/java/com/finnmglas/launcher/HomeActivity.kt | 6 +++--- app/src/main/res/anim/left_right.xml | 10 ++++++++++ app/src/main/res/anim/right_left.xml | 10 ++++++++++ app/src/main/res/anim/top_down.xml | 10 ++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/anim/left_right.xml create mode 100644 app/src/main/res/anim/right_left.xml create mode 100644 app/src/main/res/anim/top_down.xml diff --git a/app/src/main/java/com/finnmglas/launcher/HomeActivity.kt b/app/src/main/java/com/finnmglas/launcher/HomeActivity.kt index 5535b3f..bf9ca61 100644 --- a/app/src/main/java/com/finnmglas/launcher/HomeActivity.kt +++ b/app/src/main/java/com/finnmglas/launcher/HomeActivity.kt @@ -145,7 +145,7 @@ class HomeActivity: UIObject, AppCompatActivity(), // Only open if the swipe was not from the phones top edge if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) { 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)) { launch(upApp, this) @@ -153,11 +153,11 @@ class HomeActivity: UIObject, AppCompatActivity(), } else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) { 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)) { launch(rightApp, this) - overridePendingTransition(0, 0) + overridePendingTransition(R.anim.left_right, android.R.anim.fade_out) } return true diff --git a/app/src/main/res/anim/left_right.xml b/app/src/main/res/anim/left_right.xml new file mode 100644 index 0000000..1dd2cb4 --- /dev/null +++ b/app/src/main/res/anim/left_right.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/right_left.xml b/app/src/main/res/anim/right_left.xml new file mode 100644 index 0000000..58e2060 --- /dev/null +++ b/app/src/main/res/anim/right_left.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/top_down.xml b/app/src/main/res/anim/top_down.xml new file mode 100644 index 0000000..239c475 --- /dev/null +++ b/app/src/main/res/anim/top_down.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file