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

Set correct default value for toggleExpandable and collapse #925

Merged
merged 6 commits into from
Oct 9, 2020

Conversation

Ceees2
Copy link
Contributor

@Ceees2 Ceees2 commented Oct 8, 2020

This caused onBind being called while animations are running resulting in weird behaviour of animations.

Docs also suggest this should be false.

@mikepenz
Copy link
Owner

mikepenz commented Oct 9, 2020

@Ceees2 can you please highlight which weird behaviour of animations you see?

I believe in this case the documentation is outdated

- update gradle build tools
- update compileSDK
- update build tools
- update various dependencies to their latest stable version
@Ceees2
Copy link
Contributor Author

Ceees2 commented Oct 9, 2020

@mikepenz

Took some recordings from the example app. In the first example you can see the arrow at the top right already being rotated up, while the animation is still running. In the second example this is not the case. Since this animation is pretty fast it's barely noticable (I slowed it down in the recording). If there are slower animations this is more present.

With notifyItemChanged = true
before

With notifyItemChanged = false
after

In SimpleSubExpandableItem.onBind() the rotation is set:

if (isExpanded) {
    holder.icon.rotation = 0f
} else {
    holder.icon.rotation = 180f
}

With notifyItemChanged = true the onBind is being called resulting in the rotation being set while the animation for the rotation is still running.

Hope this is more clear.

@mikepenz
Copy link
Owner

mikepenz commented Oct 9, 2020

@Ceees2 thanks for the examples. that's interesting. I am still hesitating though as this would mean a behaviour change which may break apps.


Could you please rebase on dev to fix the build issue

@Ceees2
Copy link
Contributor Author

Ceees2 commented Oct 9, 2020

@mikepenz Another solution could be changing toggleExpandable(pos), to toggleExpandable(pos, false) at line 173 in the onClick.

Currently "fixed" it in our app by checking if animation is null or not in the onBind().

@mikepenz
Copy link
Owner

mikepenz commented Oct 9, 2020

I'll add a flag so users can modify that behaviour :)

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 this pull request may close these issues.

None yet

2 participants