Giter Site home page Giter Site logo

Clear Shimmer about shimmer-android HOT 19 CLOSED

facebook avatar facebook commented on May 3, 2024 5
Clear Shimmer

from shimmer-android.

Comments (19)

zsweigart avatar zsweigart commented on May 3, 2024 5

Shouldn't the ShimmerFrameLayout contain the views? Or are you thinking of using RelativeLayout or FrameLayout parent view group that holds the shimmer and the image view and overlays them?

I was also able to achieve clearing by doing this:

shimmerFrameLayout.setShimmer(
  new Shimmer.AlphaHighlightBuilder()
    .setBaseAlpha(1)
    .setIntensity(0)
    .build());
shimmerFrameLayout.stopShimmer();
shimmerFrameLayout.clearAnimation();

But it's pretty ugly

from shimmer-android.

xiphirx avatar xiphirx commented on May 3, 2024 1

The appropriate use there would be to use a ShimmerDrawable directly as the placeholder for Picasso while the image loads.

from shimmer-android.

xiphirx avatar xiphirx commented on May 3, 2024 1

It seems like a good compromise is letting users call setShimmer(null) to remove the shimmer. I can make that change.

from shimmer-android.

mochadwi avatar mochadwi commented on May 3, 2024 1

Shouldn't the ShimmerFrameLayout contain the views? Or are you thinking of using RelativeLayout or FrameLayout parent view group that holds the shimmer and the image view and overlays them?

I was also able to achieve clearing by doing this:

shimmerFrameLayout.setShimmer(
  new Shimmer.AlphaHighlightBuilder()
    .setBaseAlpha(1)
    .setIntensity(0)
    .build());
shimmerFrameLayout.stopShimmer();
shimmerFrameLayout.clearAnimation();

But it's pretty ugly

Nice workaround, also using setShimmer(null) much cleaner~

from shimmer-android.

xiphirx avatar xiphirx commented on May 3, 2024

Do you need to have the image inside of the ShimmerFrameLayout ? Could you instead just hide the ShimmerFrameLayout when you're done loading your image?

from shimmer-android.

xiphirx avatar xiphirx commented on May 3, 2024

Typically you have a "dummy" view inside of ShimmerFrameLayout that takes the form of the content you expect to be shown. When your content is ready you remove the ShimmerFrameLayout + the "dummy" view and show your loaded content.

from shimmer-android.

zsweigart avatar zsweigart commented on May 3, 2024

Interesting, I can give that a shot. I think this would be a nice enhancement to the API though. I'm using Picasso to load an image into my image view so it shimmers while the call is being made over the placeholder image. Then when the callback is either successful or a failure I clear the shimmer and show the image or the error image.

from shimmer-android.

DamonBaker avatar DamonBaker commented on May 3, 2024

This used to be the case in 0.1.0 where calling stopShimmerAnimation() would remove the overlay completely. This was useful when there is content already on the screen which is being "reloaded", or the user performs an action that requires additional loading. In cases like this I don't want to replace preexisting content with a dummy view.

from shimmer-android.

xiphirx avatar xiphirx commented on May 3, 2024

e7a2129

from shimmer-android.

JayyyR avatar JayyyR commented on May 3, 2024

@xiphirx any word on release with this change?

from shimmer-android.

xiphirx avatar xiphirx commented on May 3, 2024

0.4.0 was just pushed to sonatype.

from shimmer-android.

rfogar2 avatar rfogar2 commented on May 3, 2024

Old issue, but what if you want to remove the shimmer and then show it later, e.g. refreshing a page? Does setShimmer(null) mean you will have to rebuild the Shimmer instance from scratch?

from shimmer-android.

xiphirx avatar xiphirx commented on May 3, 2024

You can use the new show/hide methods 97ca4d1

from shimmer-android.

rfogar2 avatar rfogar2 commented on May 3, 2024

@xiphirx Can you cut a new release?

from shimmer-android.

xiphirx avatar xiphirx commented on May 3, 2024

https://github.com/facebook/shimmer-android/releases/tag/0.5.0

Give it a few minutes to propagate to maven central

from shimmer-android.

 avatar commented on May 3, 2024

When I am using shimmer.stopShimmer(); my app is force stoped.
shimmer is working in loop on my project.

How can i stop it.

from shimmer-android.

Shamivul avatar Shamivul commented on May 3, 2024

what happens to shimmer when onDestroy() is called after starting the animation? deos it destroy itself or does it need to be handled manually

from shimmer-android.

warrior1112 avatar warrior1112 commented on May 3, 2024

You can use the new show/hide methods 97ca4d1

thank you so much ! it helped.

from shimmer-android.

Piyush0912 avatar Piyush0912 commented on May 3, 2024

Shouldn't the ShimmerFrameLayout contain the views? Or are you thinking of using RelativeLayout or FrameLayout parent view group that holds the shimmer and the image view and overlays them?

I was also able to achieve clearing by doing this:

shimmerFrameLayout.setShimmer(
  new Shimmer.AlphaHighlightBuilder()
    .setBaseAlpha(1)
    .setIntensity(0)
    .build());
shimmerFrameLayout.stopShimmer();
shimmerFrameLayout.clearAnimation();

But it's pretty ugly

where we use this code and what we write inside .placeholder in glide library

from shimmer-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.