Skip to content
master
Go to file
Code

Latest commit

Summary:
`ShimmerDrawable` does not work too well when used as the inner drawable of an `InsetDrawable`.

Consider the following code

```
InsetDrawable wrapShimmerDrawableWithInset(ShimmerDrawable shimmerDrawable) {
  return new InsetDrawable(shimmerDrawable, 10)
}
```

Instead of producing a drawable that is inset by 10px on all sides, this will instead produce a drawable visually that:

- Has no inset on the top or left
- Has an inset of 20 on the bottom and right

This is because we're not taking into account the starting position of the bounds passed to `ShimmerDrawable` in `onBoundsChange()`, assuming that we're always starting at `0, 0` (which is not the case when used inside an `InsetDrawable`.

Fixing up by instead obeying the bounds given to through `ShimmerDrawable#onBoundsChanged()` when calculating our drawing rect.

Reviewed By: xiphirx

Differential Revision: D22869773

fbshipit-source-id: d7bcfcc7f4f6a09e25b1cab4355222c75daea8e7
39a90c7

Git stats

Files

Permalink
Failed to load latest commit information.

README.md

Shimmer
Shimmer for Android

Shimmer is an Android library that provides an easy way to add a shimmer effect to any view in your Android app.

It is useful as an unobtrusive loading indicator, and was originally developed for Facebook Home.

Find more examples and usage instructions over at:

facebook.github.io/shimmer-android

License

BSD License

For shimmer-android software

Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name Facebook nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

You can’t perform that action at this time.