Skip to content

Commit

Permalink
Merge branch 'release/v5.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Oct 27, 2016
2 parents d7a2f4d + 95920ff commit 6288b3f
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ android:
- tools

# The BuildTools version used by your project
- build-tools-24.0.1
- build-tools-25.0.0

# The SDK version used to compile your project
- android-24
- android-25

# Additional components
- extra-google-m2repository
Expand Down
2 changes: 1 addition & 1 deletion FAQ/opening-drawer-from-espresso.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ First, you need a add `espresso-contrib` to your project. It has the needed `Dra

Then, you need to open the drawer with his `openDrawer()` method and the drawer layout ID. The generated one is `R.id.material_drawer_layout`

`DrawerActions.openDrawer(R.id.material_drawer_layout);`
`onView(withId(R.id.material_drawer_layout)).perform(DrawerActions.open());`
6 changes: 6 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
###Upgrade Notes

#### v5.7.0
**IMPORTANT IF YOU IMPLEMENT CUSTOM-DRAWER-ITEMS OR USE THE FASTADAPTER**
* You have to update your `FastAdapter` dependency to v2.0.0 with this release
* If you have `CustomDrawerItem`'s not based on the `AbstractDrawerITems` make sure you implement the `unbindView` method, and the new required methods
* See the MIGRATION information of the **FastAdapter** https://github.com/mikepenz/FastAdapter/blob/develop/MIGRATION.md

#### 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)`.
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ There is a Header with profiles (**AccountHeader**), a **MiniDrawer** for Table
###A quick overview what's in
- **the easiest possible integration**
- integrate in less than **5 minutes**
- compatible down to **API Level 10**
- compatible down to **API Level 14**
- includes an **AccountSwitcher**
- quick and simple api
- follows the **Google Material Design Guidelines**
Expand Down 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.6.0@aar') {
compile('com.mikepenz:materialdrawer:5.7.0@aar') {
transitive = true
}
```
Expand Down Expand Up @@ -419,6 +419,10 @@ builder.withDrawerLayout(R.layout.material_drawer);
* [Atmosphere](https://play.google.com/store/apps/details?id=com.peakpocketstudios.atmosphere)
* [Slidechat](https://play.google.com/store/apps/details?id=com.taddu.adfree.slidechat)
* [Fitness Challenge](https://play.google.com/store/apps/details?id=com.isidroid.fitchallenge)
* [European Capital of Culture - Pafos2017 official app](https://play.google.com/store/apps/details?id=com.trackandtalk.pafos17)
* [I'm Reading Quran - Kur'an Okuyorum](https://play.google.com/store/apps/details?id=com.homemade.kuranokuma)
* [Makota Money Manager](https://play.google.com/store/apps/details?id=be.jatra.makota)
* [Companion for Band](https://github.com/adithya321/Companion-for-Band)

#Articles about the MaterialDrawer
* [java-help.ru](http://java-help.ru/material-navigationdrawer/)
Expand Down
4 changes: 2 additions & 2 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 560
versionName "5.6.0"
versionCode 570
versionName "5.7.0"

setProperty("archivesBaseName", "-v$versionName-c$versionCode")
}
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
buildscript {
ext {
setup = [compileSdk: 24,
buildTools: "24.0.1",
setup = [compileSdk: 25,
buildTools: "25.0.0",
minSdk : 14,
targetSdk : 24]
targetSdk : 25]

versions = [supportLib: "24.2.0"]
versions = [supportLib: "25.0.0"]
}

repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.novoda:bintray-release:0.3.4'
}
}
Expand Down
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.6.0
VERSION_CODE=560
VERSION_NAME=5.7.0
VERSION_CODE=570
GROUP=com.mikepenz
POM_DESCRIPTION=MaterialDrawer Library
POM_URL=https://github.com/mikepenz/MaterialDrawer
Expand Down
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 560
versionName '5.6.0'
versionCode 570
versionName '5.7.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.8.0@aar'
compile 'com.mikepenz:fastadapter:2.0.0@aar'
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.view.View;
import android.view.ViewGroup;

import com.mikepenz.fastadapter.IExpandable;
import com.mikepenz.fastadapter.utils.IdDistributor;
import com.mikepenz.fastadapter.utils.ViewHolderFactory;
import com.mikepenz.materialdrawer.Drawer;
Expand All @@ -22,7 +21,7 @@
/**
* Created by mikepenz on 14.07.15.
*/
public abstract class AbstractDrawerItem<T, VH extends RecyclerView.ViewHolder> implements IDrawerItem<T, VH>, Selectable<T>, Tagable<T>, IExpandable<T, IDrawerItem> {
public abstract class AbstractDrawerItem<T, VH extends RecyclerView.ViewHolder> implements IDrawerItem<T, VH>, Selectable<T>, Tagable<T> {
// the identifier for this item
protected long mIdentifier = -1;

Expand Down Expand Up @@ -186,6 +185,29 @@ public void onPostBindView(IDrawerItem drawerItem, View view) {
}
}

// the parent of this item
private IDrawerItem mParent;

/**
* @return the parent of this item
*/
@Override
public IDrawerItem getParent() {
return mParent;
}

/**
* the parent for this item
*
* @param parent it's parent
* @return this
*/
@Override
public IDrawerItem withParent(IDrawerItem parent) {
this.mParent = parent;
return this;
}

// the subItems to expand for this item
protected List<IDrawerItem> mSubItems;

Expand Down Expand Up @@ -262,6 +284,7 @@ public boolean isAutoExpanding() {
*/
public abstract ViewHolderFactory<VH> getFactory();


/**
* generates a view by the defined LayoutRes
*
Expand Down Expand Up @@ -289,6 +312,16 @@ public View generateView(Context ctx, ViewGroup parent) {
return viewHolder.itemView;
}

/**
* called when the view is unbound
*
* @param holder
*/
@Override
public void unbindView(VH holder) {

}

/**
* This method returns the ViewHolder for our item, using the provided View.
* By default it will try to get the ViewHolder from the ViewHolderFactory. If this one is not implemented it will go over the generic way, wasting ~5ms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public class ExpandableDrawerItem extends BaseDescribeableDrawerItem<ExpandableD

protected ColorHolder arrowColor;

protected int arrowRotationAngleStart = 0;

protected int arrowRotationAngleEnd = 180;

public ExpandableDrawerItem withArrowColor(@ColorInt int arrowColor) {
this.arrowColor = ColorHolder.fromColor(arrowColor);
return this;
Expand All @@ -39,6 +43,16 @@ public ExpandableDrawerItem withArrowColorRes(@ColorRes int arrowColorRes) {
return this;
}

public ExpandableDrawerItem withArrowRotationAngleStart(int angle) {
this.arrowRotationAngleStart = angle;
return this;
}

public ExpandableDrawerItem withArrowRotationAngleEnd(int angle) {
this.arrowRotationAngleEnd = angle;
return this;
}

@Override
public int getType() {
return R.id.material_drawer_item_expandable;
Expand All @@ -50,7 +64,6 @@ public int getLayoutRes() {
return R.layout.material_drawer_item_expandable;
}


@Override
public ExpandableDrawerItem withOnDrawerItemClickListener(Drawer.OnDrawerItemClickListener onDrawerItemClickListener) {
mOnDrawerItemClickListener = onDrawerItemClickListener;
Expand All @@ -71,9 +84,9 @@ public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
if (drawerItem instanceof AbstractDrawerItem && drawerItem.isEnabled()) {
if (((AbstractDrawerItem) drawerItem).getSubItems() != null) {
if (((AbstractDrawerItem) drawerItem).isExpanded()) {
ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(180).start();
ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(ExpandableDrawerItem.this.arrowRotationAngleEnd).start();
} else {
ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(0).start();
ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(ExpandableDrawerItem.this.arrowRotationAngleStart).start();
}
}
}
Expand All @@ -92,9 +105,9 @@ public void bindView(ViewHolder viewHolder, List payloads) {
viewHolder.arrow.setColor(this.arrowColor != null ? this.arrowColor.color(ctx) : getIconColor(ctx));
viewHolder.arrow.clearAnimation();
if (!isExpanded()) {
ViewCompat.setRotation(viewHolder.arrow, 0);
ViewCompat.setRotation(viewHolder.arrow, this.arrowRotationAngleStart);
} else {
ViewCompat.setRotation(viewHolder.arrow, 180);
ViewCompat.setRotation(viewHolder.arrow, this.arrowRotationAngleEnd);
}

//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ public ProfileDrawerItem withEmail(String email) {
return this;
}

/**
* Whether to show the profile name in the account switcher.
*
* @param nameShown show name in switcher
* @return the {@link ProfileDrawerItem}
*/
public ProfileDrawerItem withNameShown(boolean nameShown) {
this.nameShown = nameShown;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
import android.view.View;
import android.view.ViewGroup;

import com.mikepenz.fastadapter.IDraggable;
import com.mikepenz.fastadapter.IExpandable;
import com.mikepenz.fastadapter.IItem;
import com.mikepenz.fastadapter.ISubItem;
import com.mikepenz.materialdrawer.util.DrawerImageLoader;

import java.util.List;

/**
* Created by mikepenz on 03.02.15.
*/
public interface IDrawerItem<T, VH extends RecyclerView.ViewHolder> extends IItem<T, VH> {
public interface IDrawerItem<T, VH extends RecyclerView.ViewHolder> extends IItem<T, VH>, IExpandable<T, IDrawerItem>, ISubItem<IDrawerItem, IDrawerItem> {

Object getTag();

Expand All @@ -36,6 +40,8 @@ public interface IDrawerItem<T, VH extends RecyclerView.ViewHolder> extends IIte

VH getViewHolder(ViewGroup parent);

void unbindView(VH holder);

void bindView(VH holder, List payloads);

boolean equals(long id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<b>MaterialDrawer</b> the flexible, easy to use, all in one drawer library for your Android project.
]]>
</string>
<string name="library_materialdrawer_libraryVersion">5.6.0</string>
<string name="library_materialdrawer_libraryVersion">5.7.0</string>
<string name="library_materialdrawer_libraryWebsite">https://github.com/mikepenz/MaterialDrawer</string>
<string name="library_materialdrawer_licenseId">apache_2_0</string>
<string name="library_materialdrawer_isOpenSource">true</string>
Expand Down

0 comments on commit 6288b3f

Please sign in to comment.