mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Animate left/right out
This commit is contained in:
parent
d596221a0e
commit
0797aefb7b
3 changed files with 23 additions and 2 deletions
|
@ -2612,6 +2612,7 @@ public class FragmentMessages extends FragmentBase {
|
||||||
getFragmentManager().popBackStack("thread", FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
getFragmentManager().popBackStack("thread", FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
|
|
||||||
getArguments().putBoolean("fade", true);
|
getArguments().putBoolean("fade", true);
|
||||||
|
getArguments().putBoolean("left", left);
|
||||||
|
|
||||||
Bundle nargs = new Bundle();
|
Bundle nargs = new Bundle();
|
||||||
nargs.putLong("account", message.account);
|
nargs.putLong("account", message.account);
|
||||||
|
@ -2853,15 +2854,15 @@ public class FragmentMessages extends FragmentBase {
|
||||||
@Override
|
@Override
|
||||||
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
|
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
|
Boolean left = (Boolean) args.get("left");
|
||||||
if (viewType == AdapterMessage.ViewType.THREAD && args != null) {
|
if (viewType == AdapterMessage.ViewType.THREAD && args != null) {
|
||||||
if (enter) {
|
if (enter) {
|
||||||
Boolean left = (Boolean) args.get("left");
|
|
||||||
if (left != null)
|
if (left != null)
|
||||||
return AnimationUtils.loadAnimation(getContext(), left ? R.anim.enter_from_left : R.anim.enter_from_right);
|
return AnimationUtils.loadAnimation(getContext(), left ? R.anim.enter_from_left : R.anim.enter_from_right);
|
||||||
} else {
|
} else {
|
||||||
if (args.getBoolean("fade")) {
|
if (args.getBoolean("fade")) {
|
||||||
args.remove("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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
app/src/main/res/anim/leave_to_left.xml
Normal file
10
app/src/main/res/anim/leave_to_left.xml
Normal 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>
|
10
app/src/main/res/anim/leave_to_right.xml
Normal file
10
app/src/main/res/anim/leave_to_right.xml
Normal 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>
|
Loading…
Reference in a new issue