I recently switched to have a single activity (thanks to mortar & flow) which I then switch full screen views instead of starting new activities with the following code.
setAnimation(direction, oldChild, newChild);
// Out with the old, in with the new.
if (oldChild != null) container.removeView(oldChild);
container.addView(newChild);
}
protected void setAnimation(Flow.Direction direction, View oldChild, View newChild) {
if (oldChild == null) return;
int out = direction == Flow.Direction.FORWARD ? R.anim.slide_out_to_left : R.anim.slide_out_to_right;
int in = direction == Flow.Direction.FORWARD ? R.anim.slide_in_from_right : R.anim.slide_in_from_left;
oldChild.setAnimation(loadAnimation(context, out));
newChild.setAnimation(loadAnimation(context, in));
}
This transition is exactly how I used to transition between activities
activity.startActivity();
activity.overridePendingTransition(R.anim.slide_in_from_right, R.anim.nudge_out_to_left);
To me both the view and activity transitions should render the same but what I am seeing is that there is something extra going on in the activity transition. There is some sort of fade out as well.
Anyone know how I can get views transitioning to look identical to 2 activities transitioning? I'd love to fully move to an approach of not needing more than one activity but would hate to have to lose the smoothness of the activity transitions