[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake-mobile/master] Changed animation slide



commit 0156264f010aa95346276ed4fbf3e7cf4d0a93bd
Author: Hashik Donthineni <HashikDonthineni@xxxxxxxxx>
Date:   Wed Aug 12 20:08:02 2020 +0530

    Changed animation slide
---
 .../java/org/torproject/snowflake/MainActivity.java     | 17 +----------------
 app/src/main/res/anim/frag_entry_slide.xml              | 10 ++++++++++
 app/src/main/res/anim/frag_exit_slide.xml               | 10 ++++++++++
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/app/src/main/java/org/torproject/snowflake/MainActivity.java b/app/src/main/java/org/torproject/snowflake/MainActivity.java
index 64cfb8b..aa1692c 100644
--- a/app/src/main/java/org/torproject/snowflake/MainActivity.java
+++ b/app/src/main/java/org/torproject/snowflake/MainActivity.java
@@ -89,24 +89,9 @@ public class MainActivity extends AppCompatActivity implements MainFragmentCallb
 
         Log.d(TAG, "startFragment: " + currentFragment);
 
-        //////Animation
-
-        Slide slideTransition;
-        //This defines how the fragment moves. Either from left to right or right to left.
-        int gravity = transitionToggle ? Gravity.END : Gravity.START;
-        transitionToggle = !transitionToggle;
-        if (Build.VERSION.SDK_INT > 21) {
-            slideTransition = new Slide(gravity);
-        } else {
-            slideTransition = new Slide(GravityCompat.getAbsoluteGravity(gravity, getResources().getConfiguration().getLayoutDirection()));
-        }
-        slideTransition.setDuration(400);
-
-        fragment.setEnterTransition(slideTransition);
-        //////
-
         getSupportFragmentManager()
                 .beginTransaction()
+                .setCustomAnimations(R.anim.frag_entry_slide, R.anim.frag_exit_slide)
                 .replace(R.id.fragment_container,
                         fragment, Integer.toString(currentFragment)).commit();
     }
diff --git a/app/src/main/res/anim/frag_entry_slide.xml b/app/src/main/res/anim/frag_entry_slide.xml
new file mode 100644
index 0000000..3bd58a3
--- /dev/null
+++ b/app/src/main/res/anim/frag_entry_slide.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android";
+    android:shareInterpolator="false">
+    <translate
+        android:duration="@android:integer/config_mediumAnimTime"
+        android:fromXDelta="-100%"
+        android:fromYDelta="0%"
+        android:toXDelta="0%"
+        android:toYDelta="0%" />
+</set>
\ No newline at end of file
diff --git a/app/src/main/res/anim/frag_exit_slide.xml b/app/src/main/res/anim/frag_exit_slide.xml
new file mode 100644
index 0000000..16335d0
--- /dev/null
+++ b/app/src/main/res/anim/frag_exit_slide.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android";
+    android:shareInterpolator="false">
+    <translate
+        android:duration="@android:integer/config_mediumAnimTime"
+        android:fromXDelta="0%"
+        android:fromYDelta="0%"
+        android:toXDelta="100%"
+        android:toYDelta="0%" />
+</set>
\ No newline at end of file

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits