Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag (or somethin)? #24

Closed
noties opened this issue Nov 25, 2014 · 10 comments
Closed

Tag (or somethin)? #24

noties opened this issue Nov 25, 2014 · 10 comments

Comments

@noties
Copy link

noties commented Nov 25, 2014

Hey!
First of all - thanks for a superb library.
Secondly - maybe it would be nice to have a String tag (or something) to identify a Snackbar and update already showing, or simply remove the previous Snack?

@davidjrichardson
Copy link
Contributor

There is a file in the sample app named SnackbarManager.java or similar that does something similar to what you're requesting. Maybe have a look at that and modify/extend it where needed?

@wmora
Copy link
Contributor

wmora commented Nov 25, 2014

I agree that you can use something similar to the SnackbarManager from the sample app for this. Were you thinking of a different approach?

@davidjrichardson
Copy link
Contributor

I think the approach suggested here is to be similar to that of Fragments, where you can add a Fragment to a layout with a specific tag attribute (of type string) so you can call getFragmentByTag(String) on the FragmentManager.

@wmora
Copy link
Contributor

wmora commented Nov 25, 2014

Right, then in that case the SnackbarManager would do the trick. Since a Snackbar extends a LinearLayout, it already supports the setTag()/setId() and getTag()/getId() methods. Then the SnackbarManager can get the desired Snackbar from its tag

@davidjrichardson
Copy link
Contributor

Would it be reasonable to provide a SnackbarManager along with the library, then, rather than providing one in the sample application?

@wmora
Copy link
Contributor

wmora commented Nov 25, 2014

That would be a good idea, I'll try to work on it later this week.

@noties
Copy link
Author

noties commented Nov 26, 2014

Hi!
Yep, I've missed sample app... But, guess that setting tag on a view would not be a very good idea (since we are attaching to a root frame of an activity, calling findViewByTag would traverse through all view hierarchy), so I've ended up with creating a SnackbarManager ( gist ).
BTW I had to use Handler approach, because Snackbar doesn't have onDismissListener, how come? )

@wmora
Copy link
Contributor

wmora commented Nov 26, 2014

It does, the EventListener provides an onDismiss event

@wmora
Copy link
Contributor

wmora commented Dec 18, 2014

@davidjrichardson @noties a little late, but version 2.6.0 provides the first version of a SnackbarManager. Hope it helps

@wmora
Copy link
Contributor

wmora commented Dec 24, 2014

I'll consider this closed since a SnackbarManager is now included with the lib.

@wmora wmora closed this as completed Dec 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants