Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
flipButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (mCardSideShowing.equals(CardSide.FRONT)) {
getActivity().getFragmentManager()
.beginTransaction()
.setCustomAnimations(R.animator.card_flip_right_in, R.animator.card_flip_right_out, R.animator.card_flip_left_in, R.animator.card_flip_left_out)
.replace(R.id.card_fragment_container, new CardBackFragment())
.commit();
mCardSideShowing = CardSide.BACK;
} else if (mCardSideShowing.equals(CardSide.BACK)) {
getActivity().getFragmentManager()
.beginTransaction()
.setCustomAnimations(R.animator.card_flip_right_in, R.animator.card_flip_right_out, R.animator.card_flip_left_in, R.animator.card_flip_left_out)
.replace(R.id.card_fragment_container, new CardFrontFragment())
.commit();
mCardSideShowing = CardSide.FRONT;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment