Giter Site home page Giter Site logo

Comments (8)

mikepenz avatar mikepenz commented on May 26, 2024

@Ceees2 you can modify this behaviour by configuring notifyOnAutoToggleExpandable within the ExpandableExtension

https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.kt#L103

It's used here when we toggle the expandable state for the clicked item:
https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.kt#L168
to:
https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.kt#L309
to:
https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.kt#L401-L404

If you don't notify this item, you'd need to make sure alternatively to highlight any indicator that it's expanded

from fastadapter.

Ceees2 avatar Ceees2 commented on May 26, 2024

@Ceees2 you can modify this behaviour by configuring notifyOnAutoToggleExpandable within the ExpandableExtension

https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.kt#L103

It's used here when we toggle the expandable state for the clicked item: https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.kt#L168 to: https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.kt#L309 to: https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.kt#L401-L404

If you don't notify this item, you'd need to make sure alternatively to highlight any indicator that it's expanded

I know, that was my proposed solution in the linked PR, but I feel like that is more a work around than an actual solution. notifyOnAutoToggleExpandable false is fixing the animation issue, but causes the inability to used the extensions expand or collapse since click listeners wont be called and thus no animations. notifyOnAutoToggleExpandable true would somewhat fix that issue but can cause any unwanted animation behaviour. The linked PR also shows this behaviour is actually present in the current example app.

Might also just be that I'm trying to do something thats just not possible, but not giving up yet.

from fastadapter.

mikepenz avatar mikepenz commented on May 26, 2024

Sorry, missed that this was the exact thing you had linked.

One potential solution would be to do the notify with a payload in this case, so you could manually handle the bind in case of the existence of the payload, allowing you to update the UI?

https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int,%20java.lang.Object)

from fastadapter.

Ceees2 avatar Ceees2 commented on May 26, 2024

Sorry, missed that this was the exact thing you had linked.

One potential solution would be to do the notify with a payload in this case, so you could manually handle the bind in case of the existence of the payload, allowing you to update the UI?

https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int,%20java.lang.Object)

I thought about that, but that would mean updating the expand and collapse methods wouldn't it?

Would it also be possible to call bindView/unbindView with the current view instead of creating a new view. Seems like that's also causing issues for animations if the starting state of the view (when starting the animation) is different than when the view is created initially. eg the jumping of the expand icon; when the item is expanded and you want to collapse, the icon jumps to the collapsed rotation(since the view is being recreated), then immediately back to the expanded rotation and then the animation starts to rotate it back to collapse.

from fastadapter.

mikepenz avatar mikepenz commented on May 26, 2024

@Ceees2 it will mean we have to update the extension, but it would still be a good option, and consumers of the SDK can start acting on it optionally.

No it's not anticipated to call bindView/unbindView with the current view as those methods are called by the RecyclerView as the RV will properly handle recycling the re-use of views, and any interception of that is most likely causing significant issues.

The animation parts can all be handled by making use of the payload, as within the bindView the RV will make sure the right view is provided (reused or new) and based on the payload you can then run the animation

from fastadapter.

Ceees2 avatar Ceees2 commented on May 26, 2024

That was fast, thanks for all your work.

from fastadapter.

Ceees2 avatar Ceees2 commented on May 26, 2024

Works like a charm, I've completely removed the click listener triggering the animation and am using the payload now to determine if animations should be shown, and no need to use notifyOnAutoToggleExpandable = false anymore. All in all nice change, thanks a bunch. 👌

If wanted I can also open a PR updating and applying these changes in the expand example in the fast adapter example app @mikepenz

from fastadapter.

mikepenz avatar mikepenz commented on May 26, 2024

@Ceees2 that's awesome news. Glad it works that great for you.

And yes definitely. Always happy about contributions 😀

from fastadapter.

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.