All Projects → balysv → Material Menu

balysv / Material Menu

Licence: apache-2.0
Animations for Android L drawer, back, dismiss and check icons

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Material Menu

Ngx Ui
🚀 Style and Component Library for Angular
Stars: ✭ 534 (-78.48%)
Mutual labels:  icons, drawer
Rplibs
Refs.cn 原型设计元件库,基于Axure RP 10/9/8,支持 Android、Apple、Windows、微信,移动、桌面平台的应用和网站原型设计。五年历程 2.6k+ star,感谢大家使用。
Stars: ✭ 2,622 (+5.68%)
Mutual labels:  icons
Bootstrap Vue
BootstrapVue provides one of the most comprehensive implementations of Bootstrap v4 for Vue.js. With extensive and automated WAI-ARIA accessibility markup.
Stars: ✭ 13,603 (+448.29%)
Mutual labels:  icons
Iconshowcase Dashboard
A full-of-features, easy-to-customize, free and open source, Material Design dashboard for icon packs.
Stars: ✭ 197 (-92.06%)
Mutual labels:  icons
Vue Eva Icons
Is a pack of more than 480 beautiful open source Eva icons as Vue components
Stars: ✭ 189 (-92.38%)
Mutual labels:  icons
Small N Flat
svg icons on a 24px grid
Stars: ✭ 205 (-91.74%)
Mutual labels:  icons
Micon
Micon, The iconic windows 10 font and CSS toolkit.
Stars: ✭ 182 (-92.66%)
Mutual labels:  icons
Animated Icons
Android Animated Icons Library
Stars: ✭ 224 (-90.97%)
Mutual labels:  icons
React Svg Buttons
React configurable animated svg buttons
Stars: ✭ 209 (-91.58%)
Mutual labels:  icons
Fileicon
macOS CLI for managing custom icons for files and folders
Stars: ✭ 196 (-92.1%)
Mutual labels:  icons
Svelte Awesome
Awesome SVG icon component for Svelte JS, built with Font Awesome icons. Based on Justineo/vue-awesome
Stars: ✭ 193 (-92.22%)
Mutual labels:  icons
Richpath
💪 Rich Android Path. 🤡 Draw as you want. 🎉 Animate much as you can.
Stars: ✭ 2,259 (-8.95%)
Mutual labels:  icons
Android Switchicon
Google launcher-style implementation of switch (enable/disable) icon
Stars: ✭ 2,337 (-5.8%)
Mutual labels:  icons
Awesome Iconjar
44 Collect free icon sets for iconjar. 收集免费的图标包,iconjar 格式(44套)。
Stars: ✭ 188 (-92.42%)
Mutual labels:  icons
Titanic
A set of animated icons + code to insert them into the webpages
Stars: ✭ 2,457 (-0.97%)
Mutual labels:  icons
Folder Icons
Custom folder icons for macOS & Windows
Stars: ✭ 186 (-92.5%)
Mutual labels:  icons
Kubernetes Icons
[obsolete] Set of icons for Kubernetes diagrams, has been merged into official k8s repo!!
Stars: ✭ 194 (-92.18%)
Mutual labels:  icons
Resourcelib
C# File Resource Management Library
Stars: ✭ 197 (-92.06%)
Mutual labels:  icons
Mmenu Js
The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.
Stars: ✭ 2,535 (+2.18%)
Mutual labels:  drawer
Prismatic Night
A dark themed startpage and dark themes for Firefox and Linux inspired by Material design and Adapta.
Stars: ✭ 223 (-91.01%)
Mutual labels:  icons

Material Menu

Morphing Android menu, back, dismiss and check buttons

Demo Image

Have full control of the animation:

Demo Drawer

Including in your project

compile 'com.balysv.materialmenu:material-menu:2.0.0'

Maven Central

Versions up to 2.0 (deprecated)

See README for setting up older versions of the library.

Usage

MaterialMenuDrawable

Use it as a standalone drawable in your Toolbar:

private MaterialMenuDrawable materialMenu;

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.toolbar);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override public void onClick(View v) {
        // Handle your drawable state here
        materialMenu.animateState(newState);
      }
    });
    materialMenu = new MaterialMenuDrawable(this, Color.WHITE, Stroke.THIN);
    toolbar.setNavigationIcon(materialMenu);
}

MaterialMenuView

A plain old View that draws the icon and provides an API to manipulate its state. You can embed it in any layout including a Toolbar.

Customisation is also available through xml attributes:

app:mm_color="color"               // Color of drawable
app:mm_visible="boolean"           // Visible
app:mm_transformDuration="integer" // Transformation animation duration
app:mm_scale="integer"             // Scale factor of drawable
app:mm_strokeWidth="integer"       // Stroke width of icons (can only be 1, 2 or 3)
app:mm_rtlEnabled="boolean"        // Enabled RTL layout support (flips all drawables)
app:mm_iconState="enum"            // Set the intial state of the drawable (burger, arrow, x or check)

API

There are four icon states:

BURGER, ARROW, X, CHECK

To morph the drawable state

MaterialMenu.animateIconState(IconState state)

To change the drawable state without animation

MaterialMenu.setIconState(IconState state)

To animate the drawable manually (i.e. on navigation drawer slide):

MaterialMenu.setTransformationOffset(AnimationState state, float value)

To hide or show the drawable:

MaterialMenu.setVisible(boolean visible)

where AnimationState is one of BURGER_ARROW, BURGER_X, ARROW_X, ARROW_CHECK, BURGER_CHECK, X_CHECK and value is between 0 and 2

Note: The icon state is resolved by current offset value. Make sure you use offset between 0 and 1 for forward animation and 1 and 2 for backwards to correctly save icon state on activity recreation.

NavigationDrawer slide interaction

Implement MaterialMenu into your ActionBar as described above and add a custom DrawerListener:

private DrawerLayout drawerLayout;
private boolean isDrawerOpened;
private MaterialMenuDrawable materialMenu;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    materialMenu = new MaterialMenuDrawable(this, Color.WHITE, Stroke.THIN);
    toolbar.setNavigationIcon(materialMenu);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {
            materialMenu.setTransformationOffset(
                MaterialMenuDrawable.AnimationState.BURGER_ARROW,
                isDrawerOpened ? 2 - slideOffset : slideOffset
            );
        }

        @Override
        public void onDrawerOpened(View drawerView) {
            isDrawerOpened = true;
        }

        @Override
        public void onDrawerClosed(View drawerView) {
            isDrawerOpened = false;
        }
        
        @Override
        public void onDrawerStateChanged(int newState) {
            if(newState == DrawerLayout.STATE_IDLE) {
                if(isDrawerOpened) {
                   menu.setIconState(MaterialMenuDrawable.IconState.ARROW);
                } else {
                   menu.setIconState(MaterialMenuDrawable.IconState.BURGER);
                }
            }
        }
    });
}

Developed By

Balys Valentukevicius

License

Copyright 2016 Balys Valentukevicius

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].