ozodrukh/CircularReveal

CircularReveal is not working

MAnfal opened this issue · 1 comments

I am using circular reveal for following layout.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/main_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        tools:context="utilstore.com.collapsibleactivity.MainActivity">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="@dimen/appbar_padding_top"
            android:theme="@style/AppTheme.AppBarOverlay">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:layout_scrollFlags="scroll|enterAlways"
                app:popupTheme="@style/AppTheme.PopupOverlay">

                <Spinner
                    android:id="@+id/spinner"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:popupTheme="@style/AppTheme.PopupOverlay" />
            </android.support.v7.widget.Toolbar>

        </android.support.design.widget.AppBarLayout>

        <android.support.v4.widget.NestedScrollView
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end|bottom"
            android:layout_margin="@dimen/fab_margin"
            android:src="@android:drawable/ic_dialog_email" />

    </android.support.design.widget.CoordinatorLayout>
    <io.codetail.widget.RevealLinearLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/linear"
            android:orientation="horizontal"
            android:background="#000000">

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="New Button"
                android:id="@+id/button"
                android:layout_gravity="center_vertical" />
        </LinearLayout>
    </io.codetail.widget.RevealLinearLayout>
</FrameLayout>

with following code

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        final LinearLayout l = (LinearLayout) findViewById(R.id.linear);
        l.setVisibility(View.INVISIBLE);
        int cx = (l.getLeft() + l.getRight());
        int cy = l.getTop();
        int radius = Math.max(l.getWidth(), l.getHeight());

        final SupportAnimator animator = ViewAnimationUtils.createCircularReveal(l, cx, cy, 0, radius);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(400);
        final SupportAnimator animator_reverse = animator.reverse();


        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                l.setVisibility(View.VISIBLE);
                animator.start();
            }
        });

the only thing I have seen working is

animator.setDuration(400);

Reveal animation is not working at all.

I am experimenting on it in API 16.

Is there something else that's needed to be followed?

Thanks finally made it work.