Skip to content

Instantly share code, notes, and snippets.

@gabornovakp
Last active January 13, 2017 19:17
Show Gist options
  • Save gabornovakp/7e412b70d92e20fd831c938341f6bfaf to your computer and use it in GitHub Desktop.
Save gabornovakp/7e412b70d92e20fd831c938341f6bfaf to your computer and use it in GitHub Desktop.
DetailFragment dismiss
public class DetailFragment extends Fragment implements Dismissible, ... {
public static final String ARG_REVEAL_SETTINGS = "ARG_REVEAL_SETTINGS";
//...
@Override
public void dismiss(OnDismissedListener listener) {
AnimationUtils.startCircularRevealExitAnimation(getContext(), getView(), (RevealAnimationSetting) getArguments().getParcelable(ARG_REVEAL_SETTINGS), getColor(R.color.white), getColor(R.color.prezi_blue), new AnimationFinishedListener() {
@Override
public void onAnimationFinished() {
listener.onDismissed();
}
});
}
}
//From the Activity call this in e.g. onBackPress
((Dismissible) detailFragment).dismiss(new Dismissible.OnDismissedListener() {
@Override
public void onDismissed() {
getSupportFragmentManager().beginTransaction().remove(detailFragment).commitAllowingStateLoss();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment