kandi background
Explore Kits

shimmer-android | flexible way to add a shimmering effect | Android library

 by   facebook Java Version: 0.5.0 License: Non-SPDX

 by   facebook Java Version: 0.5.0 License: Non-SPDX

Download this library from

kandi X-RAY | shimmer-android Summary

shimmer-android is a Java library typically used in Mobile, Android applications. shimmer-android has no bugs, it has no vulnerabilities, it has build file available and it has medium support. However shimmer-android has a Non-SPDX License. You can download it from GitHub, Maven.
An easy, flexible way to add a shimmering effect to any view in an Android app.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • shimmer-android has a medium active ecosystem.
  • It has 4583 star(s) with 628 fork(s). There are 179 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 6 open issues and 78 have been closed. On average issues are closed in 106 days. There are 2 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of shimmer-android is 0.5.0
shimmer-android Support
Best in #Android
Average in #Android
shimmer-android Support
Best in #Android
Average in #Android

quality kandi Quality

  • shimmer-android has 0 bugs and 1 code smells.
shimmer-android Quality
Best in #Android
Average in #Android
shimmer-android Quality
Best in #Android
Average in #Android

securitySecurity

  • shimmer-android has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • shimmer-android code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
shimmer-android Security
Best in #Android
Average in #Android
shimmer-android Security
Best in #Android
Average in #Android

license License

  • shimmer-android has a Non-SPDX License.
  • Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.
shimmer-android License
Best in #Android
Average in #Android
shimmer-android License
Best in #Android
Average in #Android

buildReuse

  • shimmer-android releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • shimmer-android saves you 399 person hours of effort in developing the same functionality from scratch.
  • It has 949 lines of code, 72 functions and 11 files.
  • It has high code complexity. Code complexity directly impacts maintainability of the code.
shimmer-android Reuse
Best in #Android
Average in #Android
shimmer-android Reuse
Best in #Android
Average in #Android
Top functions reviewed by kandi - BETA

kandi has reviewed shimmer-android and discovered the below as its top functions. This is intended to give you an instant insight into shimmer-android implemented functionality, and help decide if they suit your requirements.

  • Draws the Shimmer image .
  • Update the shader .
  • Update the value animator .
  • Initializes the ShimmerDrawable .
  • Called when the ShimmerDrawable has changed .
  • Update the colors based on the shape
  • Update the positions of the shape
  • Set the shimmer .
  • Starts the shading process .
  • Show the highlight .

shimmer-android Key Features

An easy, flexible way to add a shimmering effect to any view in an Android app.

Rounded shimmerDrawable (facebook android-shimmer)

copy iconCopydownload iconDownload
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, 50f, 50f, mShimmerPaint);
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

private final float xRadius;
private final float yRadius;

public ShimmerDrawable(final float xRadius, final float yRadius) {
    mShimmerPaint.setAntiAlias(true);
    this.xRadius = xRadius;
    this.yRadius = yRadius;
}

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, xRadius, yRadius, mShimmerPaint);
val shimmerDrawable = ShimmerDrawable(50f, 50f)
ShimmerDrawable shimmerDrawable = new ShimmerDrawable(50f, 50f);
private final int dpToPx(final Context context,final float dp)
{
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
}
-----------------------
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, 50f, 50f, mShimmerPaint);
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

private final float xRadius;
private final float yRadius;

public ShimmerDrawable(final float xRadius, final float yRadius) {
    mShimmerPaint.setAntiAlias(true);
    this.xRadius = xRadius;
    this.yRadius = yRadius;
}

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, xRadius, yRadius, mShimmerPaint);
val shimmerDrawable = ShimmerDrawable(50f, 50f)
ShimmerDrawable shimmerDrawable = new ShimmerDrawable(50f, 50f);
private final int dpToPx(final Context context,final float dp)
{
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
}
-----------------------
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, 50f, 50f, mShimmerPaint);
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

private final float xRadius;
private final float yRadius;

public ShimmerDrawable(final float xRadius, final float yRadius) {
    mShimmerPaint.setAntiAlias(true);
    this.xRadius = xRadius;
    this.yRadius = yRadius;
}

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, xRadius, yRadius, mShimmerPaint);
val shimmerDrawable = ShimmerDrawable(50f, 50f)
ShimmerDrawable shimmerDrawable = new ShimmerDrawable(50f, 50f);
private final int dpToPx(final Context context,final float dp)
{
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
}
-----------------------
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, 50f, 50f, mShimmerPaint);
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

private final float xRadius;
private final float yRadius;

public ShimmerDrawable(final float xRadius, final float yRadius) {
    mShimmerPaint.setAntiAlias(true);
    this.xRadius = xRadius;
    this.yRadius = yRadius;
}

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, xRadius, yRadius, mShimmerPaint);
val shimmerDrawable = ShimmerDrawable(50f, 50f)
ShimmerDrawable shimmerDrawable = new ShimmerDrawable(50f, 50f);
private final int dpToPx(final Context context,final float dp)
{
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
}
-----------------------
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, 50f, 50f, mShimmerPaint);
// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

private final float xRadius;
private final float yRadius;

public ShimmerDrawable(final float xRadius, final float yRadius) {
    mShimmerPaint.setAntiAlias(true);
    this.xRadius = xRadius;
    this.yRadius = yRadius;
}

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, xRadius, yRadius, mShimmerPaint);
val shimmerDrawable = ShimmerDrawable(50f, 50f)
ShimmerDrawable shimmerDrawable = new ShimmerDrawable(50f, 50f);
private final int dpToPx(final Context context,final float dp)
{
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
}

Remove auto start from Shimmer effect programmatically (Using Shimmer-Android by Facebook)

copy iconCopydownload iconDownload
shimmerFrameLayout.setShimmer(Shimmer.AlphaHighlightBuilder().setAutoStart(false).build())

Community Discussions

Trending Discussions on shimmer-android
  • Rounded shimmerDrawable (facebook android-shimmer)
  • Remove auto start from Shimmer effect programmatically (Using Shimmer-Android by Facebook)
Trending Discussions on shimmer-android

QUESTION

Rounded shimmerDrawable (facebook android-shimmer)

Asked 2021-Jun-09 at 16:52
val shimmer = ColorHighlightBuilder()
            .setBaseColor(ContextCompat.getColor(context, R.color.skeleton_mask))
            .setBaseAlpha(SHIMMERING_BASE_ALPHA)
            .setHighlightAlpha(SHIMMERING_HIGHLIGHT_ALPHA)
            .setHighlightColor(ContextCompat.getColor(context, R.color.skeleton_shimmer))
            .setDuration(SHIMMERING_DURATION)
            .setDirection(Shimmer.Direction.LEFT_TO_RIGHT)
            .setAutoStart(true)
            .build()

val shimmerDrawable = ShimmerDrawable()
shimmerDrawable.setShimmer(shimmer)

Problem: this drawable has Rect shape, which is being shimmered.

But i want it to be Rect with rounded corners. Is there any solutions, except contributing to library and modifying ShimmerDrawable ? Maybe some wrapping into another drawable, idk

This library has issue about rounded corners https://github.com/facebook/shimmer-android/issues/84 but only solution available is wrapping view holding this drawable with CardView, i do not want this

ANSWER

Answered 2021-Jun-09 at 16:52

Well looking at the source code of ShimmerDrawable.java, it's not that hard to implement what you want. There are several things that needs to be changed slightly.

// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, 50f, 50f, mShimmerPaint);

And that is it. But you probably want to modify it a little bit more for your own convenience. If so, ignore the above code and follow the following code.

// private final Rect mDrawRect = new Rect();
private final RectF mDrawRect = new RectF();

private final float xRadius;
private final float yRadius;

public ShimmerDrawable(final float xRadius, final float yRadius) {
    mShimmerPaint.setAntiAlias(true);
    this.xRadius = xRadius;
    this.yRadius = yRadius;
}

...

// canvas.drawRect(mDrawRect, mShimmerPaint);
canvas.drawRoundRect(mDrawRect, xRadius, yRadius, mShimmerPaint);

Later, you can create a ShimmerDrawable with:

  • Kotlin
val shimmerDrawable = ShimmerDrawable(50f, 50f)
  • Java
ShimmerDrawable shimmerDrawable = new ShimmerDrawable(50f, 50f);

And to be portable across different screen densities, you might also want to convert the values of xRadius and yRadius before creating the ShimmerDrawable.

private final int dpToPx(final Context context,final float dp)
{
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
}

Source https://stackoverflow.com/questions/67788355

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install shimmer-android

You can download it from GitHub, Maven.
You can use shimmer-android like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the shimmer-android component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.