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

Not smooth animation for a list view with items of different height #21

Closed
alexeyr15 opened this issue Sep 28, 2014 · 13 comments · Fixed by #26
Closed

Not smooth animation for a list view with items of different height #21

alexeyr15 opened this issue Sep 28, 2014 · 13 comments · Fixed by #26

Comments

@alexeyr15
Copy link

If items of a list view have different height, then animation to show/hide FAB when scrolling isn't smooth sometimes. I think it is due to assumption in getListViewScrollY method that all items have the same height.

@ViliusKraujutis
Copy link
Contributor

True... I've fixed this in my project. Will try to contribute changes here this evening.

@alexeyr15
Copy link
Author

Sorry, but I still have not smooth animation when showing/hiding FAB on scrolling a list view of items with diferent height. I think this issue should be reopened.

@makovkastar
Copy link
Owner

@alexey-rabets have you updated the library dependency to the version 1.0.4? I tested it on the list with different height items and an animation was smooth.

@alexeyr15
Copy link
Author

Yes, I've updated to 1.0.4. I can create and share a demo which reproduces the issue.

@makovkastar
Copy link
Owner

Please, it will help.

@alexeyr15
Copy link
Author

I have modified your sample to demonstrate the issue:
https://github.com/alexey-rabets/FloatingActionButton.git

@makovkastar
Copy link
Owner

Thanks, I'll check.

@makovkastar makovkastar reopened this Oct 12, 2014
@sreichholf
Copy link
Contributor

Hi,

the current approach is (fully) broken for lists with items of different heights.
I myself do have a list with headers that are about 1/8th of the size of a normal list item (wonder what happens to the height calculation).
The only proper approach i know of is where you check two conditions:

  1. Did the first visibile change? Yes -> The index change show the direction, reset all "y pixels scrolled" values to firstVisibleitem's getTop() value.
  2. No -> check how much firstVisibleItem.getTop() has changed and in which direction.

The downside is, raising the scroll events purely based on the minimum significant scroll value is not possible this way. But I honestly think that's worth the gain in reliability.

I couldn't finish that approach yesterday evening but i may find some time this weekend.

@sreichholf
Copy link
Contributor

here's my version of a (as far as I've tested) reliable ScrollDirectionDetector which I am using with my slightly customized FloatingActionButton:

https://gist.github.com/anonymous/b3c82c1854da45b6ae57

@makovkastar
Copy link
Owner

@sreichholf Thanks! Could you send a pull request? I'll review and merge it.

@makovkastar
Copy link
Owner

@alexey-rabets The issue seems finally to be resolved. I'll push an update to the Maven Central soon. For now could you check with the latest code base from the repo if the FAB works now with list with different items height?

@alexeyr15
Copy link
Author

Yes, it works now. Thanks!

@makovkastar
Copy link
Owner

Fine, I'll close the issue.

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

Successfully merging a pull request may close this issue.

4 participants