Skip to content

Commit

Permalink
Merge branch 'release/v5.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Apr 22, 2016
2 parents fbb3d65 + 64876f5 commit e1925a2
Show file tree
Hide file tree
Showing 30 changed files with 156 additions and 483 deletions.
7 changes: 3 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

Expand Down Expand Up @@ -178,15 +178,15 @@ Apache License
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright 2016 Mike Penz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -199,4 +199,3 @@ Apache License
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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 then **5 minutes**
- integrate in less than **5 minutes**
- compatible down to **API Level 10**
- includes an **AccountSwitcher**
- quick and simple api
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.2.0@aar') {
compile('com.mikepenz:materialdrawer:5.2.1@aar') {
transitive = true
}
```
Expand Down
24 changes: 9 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,16 @@ try {
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion setup.compileSdk
buildToolsVersion setup.buildTools

defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode 520
versionName "5.2.0"
minSdkVersion setup.minSdk
targetSdkVersion setup.targetSdk
versionCode 521
versionName "5.2.1"

applicationVariants.all { variant ->
variant.outputs.each { output ->
def file = output.outputFile
def fileName = file.name.replace(".apk", "-v" + versionName + "-c" + versionCode + ".apk")
output.outputFile = new File(file.parentFile, fileName)
}
}
setProperty("archivesBaseName", "-v$versionName-c$versionCode")
}
buildTypes {
debug {
Expand Down Expand Up @@ -50,8 +44,8 @@ android {
dependencies {
compile project(':library')

compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${versions.supportLib}"
compile "com.android.support:cardview-v7:${versions.supportLib}"

// used to showcase how to load images
compile 'com.squareup.picasso:picasso:2.5.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.mikepenz.materialdrawer.holder.ImageHolder;
import com.mikepenz.materialdrawer.holder.StringHolder;
import com.mikepenz.materialdrawer.model.BaseDrawerItem;
import com.mikepenz.materialdrawer.util.DrawerImageLoader;
import com.mikepenz.materialdrawer.util.DrawerUIUtils;
import com.mikepenz.materialize.util.UIUtils;

Expand Down Expand Up @@ -103,6 +104,9 @@ protected void bindViewHelper(CustomBaseViewHolder viewHolder) {
viewHolder.description.setTypeface(getTypeface());
}

//we make sure we reset the image first before setting the new one in case there is an empty one
DrawerImageLoader.getInstance().cancelImage(viewHolder.icon);
viewHolder.icon.setImageBitmap(null);
//get the drawables for our icon and set it
ImageHolder.applyTo(icon, viewHolder.icon, "customUrlItem");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public ViewHolder create(View v) {
}
}

static class ViewHolder extends CustomBaseViewHolder {
public static class ViewHolder extends CustomBaseViewHolder {
private View badgeContainer;
private TextView badge;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public ViewHolder create(View v) {
}
}

protected static class ViewHolder extends RecyclerView.ViewHolder {
public static class ViewHolder extends RecyclerView.ViewHolder {
private View view;
protected ImageView icon;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public ViewHolder create(View v) {
}
}

static class ViewHolder extends BaseViewHolder {
public static class ViewHolder extends BaseViewHolder {
//protected ImageButton ibOverflow;
private ImageButton menu;

Expand Down
15 changes: 9 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
buildscript {
ext {
setup = [compileSdk: 23,
buildTools: "23.0.3",
minSdk : 10,
targetSdk : 23]

versions = [supportLib: "23.3.0"]
}

repositories {
jcenter()
mavenCentral()
Expand All @@ -17,12 +26,6 @@ allprojects {
}
}

ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.3"
supportLibVersion = "23.3.0"
}

task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
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.2.0
VERSION_CODE=520
VERSION_NAME=5.2.1
VERSION_CODE=521
GROUP=com.mikepenz

POM_DESCRIPTION=MaterialDrawer Library
Expand Down
22 changes: 11 additions & 11 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion setup.compileSdk
buildToolsVersion setup.buildTools

defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode 520
versionName '5.2.0'
minSdkVersion setup.minSdk
targetSdkVersion setup.targetSdk
versionCode 521
versionName '5.2.1'
}
buildTypes {
release {
Expand All @@ -28,10 +28,10 @@ apply from: 'gradle-mvn-push.gradle'
apply from: 'gradle-jcenter-push.gradle'

dependencies {
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.android.support:appcompat-v7:${versions.supportLib}"
compile "com.android.support:recyclerview-v7:${versions.supportLib}"
compile "com.android.support:support-annotations:${versions.supportLib}"
compile "com.android.support:design:${versions.supportLib}"

// used to base on some backwards compatible themes
// contains util classes to support various android versions, and clean up code
Expand All @@ -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.4.1@aar'
compile 'com.mikepenz:fastadapter:1.4.4@aar'
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ protected AccountHeader(AccountHeaderBuilder accountHeaderBuilder) {
this.mAccountHeaderBuilder = accountHeaderBuilder;
}

/**
* the protected getter for the AccountHeaderBuilder
*
* @return the AccountHeaderBuilder
*/
protected AccountHeaderBuilder getAccountHeaderBuilder() {
return mAccountHeaderBuilder;
}

/**
* Get the Root view for the Header
*
Expand Down
23 changes: 21 additions & 2 deletions library/src/main/java/com/mikepenz/materialdrawer/Drawer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.mikepenz.fastadapter.adapters.FooterAdapter;
import com.mikepenz.fastadapter.adapters.HeaderAdapter;
import com.mikepenz.fastadapter.adapters.ItemAdapter;
import com.mikepenz.materialdrawer.holder.DimenHolder;
import com.mikepenz.materialdrawer.holder.ImageHolder;
import com.mikepenz.materialdrawer.holder.StringHolder;
import com.mikepenz.materialdrawer.model.ContainerDrawerItem;
Expand Down Expand Up @@ -304,19 +305,34 @@ public void setHeader(@NonNull View view, boolean divider) {
* @param divider
*/
public void setHeader(@NonNull View view, boolean padding, boolean divider) {
setHeader(view, padding, divider, null);
}

/**
* method to replace a previous set header
*
* @param view
* @param padding
* @param divider
* @param height
*/
public void setHeader(@NonNull View view, boolean padding, boolean divider, DimenHolder height) {
mDrawerBuilder.getHeaderAdapter().clear();
if (padding) {
mDrawerBuilder.getHeaderAdapter().add(new ContainerDrawerItem().withView(view).withDivider(divider).withViewPosition(ContainerDrawerItem.Position.TOP));
mDrawerBuilder.getHeaderAdapter().add(new ContainerDrawerItem().withView(view).withDivider(divider).withHeight(height).withViewPosition(ContainerDrawerItem.Position.TOP));
} else {
mDrawerBuilder.getHeaderAdapter().add(new ContainerDrawerItem().withView(view).withDivider(divider).withViewPosition(ContainerDrawerItem.Position.NONE));
mDrawerBuilder.getHeaderAdapter().add(new ContainerDrawerItem().withView(view).withDivider(divider).withHeight(height).withViewPosition(ContainerDrawerItem.Position.NONE));
}
//we need to set the padding so the header starts on top
mDrawerBuilder.mRecyclerView.setPadding(mDrawerBuilder.mRecyclerView.getPaddingLeft(), 0, mDrawerBuilder.mRecyclerView.getPaddingRight(), mDrawerBuilder.mRecyclerView.getPaddingBottom());
}

/**
* method to remove the header of the list
*/
public void removeHeader() {
mDrawerBuilder.getHeaderAdapter().clear();
//possibly there should be also a reset of the padding so the first item starts below the toolbar
}

/**
Expand Down Expand Up @@ -541,6 +557,9 @@ public boolean setSelectionAtPosition(int position, boolean fireOnClick) {
if (mDrawerBuilder.mOnDrawerItemClickListener != null && fireOnClick && position >= 0) {
mDrawerBuilder.mOnDrawerItemClickListener.onItemClick(null, position, mDrawerBuilder.mAdapter.getItem(position));
}

//we set the selection on a normal item in the drawer so we have to deselect the items in the StickyDrawer
mDrawerBuilder.resetStickyFooterSelection();
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ private void createContent() {
} else if (mSliderBackgroundDrawable != null) {
UIUtils.setBackground(mSliderLayout, mSliderBackgroundDrawable);
} else if (mSliderBackgroundDrawableRes != -1) {
UIUtils.setBackground(mSliderLayout, mSliderBackgroundColorRes);
UIUtils.setBackground(mSliderLayout, mSliderBackgroundDrawableRes);
}

//handle the header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public void createItems() {
mAdapter.clear();

int profileOffset = 0;
if (mAccountHeader != null) {
if (mAccountHeader != null && mAccountHeader.getAccountHeaderBuilder().mProfileImagesVisible) {
IProfile profile = mAccountHeader.getActiveProfile();
if (profile instanceof IDrawerItem) {
mAdapter.add(generateMiniDrawerItem((IDrawerItem) profile));
Expand Down
Loading

0 comments on commit e1925a2

Please sign in to comment.