android - How can I be notified when a Snackbar has dismissed itself? -
i'm using snackbar com.android.support:design:22.2.0
library. i'm using undo deletions. make life easier, i'm going make ui things deleted data source, , if undo button in snack bar not pressed, perform deletions data source. so, want know when snackbar no longer visible, it's safe delete items.
i can call getview() on snackbar, i'm not sure listener should using. tried setonsystemuivisibilitychangelistener()
didn't work, believe system status bar.
additionally, snackbar can not extended, has private constructor.
google design library supports snackbar callbacks in version 23. see snackbar docs , callback docs. notified when snackbar gets dismissed (and when shown) , type of dismissal if useful you:
snackbar.addcallback(new snackbar.callback() { @override public void ondismissed(snackbar snackbar, int event) { //see snackbar.callback docs event details ... } @override public void onshown(snackbar snackbar) { ... } });
Comments
Post a Comment