1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

Animate left/right out

This commit is contained in:
M66B 2019-05-03 21:06:36 +02:00
parent d596221a0e
commit 0797aefb7b
3 changed files with 23 additions and 2 deletions

View file

@ -2612,6 +2612,7 @@ public class FragmentMessages extends FragmentBase {
getFragmentManager().popBackStack("thread", FragmentManager.POP_BACK_STACK_INCLUSIVE);
getArguments().putBoolean("fade", true);
getArguments().putBoolean("left", left);
Bundle nargs = new Bundle();
nargs.putLong("account", message.account);
@ -2853,15 +2854,15 @@ public class FragmentMessages extends FragmentBase {
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
Bundle args = getArguments();
Boolean left = (Boolean) args.get("left");
if (viewType == AdapterMessage.ViewType.THREAD && args != null) {
if (enter) {
Boolean left = (Boolean) args.get("left");
if (left != null)
return AnimationUtils.loadAnimation(getContext(), left ? R.anim.enter_from_left : R.anim.enter_from_right);
} else {
if (args.getBoolean("fade")) {
args.remove("fade");
return AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_out);
return AnimationUtils.loadAnimation(getContext(), left ? R.anim.leave_to_right : R.anim.leave_to_left);
}
}
}

View file

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

View file

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