Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

stopShimmer leaves ShimmerDrawable visible #85

Closed
ScottCooper92 opened this issue Jun 22, 2019 · 4 comments
Closed

stopShimmer leaves ShimmerDrawable visible #85

ScottCooper92 opened this issue Jun 22, 2019 · 4 comments

Comments

@ScottCooper92
Copy link
Contributor

I might be using this library differently from how it was intended but I think this issue could be any easy fix.

I have my RecyclerView inside the ShimmerFrameLayout, when the view is first created RecyclerViewAdapter is given a list of null and the adapter represents each of the nulls by creating placeholder ViewHolders, I then tell the ShimmerFrameLayout to start shimmering.

Once content has arrived the nulls are replaced with actual data and the ViewHolders are populated, the shimmering is then stopped using stopShimmer(). The issue is that the mShimmerDrawable in ShimmerFrameLayout is still displayed meaning the content is masked.

I can work around this by setting the shimmer to null when stopping it and then adding it again when starting like so:

shimmerLayout.stopShimmer()
shimmerLayout.setShimmer(null)
shimmerLayout.setShimmer(Shimmer.AlphaHighlightBuilder().build())
shimmerLayout.startShimmer()

Can this be handled internally by either hiding the drawable when stopping or through some other means?

@Subroid
Copy link

Subroid commented Jun 24, 2019

I think the separate layout has to be provided for shimmer layout. Check this article https://medium.com/mindorks/android-design-shimmer-effect-fa7f74c68a93

@xiphirx
Copy link
Contributor

xiphirx commented Jun 24, 2019

stopShimmer stops the shimmering animation, if you want it completely gone, then you do need to setShimmer(null). Adding hideShimmer, showShimmer methods seems fine, though.

@xiphirx
Copy link
Contributor

xiphirx commented Jun 24, 2019

PR for that is certainly welcome if you're up for it :)

facebook-github-bot pushed a commit that referenced this issue Jun 28, 2019
Summary:
PR for #85

It doesn't seem like the best implementation since I'm just nulling the Shimmer but it does the job.

I've tested this in the sample app by depending on the library project rather than the snapshot and added another button for toggling it on and off but haven't included any of that in this PR. If you would like me to I'll update it.
Pull Request resolved: #86

Differential Revision: D16053297

Pulled By: xiphirx

fbshipit-source-id: 9f50e1f56c1f2272fbb2da70dbea3680da6e03f1
@ScottCooper92
Copy link
Contributor Author

Closed as part of #86

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants