Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createCircularReveal makes square reveal on API16 #114

Open
HaydenBL opened this issue Aug 29, 2017 · 4 comments
Open

createCircularReveal makes square reveal on API16 #114

HaydenBL opened this issue Aug 29, 2017 · 4 comments

Comments

@HaydenBL
Copy link

Description of the problem:

I've been using the library since 1.3.1
I figured I'd try updating to the latest version today, so I updated it to 2.0.1, tweaked the code so it works with the new APIs (looks like you use a native Animator instead of the included SupportAnimator now), and it worked fine when I tested it on a Pixel with API26 (Oreo), but my app is backwards compatible to API16 (Jellybean), and the circular reveal seems to turn into a square now. I reverted back and it works on 1.3.1, but not with 2.0.1

Which library version are you using?
2.0.1

Which phone/tablet are you using, and which Android version does it run? (e.g. Samsung Galaxy S5,
Android 5.0)

Nexus 4, Android 4.2.2, stock

Does the same happen on other devices or an emulator?
Yes

Can you reproduce the issue in the sample project included with the library? If not, can you
provide your own sample project or sample code that produces this error?

Animator anim
anim = io.codetail.animation.ViewAnimationUtils
                    .createCircularReveal(childBG, cx, cy, 0, finalRadius);
anim.setDuration(ANIMATION_LENGTH);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
anim.start();

Also worth noting, I Googled the issue and found at least one other person running into this from May 8th:
https://stackoverflow.com/questions/28544800/create-circular-reveal-for-pre-lollipop-devices-android#comment74732182_28604515

@ozodrukh
Copy link
Owner

ozodrukh commented Aug 30, 2017

Hi fellow,

It feels like you may using setOutlineProvider on new API, if so this causes a problem.

If it is not an answer to your question. Could your provide sample app, so i could investigate on this issues.

Thanks ;)

@thomaaam
Copy link

thomaaam commented Sep 11, 2017

I got the same on a Samsung Galaxy S4 Mini running version 4.4.2 (KitKat).
Everything works fine except that it's a quadratic reveal instead of a circular reveal.

On the contrary the animation works fine on a Nexus 4 emulator running version 4.4.

I have not explicitly used "setOutlineProvider" at least.

Here's my code for starting the reveal animation:

fun View.enterWithCircularReveal(centerX: Int = this.pivotX.toInt(),
                                 centerY: Int = this.pivotY.toInt(),
                                 revealDuration: Long = 500) {
    val v = this
    v.visibility = View.INVISIBLE

    if (v.viewTreeObserver.isAlive) {
        v.viewTreeObserver.
                addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
                    override fun onGlobalLayout() {
                        v.viewTreeObserver.removeOnGlobalLayoutListener(this)

                        // Transition with the reveal animation
                        val finalRadius = maxOf(v.width, v.height)

                        // create the animator for this view (the start radius is zero)
                        val anim = createCircularReveal(
                                v, centerX, centerY, 0f, finalRadius.toFloat())
                        anim.duration = revealDuration

                        // make the view visible and start the animation
                        v.visibility = View.VISIBLE
                        anim.start()
                    }
                })
    }
}

@Gilianp
Copy link

Gilianp commented Sep 26, 2017

I also have this problem in API < 19. I just copy/paste the example in README.md. I was solved by changing layerType to Software in root layout (RevealViewGroup)

@ozodrukh
Copy link
Owner

True, hardware acceleration might be root of this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants