Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Last active June 22, 2018 09:48
Show Gist options
  • Save mortenjust/85c3f0776d37c715e0b8 to your computer and use it in GitHub Desktop.
Save mortenjust/85c3f0776d37c715e0b8 to your computer and use it in GitHub Desktop.
Open fragment FROM fragment, with a circular reveal. The key thing is using getChildFragmentManager, introduced in Android 4.2
long TRANS_DURATION = 300;
Log.d(TAG, "Ready to reveal mode picker");
ModeSelectorActivityFragment f = new ModeSelectorActivityFragment();
fragmentContainer.setVisibility(View.INVISIBLE);
getChildFragmentManager()
.beginTransaction()
.add(R.id.mode_list_fragment_container, f)
.commit();
int finalRadius = Math.max(fragmentContainer.getHeight(), fragmentContainer.getWidth());
Animator anim = ViewAnimationUtils.createCircularReveal(fragmentContainer, (int) touchX, (int) touchY, 0, finalRadius);
anim.setDuration(TRANS_DURATION);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
fragmentContainer.setVisibility(View.VISIBLE);
anim.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment