Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Circular Reveal for Pre-Lollipop Devices

First thing's first, this is not the same question as Create circular reveal for pre-Lollipop devices (Android)

I am using the library mentioned there to create Circular Reveal, but it doesn't seem to work for me.

XML

<io.codetail.widget.RevealFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <FrameLayout
            android:id="@+id/circBack"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#ff4081"
            android:visibility="invisible"
            ></FrameLayout>
</io.codetail.widget.RevealFrameLayout>

JAVA

                View myView = findViewById(R.id.circBack);


                // get the center for the clipping circle
                int cx = (myView.getLeft() + myView.getRight()) / 2;
                int cy = (myView.getTop() + myView.getBottom()) / 2;

                // get the final radius for the clipping circle
                int finalRadius = Math.max(myView.getWidth(), myView.getHeight());


                SupportAnimator animator = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
                animator.setInterpolator(new AccelerateDecelerateInterpolator());
                animator.setDuration(1000);
                myView.setVisibility(View.VISIBLE);
                animator.start();

The circular reveal doesn't show up. I mean nothing happens when the code executes.

Logcat shows this

07-01 19:15:47.498  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealRadius>

07-01 19:15:47.498  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealRadius>

07-01 19:15:47.498  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealRadius>

07-01 19:15:47.501  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.ViewAnimationUtils$SimpleAnimationListener>

07-01 19:15:47.501  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.ViewAnimationUtils$SimpleAnimationListener>

07-01 19:15:47.502  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedGingerbread>

07-01 19:15:47.502  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedGingerbread>

07-01 19:15:47.502  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedIceCreamSandwich>

07-01 19:15:47.503  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedIceCreamSandwich>

07-01 19:15:47.503  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedJellyBeanMr2>

07-01 19:15:47.503  27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedJellyBeanMr2>

However the circular reveal does work if the view is set to visible in the XML files, but the problem is if I set the view "circBack" to visible in the XML, it shows up from the moment the app is launched, which is usual.

Any solution to this problem?

like image 686
Rahul Chowdhury Avatar asked Sep 28 '22 11:09

Rahul Chowdhury


1 Answers

Look like you're initializing this animation on "Gone" view ?

Try to get view's visibilty and make sure that you run it inside

if (mView.getVisibility() == View.VISIBLE)
{
..
..
  anim.start();
}

block of code.

like image 192
Somesh Kumar Avatar answered Oct 03 '22 08:10

Somesh Kumar