Last active
January 13, 2017 19:17
-
-
Save gabornovakp/7e412b70d92e20fd831c938341f6bfaf to your computer and use it in GitHub Desktop.
DetailFragment dismiss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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