Back to project page material-menu.
The source code is released under:
Apache License
If you think the Android project material-menu listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.balysv.materialmenu.demo.abc; /*from ww w. j a v a 2 s.c om*/ import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import com.balysv.materialmenu.demo.R; import com.balysv.materialmenu.extras.abc.MaterialMenuIconCompat; import static com.balysv.materialmenu.MaterialMenuDrawable.Stroke; import static com.balysv.materialmenu.demo.BaseActivityHelper.generateState; import static com.balysv.materialmenu.demo.BaseActivityHelper.intToState; public class HomeIconActivity extends BaseActivity { private MaterialMenuIconCompat materialMenu; private int actionBarMenuState; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); materialMenu = new MaterialMenuIconCompat(this, Color.WHITE, Stroke.THIN); helper.init(getWindow().getDecorView(), materialMenu); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); materialMenu.syncState(savedInstanceState); } @Override protected void onSaveInstanceState(Bundle outState) { materialMenu.onSaveInstanceState(outState); super.onSaveInstanceState(outState); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.home_icon, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { startActivity(new Intent(this, CustomViewActivity.class)); finish(); return true; } if (id == android.R.id.home) { // random state actionBarMenuState = generateState(actionBarMenuState); materialMenu.animatePressedState(intToState(actionBarMenuState)); } return super.onOptionsItemSelected(item); } }