Comments (12)
@xiphirx I have the same problem. When I call stopShimmer on my given ShimmerFrameLayout, the shimmer animation is not stopping. Internally it is calling the value animator cancel method, but it is still not stopping the animation.
The library seems to have a problem with the internal state of the ShimmerFrameLayout because it actually does not matter if I call startShimmer/stopShimmer on the view. The animation will always be executed. I tested this by simply creating a new project and including the relevant ShimmerFrameLayout without calling any methods.
Here is a snippet of my code:
@JvmStatic
@BindingAdapter("image")
fun setImage(view: ImageView, imageUrl: String?) {
imageUrl?.run {
(view.parent as? ShimmerFrameLayout)?.startShimmer()
var requestOptions = RequestOptions()
requestOptions = requestOptions.transforms(CenterCrop(), RoundedCorners(2))
GlideApp.with(view)
.load(imageUrl)
.centerCrop()
.placeholder(R.drawable.preview_panel_loading_image)
.apply(requestOptions)
.listener(object: RequestListener<Drawable> {
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
(view.parent as? ShimmerFrameLayout)?.stopShimmer()
return false
}
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
(view.parent as? ShimmerFrameLayout)?.stopShimmer()
return false
}
})
.into(view)
}
}
from shimmer-android.
I just found out that the library is using custom layout parameter for the ShimmerFrameLayout. After setting the value, I was able to disable the auto start behaviour and use the methods instead. You should update the documentation to include this behaviour. Currently that is something that wasn't clear to me at the beginning. I expected that auto_start is false by default (especially due to your example that showed "how to start the shimmer animation".
Regarding the ShimmerDrawable, how I can I use that as a placeholder inside glide. I cannot find any reference to this drawable.
from shimmer-android.
I just tested this in the sample app and the library is functioning correctly. Please attach a project reproducing the error.
from shimmer-android.
It starts automatically when not calling anything because auto start is true by default. Can you verify that view.parent
is actually a ShimmerFrameLayout
? I cannot reproduce the same behavior in the sample app. You may also want to just use ShimmerDrawable
directly as Glide's placeholder since its an ImageView
.
from shimmer-android.
You can use ShimmerDrawable
like any other drawable and set the same Shimmer
object on it. In fact, ShimmerFrameLayout
is just a thin wrapper that just delegates to ShimmerDrawable
.
I'd imagine you could do something like
Shimmer shimmer = Shimmer...;
ShimmerDrawable d = new ShimmerDrawable();
d.setShimmer(shimmer);
GlideApp.with(view).load(imageUrl).placeholder(d)...
I'll look into updating the docs to be clear-er, thanks.
from shimmer-android.
@xiphirx Thanks for your answer. As I wrote in my last reply, there's no available reference to ShimmerDrawable in the library (at least Android Studio cannot find this class). Are you certain that the version 0.2 is including this object?
from shimmer-android.
Oh sorry, it's going to be in the next version. I should probably cut a new release soon
from shimmer-android.
@xiphirx When are you planning to do that? Sometime next week or later?
from shimmer-android.
Yes please, I am also waiting for the next version soon, I hope it will address all these problems. Thanks
from shimmer-android.
from shimmer-android.
@xiphirx Thanks for the new version! :)
from shimmer-android.
How to make the ShimmerDrawable rounded? I cannot change the color of the shimmer drawable.
from shimmer-android.
Related Issues (20)
- Animation is not working in the dark mode HOT 5
- What is BUCK file for?
- ❓ ❓ ❓ How to show shining or glare/mirror/shimmer/shine effect on a view ❓ ❓ ❓ HOT 1
- Stop shimmer is not working Facebook shimmer HOT 1
- Shimmer layout crashing illegal state exception Unable create shimmer layout
- Change Facebook Icon to Meta Icon ?
- When is the release of the new version (0.6.0) of the library expected?
- TramondeaPlease don't delete the code style settings.
- Does facebook-Shimmer include log4j internally?
- Android resource linking failed
- use recycled bitmap error HOT 2
- Support for passing default style by theme attribute
- ShimmerDrawable not working with View.LAYER_TYPE_HARDWARE HOT 1
- Release 0.6.0 version HOT 3
- Asynchronous animation for items in a RecyclerView
- How to create shimmer effect around a custom path in android
- Viewpager2: Shimmer on RecyclerViews freezes UI HOT 1
- Question - Can we ignore any child view(s) from shimmering?
- Animation status when set visibility to GONE HOT 2
- 导入不进去,啥情况 HOT 1
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 shimmer-android.