diff --git a/CHANGELOG.md b/CHANGELOG.md index 704ed10..9875acd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ Change Log ========== +Version 1.4.0 (2014-10-19) + +- Added EXTRAS: Toolbar support for `MaterialMenuIcon`. + +Usage: + +import `com.balysv.materialmenu:material-menu-toolbar:1.x.x` and use `MaterielMenuIconToolbar` + +- BUG FIX: left margin fix for Jellybean and ICS devices using `MaterialMenuIcon` + Version 1.3.1 (2014-10-14) ---------------------------- diff --git a/README.md b/README.md index 76c7b06..a42b6f6 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,10 @@ Check for latest versions at [Gradle Please][3] and import depending on ActionBa // stock actionBar compile 'com.balysv.materialmenu:material-menu:1.x.x' -// actionBarCompat +// Toolbar (includes support-v7:21.0.x) +compile 'com.balysv.materialmenu:material-menu-toolbar:1.x.x' + +// actionBarCompat (up to support-v7:20.0.0 - does not support Toolbar) compile 'com.balysv.materialmenu:material-menu-abc:1.x.x' // actionBarSherlock @@ -140,6 +143,69 @@ public boolean onOptionsItemSelected(MenuItem item) { } ``` +#### Use in Toolbar + +Use it as a standalone drawable. Note: you have to handle icon state yourself: + +```java +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.animatePressedState(newState); + } + }); + materialMenu = new MaterialMenuDrawable(this, Color.WHITE, Stroke.THIN); + toolbar.setNavigationIcon(materialMenu); + materialMenu.setNeverDrawTouch(true); +} +``` + +OR + +Use `MaterialMenuIconToolbar` which handles saved state: + +```java +private MaterialMenuIconToolbar materialMenu; + +@Override +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.animatePressedState(newState); + } + }); + materialMenu = new MaterialMenuIconToolbar(this, Color.WHITE, Stroke.THIN) { + @Override public int getToolbarViewId() { + return R.id.toolbar; + } + }; + materialMenu.setNeverDrawTouch(true); +} + +@Override +protected void onPostCreate(Bundle savedInstanceState) { + super.onPostCreate(savedInstanceState); + materialMenu.syncState(savedInstanceState); +} + +@Override protected void onSaveInstanceState(Bundle outState) { + materialMenu.onSaveInstanceState(outState); + super.onSaveInstanceState(outState); +} +``` + #### Use in custom Action Bar view Simply add `MaterialMenuView` in your custom layout and register an `OnClickListener` to do the diff --git a/extras-toolbar/build.gradle b/extras-toolbar/build.gradle index 265e8af..5eaf45b 100644 --- a/extras-toolbar/build.gradle +++ b/extras-toolbar/build.gradle @@ -5,7 +5,6 @@ android { buildToolsVersion "21.0.1" defaultConfig { - applicationId "com.balysv.materialmenu.extras.toolbar" minSdkVersion 9 targetSdkVersion 21 versionCode 1 @@ -22,3 +21,5 @@ dependencies { compile project(':library') compile 'com.android.support:appcompat-v7:21.0.0' } + +apply from: '../maven_push.gradle' diff --git a/gradle.properties b/gradle.properties index c0fead8..631b812 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -VERSION_NAME=1.3.1 -VERSION_CODE=11 +VERSION_NAME=1.4.0 +VERSION_CODE=12 GROUP=com.balysv.materialmenu POM_NAME=Material Menu