SpringRotateMenu

Additional

Language
Kotlin
Version
N/A
Created
Apr 7, 2017
Updated
Jan 2, 2018
Owner
SouthernBox
Contributor
SouthernBox
1
Activity
Badge
Generate
Download
Source code
APK file

Announcement

SpringRotateMenu

A rotating menu with SpringAnimation.

Usage

Add the dependencies to your gradle file:

dependencies {
 compile 'com.southernbox:SpringRotateMenu:1.0.0'
}

Use SpringRotateMenu in your layout file:

<com.southernbox.springrotatemenu.SpringRotateMenu
    android:background="@color/colorPrimary"
    android:id="@+id/spring_rotate_menu"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:transformPivotX="28dp"
    android:transformPivotY="28dp">

    <android.support.v7.widget.Toolbar
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        app:contentInsetStart="0dp">

        <ImageView
            android:id="@+id/iv_rotate_menu"
            android:layout_height="@dimen/toolbar_height"
            android:layout_width="@dimen/toolbar_height"
            android:rotation="90"
            android:scaleType="center"
            android:src="@drawable/ic_menu" />

    </android.support.v7.widget.Toolbar>

    <!-- layout -->

</com.southernbox.springrotatemenu.SpringRotateMenu>

Setting button and listener:

springRotateMenu.setExpandButton(findViewById(R.id.iv_menu));
springRotateMenu.setCollapseButton(springRotateMenu.findViewById(R.id.iv_menu));
springRotateMenu.setAnimationListener(new SpringRotateMenu.OnAnimationListener() {

    @Override
    public void expandBegin() {
        toolbar.setVisibility(View.INVISIBLE);
    }

    @Override
    public void expandEnd() {

    }

    @Override
    public void collapseBegin() {

    }

    @Override
    public void collapseEnd() {
        toolbar.setVisibility(View.VISIBLE);
    }
});