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
SnackBar Interaction. #90
Comments
Currently it's not implemented for the FAB. It must be implemented by yourself. Please check #33 for details. |
You can try something like fab.animate().translationYBy(snackbarheight) in the show callback from your snackbar library (Nispok Snackbar is what I use). |
That does not work well because this library also changes the translationY value for things like appearing and disappearing when attached to AbsListView, RecyclerView or ScrollView. This causes animation artifacts since the external and internal changes to translationY conflict. |
If you set translationY then that is very well possible, but I'm using relative values with translationYBy and I haven't encountered any artifacts so far. Maybe I'm just lucky. |
translationYBy() is just a shortcut method that is also applied to the translationY property in the end. The documentation at http://developer.android.com/reference/android/view/ViewPropertyAnimator.html states "This method will cause the View's translationY property to be animated by the specified value. Animations already running on the property will be canceled.". So it certainly can cause conflicts with the FAB animation. I tested this plus several other approaches and i always got problems on some api level or another and the only thing that "somehow worked" was to modify this library as i did on #76 . I can not give more details on the issues i got using translationYBy() since it has been a while and i have since switched to https://github.com/futuresimple/android-floating-action-button/ and https://github.com/nispok/snackbar/ where it is really easy to make the FAB and the snackbars have proper and matching animations. |
I actually switched to futuresimple FABs and nispoks SBars. Spent the day yesterday and it was an absolute breeze getting it right, even got my SysUI interaction solved. Thanks a lot guys. You revived this issue out of no where and it fixed 3 things in my app I was right in the middle of doing at the time. Really crazy timing. But worked out great. So thank you. |
Great!, i am glad you got it working. And sorry for reviving this so late, but it was not until a few days ago that i remembered my pending pull request here. Material libraries are still quite new and it has required quite a lot of work and contributing to other projects to get things working in our apps. I am happy that i helped with some of the changes in nispok's snackbar that allowed the FAB integration and animations to work so smoothly with the futuresimple FABs :) |
Without contribs I'd be no where. I pretty much learned all I know from libs and repos. Side question, feels odd asking on this lib. But do you know a way to dismiss nispoks snackbar with a swipe down? Can't seem to figure it out. |
If i remember correctly it only supports swiping it horizontally. I personally don't use this feature, but i think it could be done by modifying https://github.com/nispok/snackbar/blob/master/lib/src/main/java/com/nispok/snackbar/listeners/SwipeDismissTouchListener.java and just change the X logic to the Y axis and viceversa. It may also require some logic to forbid dismissing the snackbar by going up instead of down. It would be good to check if the material design guidelines say something about which direction should be used to dismiss snackbars. If the recommendation is to swipe them down as you suggest you could even try to open an issue or a pull request in nispok project so it becomes the default. |
I may ask if it could be made default. I'd guess its been asked. I want it like Gmail has basically. Swipe down or button click to dismiss. I think its meant to be like that. If the SB comes up it should be dismissed by pulling down. Idk for sure though. They change them so much. Thank you all the same. |
I can't seem to figure out how to set the fabs to push up/down on a SnackBar show/hide.
I read it's setMovement...
However I can't get it to work.
Thanks,
Jon.
The text was updated successfully, but these errors were encountered: