Giter VIP home page Giter VIP logo

Comments (19)

FDFD1313 avatar FDFD1313 commented on August 17, 2024 1

Hey Shamyl, can i use this in sticky header?: findLastCompletelyVisibleItemPosition

from stickyheaders.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

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.

ShamylZakariya avatar ShamylZakariya commented on August 17, 2024

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.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

@ShamylZakariya Cool, Enjoy ur vacation, just ping me when u get a chance to look at.

from stickyheaders.

ShamylZakariya avatar ShamylZakariya commented on August 17, 2024

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.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

@ShamylZakariya Sure, I can make one and will let u know!

from stickyheaders.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

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);

then do following :
sticky

from stickyheaders.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

@ShamylZakariya I found that in this case, when calling notifyItemRemoved method of RecyclerView, the position is not correct. maybe @mmangliers knows better.

from stickyheaders.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

Hey @ShamylZakariya ! did you get any chance to take a look at it?

from stickyheaders.

ShamylZakariya avatar ShamylZakariya commented on August 17, 2024

from stickyheaders.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

@ShamylZakariya Ok cool! thanks!

from stickyheaders.

ShamylZakariya avatar ShamylZakariya commented on August 17, 2024

@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.

ShamylZakariya avatar ShamylZakariya commented on August 17, 2024

@EzimetYusup BTW, how did you encode that animated GIF? It's much better looking than my screen recordings.

from stickyheaders.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

@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:
screen shot 2016-11-29 at 5 55 54 pm

from stickyheaders.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

Hey @ShamylZakariya , I just upgraded the repo, and found that the bug is still exist, unless I do offset += 1;

from stickyheaders.

EzimetYusup avatar EzimetYusup commented on August 17, 2024

@ShamylZakariya is this offset += 1; change, breaking something?

from stickyheaders.

ShamylZakariya avatar ShamylZakariya commented on August 17, 2024

@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.

mmangliers avatar mmangliers commented on August 17, 2024

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.

hunganh-px avatar hunganh-px commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.