ozodrukh/CircularReveal

Change visibility on RevealLayout

Michal-easycore opened this issue · 1 comments

Hi,
I am having trouble implementing RevealFrameLayout basically as navigation menu. I want to set it's visibility to GONE during Activity creation. When I tap on nav button I want to open it a set visibility to VISIBLE. Tapping button again will reverse reveal-animate the view and set it's visibility to GONE again. When I tried animating it without setting visibility of the view, it's working fine. (but not desired effect)

Here is my code:

public void openDrawer() {
    if (animator != null && animator.isRunning()) {
        return;
    }
    drawer.setVisibility(VISIBLE);
    final Point displaySize = DisplayUtils.getDisplaySize((Activity) getContext());
    final int finalRadius = Math.max(displaySize.x, displaySize.y);

    animator = ViewAnimationUtils.createCircularReveal(revealLayout, 0, 0, 0, finalRadius);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(REVEAL_ANIM_TIME);
    animator.start();
    drawerOpened = true;
}

public boolean isDrawerOpen() {
    return drawerOpened;
}

public void closeDrawer() {
    if (animator != null && animator.isRunning()) {
        return;
    }

    animator = animator.reverse();
    animator.addListener(new EmptyRevealAnimatorListener() {
        @Override
        public void onAnimationEnd() {
            animator = null;
            drawer.setVisibility(GONE);
        }
    });

    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(REVEAL_ANIM_TIME);
    animator.start();
    drawerOpened = false;
}

Any suggestions? Thank you.

I actually reproduce it only on L devices. So it was exactly problem like here #31 . Ticket can be closed. Thanks.