Giter Club home page Giter Club logo

skeleton-bones's People

Contributors

eudy-contreras avatar eudycontreras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

skeleton-bones's Issues

BUG memory-leak during display-rotation with integrated skeleton in RecyclerView (sample-app)

Describe the bug
After about 50 display-rotations, there is a significant increase in memory-usage of the sample-app in the demo-2 branch.
After the initial start of the app on an API-29 emulator, the usage was about 80mb.
After the rotation-marathon, it peaked to about 148mb. After the last rotation, in rest, the usage only went down to around 129mb.
It took around 2:30 minutes to reproduce this level of memory leakage.

If I can do something to help reproduce or fix the issue, please let me know.
This is the best skeleton-library I have found so far (and the only one working comfortably with CardViews in RecyclerView, for sure), so I still want to use it in our app-project.

To Reproduce
Steps to reproduce the behavior:

  1. Go to branch demo-2
  2. Compile and run the sample-app on an emulator
  3. With the app running, rotate the emulator display in rapid succession (Hotkeys: Ctrl-Left, Ctrl-Right), with a short delay to let the UI display itself, for at least 20 times. To reach the aforementioned increase, around 50 rotations are necessary.
  4. No error is posted, the app is stable by itself, but it is only a matter of rotation-count to bring the app to a crash

Expected behavior
I expected the memory usage to stay around 80mb. In my own app-project, my app is itself also around 80mb and stays there with 4 RecyclerViews loading stuff from the internet. Integrating the Skeleton-Bones library shows the same behavior as in the sample-app, memory increased to the double amount after 40-50 rotations. This should not happen.

Screenshots
Bildschirmfoto vom 2021-01-14 14-13-56

Smartphone (please complete the following information):

  • Device: Emulator 30.3.5 with Android 10 API-Level 29 x86 ABI
  • SDK Version 29
  • Version tested with demo-2 sample app and library 1.3

Additional context
I did an analysis of the sample-app demo-2 with LeakCanary as described here:
https://square.github.io/leakcanary/fundamentals-fixing-a-memory-leak/#3-find-the-reference-causing-the-leak

The LeakCanary-dump is this:
skeleton-bones-demo2-sample-leak.log

Bug - Lib isn't working

I use this library, but now, it isn't working, I don't know why.
And the color is blue, but I was set it is gray.
Please help me.

Thank in advance.

Screenshot 2021-02-19 161147
Screenshot 2021-02-19 163032
device-2021-02-19-162947

Don't understand new API 1.4.4 and have an issue with View visibility

Hi,
I'm using version 1.4.1, and today I'm seeing new version 1.4.4. I was upgrade to this version and my code is didn't working.
Please give me a standard way to use library, I don't use data-binding

  • create a skeleton drawable for a ViewGroup
  • hide skeleton

And more, If I use library, my view has an issue, method visible of View is not working.

  • show skeleton drawable
  • [while] - init view, set view visibility is gone
  • init view done, hide skeleton -> my view is visible still.

Some logs:
Screenshot 2021-04-20 094150

java.lang.IllegalArgumentException: parameter must be a descendant of this view

java.lang.IllegalArgumentException: parameter must be a descendant of this view
at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:6388)
at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:6317)
at com.eudycontreras.boneslibrary.framework.skeletons.SkeletonBone.recompute(SkeletonBone.kt:91)
at com.eudycontreras.boneslibrary.framework.skeletons.Skeleton.recomputeAndBuild(Skeleton.kt:194)
at com.eudycontreras.boneslibrary.framework.skeletons.Skeleton.onUpdate(Skeleton.kt:96)
at com.eudycontreras.boneslibrary.framework.skeletons.SkeletonRenderer.update(SkeletonRenderer.kt:27)
at com.eudycontreras.boneslibrary.framework.skeletons.SkeletonManager$startAnimation$1.invoke(SkeletonManager.kt:194)
at com.eudycontreras.boneslibrary.framework.skeletons.SkeletonManager$startAnimation$1.invoke(SkeletonManager.kt:22)
at com.eudycontreras.boneslibrary.extensions.AnimatorExtensionsKt$animate$3.onAnimationUpdate(AnimatorExtensions.kt:71)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1579)
at android.animation.ValueAnimator.animateBasedOnTime(ValueAnimator.java:1357)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1502)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1230)
at android.view.Choreographer.doCallbacks(Choreographer.java:1029)
at android.view.Choreographer.doFrame(Choreographer.java:925)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1217)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.app.ActivityThread.main(ActivityThread.java:8212)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

Crash in release build due to missing proguard rules

Describe the bug
Everything works fine when building directly from Android Studio, but as soon as we made a release build, we got a crash:

Fatal Exception: java.lang.IllegalArgumentException: The key must be an application-specific resource id.
at android.view.View.setTag(View.java:26098)
at com.eudycontreras.boneslibrary.extensions.ViewExtensionsKt.clearProps(ViewExtensionsKt.java:153)
at com.eudycontreras.boneslibrary.framework.bones.BoneDrawable$initialize$4.invoke(BoneDrawable.kt:179)
at com.eudycontreras.boneslibrary.framework.bones.BoneDrawable$initialize$4.invoke(BoneDrawable.kt:94)
at com.eudycontreras.boneslibrary.framework.bones.BoneManager.dispose(BoneManager.kt:108)
at com.eudycontreras.boneslibrary.framework.bones.BoneManager$animateFadeOut$3.invoke(BoneManager.kt:166)
at com.eudycontreras.boneslibrary.framework.bones.BoneManager$animateFadeOut$3.invoke(BoneManager.kt:23)
at com.eudycontreras.boneslibrary.extensions.AnimatorExtensionsKt$animate$$inlined$addListener$1.onAnimationEnd(Animator.kt:117)
at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:600)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1333)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1575)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:307)
at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(AnimationHandler.java)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1229)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
at android.view.Choreographer.doCallbacks(Choreographer.java:899)
at android.view.Choreographer.doFrame(Choreographer.java:827)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

We fixed this by adding the following line to our app's proguard-rules.pro:

-keep class com.eudycontreras.boneslibrary.framework.bones.BoneProperties { *; }

This was hard to debug, so it would be nice if this line was just added the the proguard-rules file in the library instead :)

Smartphone (please complete the following information):

  • Device: Pixel 6
  • SDK Version 33
  • Version v1.4.5

Cannot disable Skeleton effect

This is my code

skeletonBuilder = SkeletonDrawable.create(view as ViewGroup)
                .builder()
                .setEnabled(true)
                .setAllowSavedState(true)
                .withShimmerBuilder {
                    setColor(MutableColor.fromColor(colorGray300))
                    setCount(3)
                }

hide effect

skeletonBuilder?.setEnabled(false)

Today, I upgrade version from 1.4.1 to 1.4.5 and it doesn't working. How to disable the effect?

How to stop skeleton on views

Thank for your great repository. I use your repo to create skeleton for screens in my app but how can i revert the screens to origin state after making them skeleton. Hope to hear your response. Sincerely, thank you.

Caused by: kotlin.UninitializedPropertyAccessException: lateinit property renderer has not been initialized

Caused by: kotlin.UninitializedPropertyAccessException: lateinit property renderer has not been initialized
at com.eudycontreras.boneslibrary.framework.bones.BoneManager.getRenderer(BoneManager.kt:31)
at com.eudycontreras.boneslibrary.framework.bones.BoneManager.stopAnimation(BoneManager.kt:205)
at com.eudycontreras.boneslibrary.framework.bones.BoneManager.dispose(BoneManager.kt:102)
at com.eudycontreras.boneslibrary.framework.bones.BoneManager.resetForReuse(BoneManager.kt:95)
at com.eudycontreras.boneslibrary.framework.bones.BoneDrawable.resetForReuse(BoneDrawable.kt:275)
at com.eudycontreras.boneslibrary.bindings.SkeletonBoneBindingsKt.addBoneLoader(SkeletonBoneBindings.kt:187)
at com.eudycontreras.boneslibrary.framework.bones.BoneDrawable.enable(BoneDrawable.kt:267)
at com.eudycontreras.bones.Skeleton.createIfNeeded(Skeleton.kt:74)
at com.eudycontreras.bones.TestActivity.onCreate(TestActivity.kt:43)
at android.app.Activity.performCreate(Activity.java:8129)
at android.app.Activity.performCreate(Activity.java:8109)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1344)

Use on recyclerView

thank you for your awesome library
how can I use it on my RecyclerView and set the specific items for shimmer

Creating SkeletonDrawable from code is not working properly

I'm trying to use your lib without databindings with just SkeletonDrawable class. It works, but for some reason it creates skeleton without animation, just bones. And also it doesn't ingnore views which I pass through withIgnoredBones(). So I have a question: what am I doing wrong? Here is my code, it runs in onViewCreated() of my fragment.

SkeletonDrawable.create(contentCl, true)
            .builder()
            .setAnimateRestoreBounds(true)
            .setAllowSavedState(true)
            .withIgnoredBones(R.id.cancelIv)
            .withShimmerBuilder {
                setInterpolator(AccelerateInterpolator())
                setSpeedMultiplier(1F)
                setSharedInterpolator(true)
                setThickness(120.dp)
                setThickness(10.dp)
                setTilt(-0.2f)
            }

Question - How to change color?

Thank for library, but I have an issue.
I use this code in my fragment

skeletonBuilder = SkeletonDrawable.create(fragmentRootView)
                    .build()
                    .setEnabled(true)
                    .setAllowSavedState(true)

And this is result (image below)
My fragment has skeleton loading effect, but I want to change color green to gray?

Thanks.

device-2021-01-11-150626

Can't get the examples working

First thanks for what seems like a great library with great technical solution to the problem and good documentation as well.

But I can't get it to work, so I have a few questions/bug findings:

  1. We are not using databinding, but I there seems also to be a great api for that case.
    But trying to use the examples only gives me a black box, no animation at all. I have tried to set almost every property without any animation as a result.
    What is the problem do you think?
    SkeletonDrawable.create(this).apply {
        this.getProps().apply {
            this.enabled = true
            this.allowSavedState = true
            this.shimmerRayProperties.apply {
                this.shimmerRayThickness = 10.dp
                this.shimmerRayTilt = 0.3f
            }
        }
    }

    SkeletonDrawable.create(this)
        .build()
        .setEnabled(true)
        .setAllowSavedState(true)
        .withShimmerBuilder {
            setThickness(10.dp)
            setTilt(0.3f)
            setAnimationDuration(300L)
        }
        .setCornerRadii(3f)
        .setColor(MutableColor(appCtx.getColor(R.color.green)))
        .withBoneBuilder(generateId()) {
            setColor(MutableColor(appCtx.getColor(R.color.lemon)))
            setMaxThickness(12.dp)
            setMinThickness(10.dp)
            setCornerRadii(CornerRadii(3f))
            setEnabled(true)
            setTransitionDuration(300L)
        }
        .setUseStateTransition(true)
  1. There are quite a few properties from "Example Usages 1" that does not seems to be accessible from the other approaches.
    Some of them seems important, is I just me that can't find them?
app:skeletonGenerateBones
app:skeletonAnimateRestoredBounds
  1. When creating a SkeletonDrawable for a ViewGroup, how then to select which child views that should be skeletonable?
  2. Is it possible to make a View skeletonable without going through it parent, or is the same case as 3. question?
  3. In the readme setCornerRadius() should be changed to setCornerRadii()

BUG : skeletonBoneIgnored attribute depends on databinding order of execution

Thanks for creating this library. I just started to play with it and it looks promising.

Describe the bug
When using attribute skeletonBoneIgnored the binding adapter method setSkeletonIgnored() looks for the parent skeleton drawable to store the ignored id by calling getParentSkeletonDrawable(). If the parent skeleton drawable is not found nothing happens and the view is not ignored.

There is no guaranteed order of execution in Android data binding as stated here. Thus the call to setSkeletonIgnored() can occurs before the call to setSkeletonEnabled() or other binding adapter methods who creates the skeleton drawable and the view won't be ignored.

Expected behavior
The view with skeletonBoneIgnored="@{true}" is ignored.

Additional context
Other binding adapter methods may be affected by this behavior. I think it also happens for skeletonBoneHeight ,skeletonBoneMinHeight

A workaround is to immediately create the SkeletonDrawable programmatically just after inflating the layout.

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.