Skip to content

Commit

Permalink
Merge branch 'release/v5.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Aug 25, 2016
2 parents 351a785 + 65790b5 commit d7a2f4d
Show file tree
Hide file tree
Showing 37 changed files with 507 additions and 404 deletions.
8 changes: 8 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
###Upgrade Notes

#### v5.6.0
**IMPORTANT IF YOU IMPLEMENT CUSTOM-DRAWER-ITEMS OR USE THE FASTADAPTER**
* This release brings a breaking interface change. Your items now have to implement `bindView(ViewHolder holder, List payloads)` instead of `bindView(VH holder)`.
* The additional payload can be used to implement a more performant view updating when only parts of the item have changed. Please also refer to the `DiffUtils` which may provide the payload.

#### v5.5.1
* add `void set(ImageView imageView, Uri uri, Drawable placeholder, String tag);` to `IDrawerImageLoader` interface, similar to the `tag` provided in the placeholder method

#### v5.5.0
* **Dropping support for API < 14. New MinSdkVersion is 14**

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ You can find some frequently asked questions and other resources in the [WIKI /
##1. Provide the gradle dependency

```gradle
compile('com.mikepenz:materialdrawer:5.5.0@aar') {
compile('com.mikepenz:materialdrawer:5.6.0@aar') {
transitive = true
}
```
Expand Down
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
defaultConfig {
minSdkVersion setup.minSdk
targetSdkVersion setup.targetSdk
versionCode 550
versionName "5.5.0"
versionCode 560
versionName "5.6.0"

setProperty("archivesBaseName", "-v$versionName-c$versionCode")
}
Expand Down Expand Up @@ -53,21 +53,21 @@ dependencies {

// used to generate the Open Source section
// https://github.com/mikepenz/AboutLibraries
compile('com.mikepenz:aboutlibraries:5.7.1@aar') {
compile('com.mikepenz:aboutlibraries:5.8.1@aar') {
transitive = true
exclude module: "fastadapter"
}
//used to provide different itemAnimators for the RecyclerView
//https://github.com/mikepenz/ItemAnimators
compile 'com.mikepenz:itemanimators:0.2.4@aar'
compile 'com.mikepenz:itemanimators:0.5.0@aar'
// used to provide the MiniDrawer to normal Drawer crossfade effect via a SlidingPane layout
// --> https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/MiniDrawerActivity.java
// https://github.com/mikepenz/Crossfader
compile 'com.mikepenz:crossfader:1.3.7@aar'
compile 'com.mikepenz:crossfader:1.5.0@aar'
// used to provide the two step crossfade DrawerLayout. Which allows to have a mini layout which transforms to a normal layout within the drawer
// --> https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CrossfadeDrawerLayoutActvitiy.java
// https://github.com/mikepenz/CrossfadeDrawerLayout
compile('com.mikepenz:crossfadedrawerlayout:0.3.4@aar')
compile('com.mikepenz:crossfadedrawerlayout:1.0.0@aar')

// icon fonts used inside the sample
// https://github.com/mikepenz/Android-Iconics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.mikepenz.materialdrawer.model.interfaces.IProfile;
import com.mikepenz.materialize.util.UIUtils;

import java.util.List;

public class AccountDividerDrawerItem extends AbstractDrawerItem<AccountDividerDrawerItem, AccountDividerDrawerItem.ViewHolder> implements IProfile<AccountDividerDrawerItem> {
@Override
public int getType() {
Expand All @@ -32,7 +34,7 @@ public int getLayoutRes() {
}

@Override
public void bindView(ViewHolder viewHolder) {
public void bindView(ViewHolder viewHolder, List payloads) {
Context ctx = viewHolder.itemView.getContext();

//set the identifier from the drawerItem here. It can be used to run tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.mikepenz.materialdrawer.app.drawerItems;

import com.mikepenz.materialdrawer.holder.ColorHolder;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.AbstractBadgeableDrawerItem;

public class CustomPrimaryDrawerItem extends PrimaryDrawerItem {
import java.util.List;

public class CustomPrimaryDrawerItem extends AbstractBadgeableDrawerItem<CustomPrimaryDrawerItem> {

private ColorHolder background;

Expand All @@ -18,8 +20,8 @@ public CustomPrimaryDrawerItem withBackgroundRes(int backgroundRes) {
}

@Override
public void bindView(ViewHolder holder) {
super.bindView(holder);
public void bindView(ViewHolder holder, List payloads) {
super.bindView(holder, payloads);

if (background != null) {
background.applyToBackground(holder.itemView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.mikepenz.materialdrawer.holder.StringHolder;
import com.mikepenz.materialdrawer.model.interfaces.ColorfulBadgeable;

import java.util.List;

/**
* Created by mikepenz on 03.02.15.
*/
Expand Down Expand Up @@ -63,7 +65,7 @@ public int getLayoutRes() {
}

@Override
public void bindView(ViewHolder viewHolder) {
public void bindView(ViewHolder viewHolder, List payloads) {
Context ctx = viewHolder.itemView.getContext();

//bind the basic view parts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import com.mikepenz.materialdrawer.holder.ImageHolder;
import com.mikepenz.materialdrawer.model.AbstractDrawerItem;

import java.util.List;

/**
* Created by mikepenz on 03.02.15.
*/
Expand Down Expand Up @@ -166,7 +168,7 @@ public int getLayoutRes() {
}

@Override
public void bindView(ViewHolder viewHolder) {
public void bindView(ViewHolder viewHolder, List payloads) {
Context ctx = viewHolder.itemView.getContext();

//set the identifier from the drawerItem here. It can be used to run tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.materialdrawer.app.R;
import com.mikepenz.materialdrawer.model.BasePrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.BaseDescribeableDrawerItem;
import com.mikepenz.materialdrawer.model.BaseViewHolder;

import java.util.List;

/**
* Created by mikepenz on 03.02.15.
*/
public class OverflowMenuDrawerItem extends BasePrimaryDrawerItem<OverflowMenuDrawerItem, OverflowMenuDrawerItem.ViewHolder> {
public class OverflowMenuDrawerItem extends BaseDescribeableDrawerItem<OverflowMenuDrawerItem, OverflowMenuDrawerItem.ViewHolder> {
private int mMenu;

public OverflowMenuDrawerItem withMenu(int menu) {
Expand Down Expand Up @@ -64,7 +66,7 @@ public int getLayoutRes() {
}

@Override
public void bindView(ViewHolder viewHolder) {
public void bindView(ViewHolder viewHolder, List payloads) {
Context ctx = viewHolder.itemView.getContext();

//bind the basic view parts
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.novoda:bintray-release:0.3.4'
}
}
Expand All @@ -27,5 +27,5 @@ allprojects {
}

task wrapper(type: Wrapper) {
gradleVersion = '2.14'
gradleVersion = '2.14.1'
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Maven stuff
VERSION_NAME=5.5.0
VERSION_CODE=550
VERSION_NAME=5.6.0
VERSION_CODE=560
GROUP=com.mikepenz
POM_DESCRIPTION=MaterialDrawer Library
POM_URL=https://github.com/mikepenz/MaterialDrawer
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Jun 18 19:13:54 CEST 2016
#Tue Aug 23 19:35:06 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion setup.minSdk
targetSdkVersion setup.targetSdk
versionCode 550
versionName '5.5.0'
versionCode 560
versionName '5.6.0'
}
buildTypes {
release {
Expand Down Expand Up @@ -47,5 +47,5 @@ dependencies {
// used to fill the RecyclerView with the DrawerItems
// and provides single and multi selection, expandable items
// https://github.com/mikepenz/FastAdapter
compile 'com.mikepenz:fastadapter:1.7.0@aar'
compile 'com.mikepenz:fastadapter:1.8.0@aar'
}
25 changes: 23 additions & 2 deletions library/src/main/java/com/mikepenz/materialdrawer/Drawer.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.mikepenz.materialdrawer.holder.DimenHolder;
import com.mikepenz.materialdrawer.holder.ImageHolder;
import com.mikepenz.materialdrawer.holder.StringHolder;
import com.mikepenz.materialdrawer.model.AbstractDrawerItem;
import com.mikepenz.materialdrawer.model.ContainerDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.Badgeable;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
Expand Down Expand Up @@ -371,6 +372,18 @@ public ActionBarDrawerToggle getActionBarDrawerToggle() {
return mDrawerBuilder.mActionBarDrawerToggle;
}

/**
* sets the gravity for this drawer.
*
* @param gravity the gravity which is defined for the drawer
*/
public void setGravity(int gravity) {
DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) getSlider().getLayoutParams();
params.gravity = gravity;
getSlider().setLayoutParams(params);
mDrawerBuilder.mDrawerGravity = gravity;
}

/**
* calculates the position of an drawerItem. searching by it's identifier
*
Expand Down Expand Up @@ -554,8 +567,16 @@ public boolean setSelectionAtPosition(int position, boolean fireOnClick) {
if (mDrawerBuilder.mRecyclerView != null) {
mDrawerBuilder.mAdapter.deselect();
mDrawerBuilder.mAdapter.select(position, false);
if (mDrawerBuilder.mOnDrawerItemClickListener != null && fireOnClick && position >= 0) {
mDrawerBuilder.mOnDrawerItemClickListener.onItemClick(null, position, mDrawerBuilder.mAdapter.getItem(position));
if (fireOnClick && position >= 0) {
IDrawerItem item = mDrawerBuilder.mAdapter.getItem(position);

if (item instanceof AbstractDrawerItem && ((AbstractDrawerItem) item).getOnDrawerItemClickListener() != null) {
((AbstractDrawerItem) item).getOnDrawerItemClickListener().onItemClick(null, position, item);
}

if (mDrawerBuilder.mOnDrawerItemClickListener != null) {
mDrawerBuilder.mOnDrawerItemClickListener.onItemClick(null, position, item);
}
}

//we set the selection on a normal item in the drawer so we have to deselect the items in the StickyDrawer
Expand Down
14 changes: 11 additions & 3 deletions library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.mikepenz.materialdrawer.model.AbstractDrawerItem;
import com.mikepenz.materialdrawer.model.ContainerDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.Selectable;
Expand All @@ -30,7 +31,7 @@ class DrawerUtils {
* @param fireOnClick true if we should call the listener, false if not, null to not call the listener and not close the drawer
*/
public static void onFooterDrawerItemClick(DrawerBuilder drawer, IDrawerItem drawerItem, View v, Boolean fireOnClick) {
boolean checkable = !(drawerItem != null && drawerItem instanceof Selectable && !((Selectable) drawerItem).isSelectable());
boolean checkable = !(drawerItem != null && drawerItem instanceof Selectable && !drawerItem.isSelectable());
if (checkable) {
drawer.resetStickyFooterSelection();

Expand All @@ -55,8 +56,15 @@ public static void onFooterDrawerItemClick(DrawerBuilder drawer, IDrawerItem dra

if (fireOnClick != null) {
boolean consumed = false;
if (fireOnClick && drawer.mOnDrawerItemClickListener != null) {
consumed = drawer.mOnDrawerItemClickListener.onItemClick(v, -1, drawerItem);

if (fireOnClick) {
if (drawerItem instanceof AbstractDrawerItem && ((AbstractDrawerItem) drawerItem).getOnDrawerItemClickListener() != null) {
consumed = ((AbstractDrawerItem) drawerItem).getOnDrawerItemClickListener().onItemClick(null, -1, drawerItem);
}

if (drawer.mOnDrawerItemClickListener != null) {
consumed = drawer.mOnDrawerItemClickListener.onItemClick(v, -1, drawerItem);
}
}

if (!consumed) {
Expand Down
Loading

0 comments on commit d7a2f4d

Please sign in to comment.