Yalantis / Phoenix

Phoenix Pull-to-Refresh
https://yalantis.com/
Apache License 2.0
4.01k stars 916 forks source link

Integration with observable list view #3

Closed jamescategory closed 9 years ago

jamescategory commented 9 years ago

I'm using pull-to-refresh-rentals with observable scroll view (https://github.com/ksoichiro/Android-ObservableScrollView) in my application (the code is almost identical to the StickyHeaderListView sample code in observable-scrollview source code). However the pull to refresh image (the sky and building) gets covered by the toolbars provided by observablescrollview.

I've played a lot with the padding and layout-margintop of pull-to-refresh but it seems that there is no decent solution for this. I tried to use some code trick to add and remove layout-margin top to pull to refresh but it leads to strange not smooth behavior. Another not-so-good solution is to set the setVisibility of toolbars to VISIBILITY.GONE in onRefresh() but not a very good solution.

I attached a screenshot of the problem during the pull to refresh action. You can see the two redundant big white spaces (white spaces beneath the toolbars appear during pull to refresh) and also the pictures are covered by toolbars.

I was wondering if there is a way to make these two libraries work together in peace :)

shliama commented 9 years ago

@jamescategory thanks for all the details. I'll try to find out a fix for you asap. |(• ◡•)| peace

jamescategory commented 9 years ago

@shliama Thanks a lot! looking forward to see a solution to this. btw, I just noticed I have forgotten to attach the screenshot :) here we go: https://www.dropbox.com/s/07mg7iy9fedcrnx/Screenshot_2015-02-17-10-32-59_1.jpg?dl=0

shliama commented 9 years ago

Hi, sorry for the huge delay, but I haven't had enough time recently.

So, I've looked at the StickyHeaderListView sample, and reproduced the same issue from your screenshot. Unfrortunately, it seems there is no easy workaround for this issue. As you can see, those two redundant white spaces are in fact 1st and 2nd "fake" list items that are covered with headers. And the headers are just views that are above the ListView.

Well, if you really want to combine these two libraries, my advice is to include my library as module (not via gradle, you'll need to change library code), and play with methods that set initial position of the refresh layout (you shouldn't add top margin). In the PullToRefreshView class, you will see that for default offset I'm using in methods to move/animate the refresh view is (mTarget.getTop()) that's just top point of the list view, so maybe you might try to add there height of those two fake list items. Also those two fake list items must be transparent - so they don't cover refresh view. Plus, while list view is refreshing, scrolling it up will hide the header, this issue must be fixed somehow too.

tosslife commented 9 years ago

@jamescategory hi! do you achieve it ?

jamescategory commented 9 years ago

@shliama thanks a lot of the detailed guide. I messed around a lot with it but I couldn't make it work properly. I was under pressure to meet a deadline so I had to give up. Perhaps in the future I revisit the problem gain. But again, thank you very much for your help :)

shliama commented 9 years ago

@jamescategory you're welcome :) Unfortunately it's hard to create a library that is compatible with other libraries on the internet. We all use some hacks and workarounds to achieve custom / non-native look and feel of our components, therefore it's not a surprise that they may conflict with each-other ¯(ツ)