Comments (19)
Hey Shamyl, can i use this in sticky header?: findLastCompletelyVisibleItemPosition
from stickyheaders.
the scenario was I have 3 section all has header, no footer, 1st and 2nd section each has one child item, but 3rd has 10 child items, all section was open, section 3 was sticky on top and clicked header to collapse section 3, then everything is disappeared.
from stickyheaders.
I'm on vacation in Hawaii, Burt I'll take a look at this when I have the
opportunity.
On Fri, Nov 18, 2016, 6:16 AM EzimetYusup [email protected] wrote:
the scenario was I have 3 section all has header, no footer, 1st and 2nd
section each has one child item, but 3rd has 10 child items, all section
was open, section 3 was sticky on top and clicked header to collapse
section 3, then everything is disappeared.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#35 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABqa9EIWoxHxsu3odR-BwdAjwIH9ZzaVks5q_c93gaJpZM4K2mt6
.
Shamyl Zakariya
https://shamylzakariya.github.io/
from stickyheaders.
@ShamylZakariya Cool, Enjoy ur vacation, just ping me when u get a chance to look at.
from stickyheaders.
Hey, I've looked at the method in question, and replacing +=2
with +=1
may fix it for your use case, but it will break everything else. The +=2
is there to handle the header and its "ghost header" (the item used by the library to track natural position of headers).
So I need to figure out a more comprehensive fix. Can you make me a minimal demo app which reproduces this? You can use the library's demo code as a skeleton.
from stickyheaders.
@ShamylZakariya Sure, I can make one and will let u know!
from stickyheaders.
Hey @ShamylZakariya change this line to https://github.com/ShamylZakariya/StickyHeaders/blob/master/app/src/main/java/org/zakariya/stickyheadersapp/ui/CollapsingSectionsDemoActivity.java#L19
adapter = new SimpleDemoAdapter(3, 10, false, false, true, SHOW_ADAPTER_POSITIONS);
from stickyheaders.
@ShamylZakariya I found that in this case, when calling notifyItemRemoved method of RecyclerView, the position is not correct. maybe @mmangliers knows better.
from stickyheaders.
Hey @ShamylZakariya ! did you get any chance to take a look at it?
from stickyheaders.
from stickyheaders.
@ShamylZakariya Ok cool! thanks!
from stickyheaders.
@EzimetYusup Can you try updating your repo? I've pushed a few changes to update the gradle files, which includes bringing in recyclerview 25.0.1. This new version of recyclerview seems to fix a long standing bug I was experiencing, and it also seems to not fix per se but change how your bug manifests.
What I'm seeing now is that instead of going blank, the recyclerview scrolls to the top.
Let me know if you can confirm this behavior.
Obviously, I'm still going to do my best to track this down.
from stickyheaders.
@EzimetYusup BTW, how did you encode that animated GIF? It's much better looking than my screen recordings.
from stickyheaders.
@ShamylZakariya hey, thanks for getting back to me, I did not get chance to update the repo today, will do tomorrow.
this is what I used:
from stickyheaders.
Hey @ShamylZakariya , I just upgraded the repo, and found that the bug is still exist, unless I do offset += 1;
from stickyheaders.
@ShamylZakariya is this offset += 1; change, breaking something?
from stickyheaders.
@EzimetYusup It breaks the method: the +2
is required, because StickyHeaderLayoutManager
vends two headers per section. One which is placed in its natural position, and which doesn't draw anything, and a second one which is the visible, sticky one. Because is uses two headers, the adapter position must be advanced by two steps.
I am looking into a fix for this, but the switch from += 2
to += 1
breaks functionality of that method.
from stickyheaders.
Easy fix in onLayoutChildren:
firstViewAdapterPosition = state.getItemCount() - 1;
instead of setting to 0 (first item) on screen clear, set to last item. I can make a pull request if you want but it's a pretty tiny fix
from stickyheaders.
First of all, I'm sorry for my bad English.
Not sure if there are some one could fixed this issue but I found a way to overcome it.
I found a problem with the firstViewTop variable in StickyHeaderLayoutManager. Its value might decrease to minus thousands, so when the section is collapse, it will pull entire view to that position. So everything looks disappeared but in fact, it still there but has been hung in very "high" position. And you cannot pull it down. If there is any header remain on screen, click on it several times and you will see everything come back. Log the firstViewTop and you will see how it happens.
My solution is quiet ugly, but it works.
I created an interface and implemented it in the activity.
@Override public void onHeaderClicked(int index) { recyclerView.scrollToPosition(index); }
Whenever I click on the header, I call that function, passing the section index from getAdapterPositionForSectionHeader(holder.getSection())
and the recyclerView will scroll itself to the header, prevent it to be pulled away to the firstViewTop.
Not a good idea, but it solved the problem and help me to avoid using huge lib like FlexibleAdapter.
from stickyheaders.
Related Issues (20)
- Class cast exception after upgrading to android x HOT 1
- Disabling item section collapsing on open HOT 2
- Publish version 0.7.9 to Maven HOT 4
- IndexOutOfBoundsException HOT 6
- How to set setStackFromEnd??
- Accessibility using StickyHeaders HOT 1
- App Crashing If the List size is 0. HOT 2
- Custom Scroll Behaviour
- wrap_content not working
- notifySectionItemChanged() crashes the app
- How to include grid layout with sticky headers ?
- This lib doesn't seem to support clipToPadding = false on RecyclerView
- Item size 0 , crash the app. HOT 1
- jcenter is deprecated. Move to mavencentral HOT 2
- how to get the current sticky section?
- StickyHeaderLayoutManager doesn't display scroll bars HOT 4
- Refactor AndroidX HOT 5
- StickyLayoutManager does not work in kotlin and recycler view appears empty HOT 1
- when user scroll the page, data changed in rows !
- Some problems when use this with smartRefreshLayout
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stickyheaders.