/ Menu

A simple and elegant menu with a circular layout

A simple and elegant menu with a circular layout

CircleMenu

splash

CircleMenu is a simple, elegant menu with a circular layout.

preview

Setup

Add this to your app build.gradle:

compile 'com.github.imangazalievm:circlemenu:2.0.1'

Usage

Add to your layout xml-file:

<com.imangazaliev.circlemenu.CircleMenu
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:id="@+id/circleMenu">

        <com.imangazaliev.circlemenu.CircleMenuButton
            android:id="@+id/favorite"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:colorNormal="#2196F3"
            app:colorPressed="#1E88E5"
            app:icon="@drawable/ic_favorite"/>

        <com.imangazaliev.circlemenu.CircleMenuButton
            android:id="@+id/search"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:colorNormal="#4CAF50"
            app:colorPressed="#43A047"
            app:icon="@drawable/ic_search"/>

        <com.imangazaliev.circlemenu.CircleMenuButton
            android:id="@+id/alert"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:colorNormal="#F44336"
            app:colorPressed="#E53935"
            app:icon="@drawable/ic_alert"/>

</com.imangazaliev.circlemenu.CircleMenu>

Set OnItemClickListener for handling menu items clicks:

CircleMenu circleMenu = (CircleMenu) findViewById(R.id.circleMenu);
circleMenu.setOnItemClickListener(new CircleMenu.OnItemClickListener() {
    @Override
    public void onItemClick(MenuButton menuButton) {

    }
});

If you want to open menu in start, just add openOnStart attribute in XML:

<com.imangazaliev.circlemenu.CircleMenu
        ...
        app:openOnStart="true">

You can use open(boolean animate) and close(boolean animate) methods, to open and close menu programmatically:

circleMenu.open(true);

Set EventListener for handling open/close actions

circleMenu.setEventListener(new CircleMenu.EventListener() {
    @Override
    public void onMenuOpenAnimationStart() {

    }

    @Override
    public void onMenuOpenAnimationEnd() {

    }

    @Override
    public void onMenuCloseAnimationStart() {

    }

    @Override
    public void onMenuCloseAnimationEnd() {

    }

    @Override
    public void onButtonClickAnimationStart(@NonNull CircleMenuButton menuButton) {

    }

    @Override
    public void onButtonClickAnimationEnd(@NonNull CircleMenuButton menuButton) {

    }

});

You can also enable hints, that shows in Toast by long pressing a button

<com.imangazaliev.circlemenu.CircleMenu
        ...
        app:hintsEnabled="true">

        <com.imangazaliev.circlemenu.CircleMenuButton
                   ...
                   app:hintText="Place"/>

        ...

</com.imangazaliev.circlemenu.CircleMenu>

GitHub