Skip to content

Commit

Permalink
Merge branch 'release/v5.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Jun 6, 2016
2 parents 5a443c6 + c727f7e commit 5faba89
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 12 deletions.
3 changes: 2 additions & 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.2.9@aar') {
compile('com.mikepenz:materialdrawer:5.3.0@aar') {
transitive = true
}
```
Expand Down Expand Up @@ -413,6 +413,7 @@ builder.withDrawerLayout(R.layout.material_drawer);
* [Tabe3 News Reader](https://play.google.com/store/apps/details?id=com.tabe3.news)
* [Facepunch Droid](https://play.google.com/store/apps/details?id=com.apps.anker.facepunchdroid)
* [World Tourist Attractions](https://play.google.com/store/apps/details?id=indian.fig.whatsaround)
* [HipCar](https://play.google.com/store/apps/details?id=com.hipcar.android)

#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 529
versionName "5.2.9"
versionCode 530
versionName "5.3.0"

setProperty("archivesBaseName", "-v$versionName-c$versionCode")
}
Expand Down
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Maven stuff
VERSION_NAME=5.2.9
VERSION_CODE=529
VERSION_NAME=5.3.0
VERSION_CODE=530
GROUP=com.mikepenz

POM_DESCRIPTION=MaterialDrawer Library
POM_URL=https://github.com/mikepenz/MaterialDrawer
POM_SCM_URL=https://github.com/mikepenz/MaterialDrawer
Expand Down
4 changes: 2 additions & 2 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 529
versionName '5.2.9'
versionCode 530
versionName '5.3.0'
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public Materialize getMaterialize() {
*/
public MiniDrawer getMiniDrawer() {
if (mDrawerBuilder.mMiniDrawer == null) {
mDrawerBuilder.mMiniDrawer = new MiniDrawer().withDrawer(this).withAccountHeader(mDrawerBuilder.mAccountHeader);
mDrawerBuilder.mMiniDrawer = new MiniDrawer().withDrawer(this).withAccountHeader(mDrawerBuilder.mAccountHeader).withPositionBasedStateManagement(mDrawerBuilder.mPositionBasedStateManagement);
}
return mDrawerBuilder.mMiniDrawer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,11 +863,24 @@ public DrawerBuilder withHasStableIds(boolean hasStableIds) {
}

// an adapter to use for the list
protected boolean mPositionBasedStateManagement = true;
protected FastAdapter<IDrawerItem> mAdapter;
protected HeaderAdapter<IDrawerItem> mHeaderAdapter = new HeaderAdapter<>();
protected ItemAdapter<IDrawerItem> mItemAdapter = new ItemAdapter<>();
protected FooterAdapter<IDrawerItem> mFooterAdapter = new FooterAdapter<>();

/**
* This allows to disable the default position based statemanagment of the FastAdapter and switch to the
* new identifier based state managment
*
* @param positionBasedStateManagement enable / disable the positionBasedStateManagement
* @return this
*/
public DrawerBuilder withPositionBasedStateManagement(boolean positionBasedStateManagement) {
this.mPositionBasedStateManagement = positionBasedStateManagement;
return this;
}

/**
* Define a custom Adapter which will be used in the drawer
* NOTE: this is not recommender
Expand All @@ -894,6 +907,7 @@ protected FastAdapter<IDrawerItem> getAdapter() {
mAdapter.withSelectable(true);
mAdapter.withAllowDeselection(false);
mAdapter.setHasStableIds(mHasStableIds);
mAdapter.withPositionBasedStateManagement(mPositionBasedStateManagement);

//we wrap our main Adapter with the item hosting adapter
mHeaderAdapter.wrap(mItemAdapter.wrap(mFooterAdapter.wrap(mAdapter)));
Expand Down Expand Up @@ -1485,7 +1499,7 @@ public Drawer buildView() {
//we only want to hook a Drawer to the MiniDrawer if it is the main drawer, not the appended one
if (!mAppended && mGenerateMiniDrawer) {
// if we should create a MiniDrawer we have to do this now
mMiniDrawer = new MiniDrawer().withDrawer(result).withAccountHeader(mAccountHeader);
mMiniDrawer = new MiniDrawer().withDrawer(result).withAccountHeader(mAccountHeader).withPositionBasedStateManagement(mPositionBasedStateManagement);
}

//forget the reference to the activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ public MiniDrawer withInRTL(boolean inRTL) {
return this;
}


protected boolean mPositionBasedStateManagement = true;

/**
* This allows to disable the default position based statemanagment of the FastAdapter and switch to the
* new identifier based state managment
*
* @param positionBasedStateManagement enable / disable the positionBasedStateManagement
* @return this
*/
public MiniDrawer withPositionBasedStateManagement(boolean positionBasedStateManagement) {
this.mPositionBasedStateManagement = positionBasedStateManagement;
return this;
}

private boolean mIncludeSecondaryDrawerItems = false;

/**
Expand Down Expand Up @@ -298,6 +313,7 @@ public View build(Context ctx) {
mAdapter = new FastItemAdapter<>();
mAdapter.withSelectable(true);
mAdapter.withAllowDeselection(false);
mAdapter.withPositionBasedStateManagement(mPositionBasedStateManagement);
mRecyclerView.setAdapter(mAdapter);

//if the activity with the drawer should be fullscreen add the padding for the statusbar
Expand Down Expand Up @@ -415,13 +431,16 @@ public void createItems() {
if (getDrawerItems() != null) {
//migrate to miniDrawerItems
int length = getDrawerItems().size();

int position = 0;
for (int i = 0; i < length; i++) {
IDrawerItem miniDrawerItem = generateMiniDrawerItem(getDrawerItems().get(i));
if (miniDrawerItem != null) {
if (miniDrawerItem.isSelected()) {
select = i;
select = position;
}
mAdapter.add(miniDrawerItem);
position = position + 1;
}
}

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.2.9</string>
<string name="library_materialdrawer_libraryVersion">5.3.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 5faba89

Please sign in to comment.