Android: Take RTL layout into account for menu animations

This commit is contained in:
JosJuice 2020-08-17 19:37:05 +02:00
parent 32061c95d4
commit ac17e49243
9 changed files with 90 additions and 8 deletions

View File

@ -491,10 +491,10 @@ public final class EmulationActivity extends AppCompatActivity
Fragment fragment = MenuFragment.newInstance(mSelectedTitle); Fragment fragment = MenuFragment.newInstance(mSelectedTitle);
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.setCustomAnimations( .setCustomAnimations(
R.animator.menu_slide_in_from_left, R.animator.menu_slide_in_from_start,
R.animator.menu_slide_out_to_left, R.animator.menu_slide_out_to_start,
R.animator.menu_slide_in_from_left, R.animator.menu_slide_in_from_start,
R.animator.menu_slide_out_to_left) R.animator.menu_slide_out_to_start)
.add(R.id.frame_menu, fragment) .add(R.id.frame_menu, fragment)
.addToBackStack(BACKSTACK_NAME_MENU) .addToBackStack(BACKSTACK_NAME_MENU)
.commit(); .commit();
@ -1235,10 +1235,10 @@ public final class EmulationActivity extends AppCompatActivity
Fragment fragment = SaveLoadStateFragment.newInstance(saveOrLoad); Fragment fragment = SaveLoadStateFragment.newInstance(saveOrLoad);
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.setCustomAnimations( .setCustomAnimations(
R.animator.menu_slide_in_from_right, R.animator.menu_slide_in_from_end,
R.animator.menu_slide_out_to_right, R.animator.menu_slide_out_to_end,
R.animator.menu_slide_in_from_right, R.animator.menu_slide_in_from_end,
R.animator.menu_slide_out_to_right) R.animator.menu_slide_out_to_end)
.replace(R.id.frame_submenu, fragment) .replace(R.id.frame_submenu, fragment)
.addToBackStack(BACKSTACK_NAME_SUBMENU) .addToBackStack(BACKSTACK_NAME_SUBMENU)
.commit(); .commit();

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:propertyName="translationX"
android:valueType="floatType"
android:valueFrom="-1280dp"
android:valueTo="0"
android:interpolator="@android:interpolator/decelerate_quad"
android:duration="300"/>
<objectAnimator
android:propertyName="alpha"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="1"
android:interpolator="@android:interpolator/accelerate_quad"
android:duration="300"/>
</set>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:propertyName="translationX"
android:valueType="floatType"
android:valueFrom="1280dp"
android:valueTo="0"
android:interpolator="@android:interpolator/decelerate_quad"
android:duration="300"/>
<objectAnimator
android:propertyName="alpha"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="1"
android:interpolator="@android:interpolator/accelerate_quad"
android:duration="300"/>
</set>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This animation is used ONLY when a submenu is replaced. -->
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="translationX"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="-1280dp"
android:interpolator="@android:interpolator/decelerate_quad"
android:duration="200"/>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="alpha"
android:valueType="floatType"
android:valueFrom="1"
android:valueTo="0"
android:interpolator="@android:interpolator/decelerate_quad"
android:duration="200"/>
</set>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This animation is used ONLY when a submenu is replaced. -->
<objectAnimator
android:propertyName="translationX"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="1280dp"
android:interpolator="@android:interpolator/decelerate_quad"
android:duration="200"/>
<objectAnimator
android:propertyName="alpha"
android:valueType="floatType"
android:valueFrom="1"
android:valueTo="0"
android:interpolator="@android:interpolator/decelerate_quad"
android:duration="200"/>
</set>