diff --git a/app/src/main/java/com/mikepenz/materialdrawer/app/DrawerActivity.java b/app/src/main/java/com/mikepenz/materialdrawer/app/DrawerActivity.java index d83a5e22a..f2f3fcc1a 100755 --- a/app/src/main/java/com/mikepenz/materialdrawer/app/DrawerActivity.java +++ b/app/src/main/java/com/mikepenz/materialdrawer/app/DrawerActivity.java @@ -62,18 +62,19 @@ protected void onCreate(Bundle savedInstanceState) { // Create a few sample profile // NOTE you have to define the loader logic too. See the CustomApplication for more details - final IProfile profile = new ProfileDrawerItem().withName("Mike Penz").withEmail("mikepenz@gmail.com").withIcon("https://avatars3.githubusercontent.com/u/1476232?v=3&s=460").withIdentifier(100); + final IProfile profile = new ProfileDrawerItem().withName("Mike Penz").withBackgroundColor("#ff0099").withEmail("mikepenz@gmail.com").withIcon("https://avatars3.githubusercontent.com/u/1476232?v=3&s=460").withIdentifier(100); final IProfile profile2 = new ProfileDrawerItem().withName("Bernat Borras").withEmail("alorma@github.com").withIcon(Uri.parse("https://avatars3.githubusercontent.com/u/887462?v=3&s=460")).withIdentifier(101); final IProfile profile3 = new ProfileDrawerItem().withName("Max Muster").withEmail("max.mustermann@gmail.com").withIcon(R.drawable.profile2).withIdentifier(102); final IProfile profile4 = new ProfileDrawerItem().withName("Felix House").withEmail("felix.house@gmail.com").withIcon(R.drawable.profile3).withIdentifier(103); final IProfile profile5 = new ProfileDrawerItem().withName("Mr. X").withEmail("mister.x.super@gmail.com").withIcon(R.drawable.profile4).withIdentifier(104); - final IProfile profile6 = new ProfileDrawerItem().withName("Batman").withEmail("batman@gmail.com").withIcon(R.drawable.profile5).withIdentifier(105); + final IProfile profile6 = new ProfileDrawerItem().withName("Batman").withBackgroundImage(R.drawable.default_avatar).withEmail("batman@gmail.com").withIcon(R.drawable.profile5).withIdentifier(105); // Create the AccountHeader headerResult = new AccountHeaderBuilder() .withActivity(this) .withTranslucentStatusBar(true) - .withHeaderBackground(R.drawable.header) + .withHeaderProfileImage(R.drawable.header) + .withOrgSubtitle("انتخاب سازمان") .addProfiles( profile, profile2, @@ -136,8 +137,8 @@ public boolean onProfileChanged(View view, IProfile profile, boolean current) { new SecondaryDrawerItem().withName("CollapsableItem 2").withLevel(2).withIcon(GoogleMaterial.Icon.gmd_8tracks).withIdentifier(2001) ), new ExpandableDrawerItem().withName("Collapsable").withIcon(GoogleMaterial.Icon.gmd_collection_case_play).withIdentifier(19).withSelectable(false).withSubItems( - new SecondaryDrawerItem().withName("CollapsableItem").withLevel(2).withIcon(GoogleMaterial.Icon.gmd_8tracks).withIdentifier(2002), - new SecondaryDrawerItem().withName("CollapsableItem 2").withLevel(2).withIcon(GoogleMaterial.Icon.gmd_8tracks).withIdentifier(2003) + new SecondaryDrawerItem().withName("CollapsableItem").withLevel(2).withIcon(GoogleMaterial.Icon.gmd_8tracks).withIdentifier(2002), + new SecondaryDrawerItem().withName("CollapsableItem 2").withLevel(2).withIcon(GoogleMaterial.Icon.gmd_8tracks).withIdentifier(2003) ), new SecondaryDrawerItem().withName(R.string.drawer_item_open_source).withIcon(FontAwesome.Icon.faw_github).withIdentifier(20).withSelectable(false), new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(GoogleMaterial.Icon.gmd_format_color_fill).withIdentifier(21).withTag("Bullhorn"), diff --git a/app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/AccountDividerDrawerItem.java b/app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/AccountDividerDrawerItem.java index 1da56d064..d3722085c 100644 --- a/app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/AccountDividerDrawerItem.java +++ b/app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/AccountDividerDrawerItem.java @@ -4,6 +4,7 @@ import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; import android.support.annotation.LayoutRes; import android.support.v4.view.ViewCompat; @@ -81,6 +82,16 @@ public StringHolder getEmail() { return null; } + @Override + public AccountDividerDrawerItem withOrgSubtitle(String orgSubtitle) { + return null; + } + + @Override + public StringHolder getOrgSubtitle() { + return null; + } + @Override public AccountDividerDrawerItem withIcon(Drawable icon) { return null; @@ -111,11 +122,56 @@ public AccountDividerDrawerItem withIcon(IIcon icon) { return null; } + @Override + public AccountDividerDrawerItem withBackgroundImage(Drawable icon) { + return null; + } + + @Override + public AccountDividerDrawerItem withBackgroundImage(Bitmap icon) { + return null; + } + + @Override + public AccountDividerDrawerItem withBackgroundImage(@DrawableRes int icon) { + return null; + } + + @Override + public AccountDividerDrawerItem withBackgroundImage(String icon) { + return null; + } + + @Override + public AccountDividerDrawerItem withBackgroundImage(Uri icon) { + return null; + } + @Override public ImageHolder getIcon() { return null; } + @Override + public ImageHolder getBackgroundImage() { + return null; + } + + @Override + public int getBackgroundColor() { + return 0; + } + + @Override + public AccountDividerDrawerItem withBackgroundColor(@ColorInt int color) { + return null; + } + + @Override + public AccountDividerDrawerItem withBackgroundColor(String color) { + return null; + } + public static class ItemFactory implements ViewHolderFactory { public ViewHolder create(View v) { return new ViewHolder(v); diff --git a/build.gradle b/build.gradle index dce343298..a7ada346d 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.2' + classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.novoda:bintray-release:0.3.4' } } diff --git a/gradle.properties b/gradle.properties index 6a3bf6290..2d49ab8dd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,30 @@ -# Maven stuff +## Project-wide Gradle settings. +# +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx1024m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +# +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +#Sat Jan 14 21:39:04 IRST 2017 +systemProp.http.proxyPort=1080 +POM_LICENCE_URL=http\://www.apache.org/licenses/LICENSE-2.0.txt VERSION_NAME=5.8.1 VERSION_CODE=581 +POM_DEVELOPER_ID=mikepenz +POM_SCM_DEV_CONNECTION=scm\:git@github.com\:mikepenz/MaterialDrawer.git +POM_SCM_URL=https\://github.com/mikepenz/MaterialDrawer GROUP=com.mikepenz -POM_DESCRIPTION=MaterialDrawer Library -POM_URL=https://github.com/mikepenz/MaterialDrawer -POM_SCM_URL=https://github.com/mikepenz/MaterialDrawer -POM_SCM_CONNECTION=scm:git@github.com:mikepenz/MaterialDrawer.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:mikepenz/MaterialDrawer.git -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo -POM_DEVELOPER_ID=mikepenz -POM_DEVELOPER_NAME=Mike Penz \ No newline at end of file +POM_DEVELOPER_NAME=Mike Penz +systemProp.http.proxyHost=127.0.0.1 +POM_URL=https\://github.com/mikepenz/MaterialDrawer +POM_SCM_CONNECTION=scm\:git@github.com\:mikepenz/MaterialDrawer.git +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_DESCRIPTION=MaterialDrawer Library diff --git a/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java b/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java index 690404ce1..850fdfca6 100644 --- a/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java +++ b/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java @@ -2,6 +2,7 @@ import android.app.Activity; import android.content.Context; +import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Build; @@ -54,6 +55,7 @@ public class AccountHeaderBuilder { protected ImageView mAccountSwitcherArrow; protected TextView mCurrentProfileName; protected TextView mCurrentProfileEmail; + protected TextView mCurrentProfileEmailSubtitle; protected BezelImageView mProfileFirstView; protected BezelImageView mProfileSecondView; protected BezelImageView mProfileThirdView; @@ -71,6 +73,11 @@ public class AccountHeaderBuilder { // the activity to use protected Activity mActivity; + private StringHolder headerOrgSubtitle; + private ImageHolder mHeaderProfileImage; + private ImageView mAccountHeaderProfileImage; + private ImageView.ScaleType mHeaderProfileImageScaleType = null; + private ImageView mCurrentBackgroundColor; /** * Pass the activity you use the drawer in ;) @@ -106,6 +113,9 @@ public AccountHeaderBuilder withCompactStyle(boolean compactStyle) { // the typeface used for email textView only. overrides mTypeface protected Typeface mEmailTypeface; + // the typeface used for email textView only. overrides mTypeface + protected Typeface mEmailSubtitleTypeface; + /** * Define the typeface which will be used for all textViews in the AccountHeader * @@ -365,6 +375,33 @@ public AccountHeaderBuilder withHeaderBackground(ImageHolder headerBackground) { return this; } + /** + * set the profile image for the header + * + * @param headerProfileImage + * @return + */ + public AccountHeaderBuilder withHeaderProfileImage(@DrawableRes int headerProfileImage) { + this.mHeaderProfileImage = new ImageHolder(headerProfileImage); + return this; + } + + /** + * set the background for the slider as color + * + * @param headerProfileImage + * @return + */ + public AccountHeaderBuilder withHeaderProfileImage(Drawable headerProfileImage) { + this.mHeaderProfileImage = new ImageHolder(headerProfileImage); + return this; + } + + public AccountHeaderBuilder withOrgSubtitle(String s) { + this.headerOrgSubtitle = new StringHolder(s); + return this; + } + //background scale type protected ImageView.ScaleType mHeaderBackgroundScaleType = null; @@ -379,6 +416,17 @@ public AccountHeaderBuilder withHeaderBackgroundScaleType(ImageView.ScaleType he return this; } + /** + * define the ScaleType for the header Profile Image + * + * @param headerBackgroundScaleType + * @return + */ + public AccountHeaderBuilder withHeaderProfileImageScaleType(ImageView.ScaleType headerBackgroundScaleType) { + this.mHeaderProfileImageScaleType = headerBackgroundScaleType; + return this; + } + //profile images in the header are shown or not protected boolean mProfileImagesVisible = true; @@ -805,13 +853,19 @@ public AccountHeader build() { // get the background view mAccountHeaderBackground = (ImageView) mAccountHeaderContainer.findViewById(R.id.material_drawer_account_header_background); + mAccountHeaderProfileImage = (ImageView) mAccountHeaderContainer.findViewById(R.id.material_drawer_account_header_profile); // set the background ImageHolder.applyTo(mHeaderBackground, mAccountHeaderBackground, DrawerImageLoader.Tags.ACCOUNT_HEADER.name()); + ImageHolder.applyTo(mHeaderProfileImage, mAccountHeaderProfileImage, DrawerImageLoader.Tags.ACCOUNT_HEADER_PROFILE.name()); if (mHeaderBackgroundScaleType != null) { mAccountHeaderBackground.setScaleType(mHeaderBackgroundScaleType); } + if (mHeaderProfileImageScaleType != null) { + mAccountHeaderProfileImage.setScaleType(mHeaderProfileImageScaleType); + } + // get the text color to use for the text section int textColor = ColorHolder.color(mTextColor, mActivity, R.attr.material_drawer_header_selection_text, R.color.material_drawer_header_selection_text); @@ -831,8 +885,10 @@ public AccountHeader build() { //get the fields for the name mCurrentProfileView = (BezelImageView) mAccountHeader.findViewById(R.id.material_drawer_account_header_current); + mCurrentBackgroundColor = (ImageView) mAccountHeader.findViewById(R.id.material_drawer_account_header_org_color); mCurrentProfileName = (TextView) mAccountHeader.findViewById(R.id.material_drawer_account_header_name); - mCurrentProfileEmail = (TextView) mAccountHeader.findViewById(R.id.material_drawer_account_header_email); + mCurrentProfileEmail = (TextView) mAccountHeader.findViewById(R.id.material_drawer_account_header_org); + mCurrentProfileEmailSubtitle = (TextView) mAccountHeader.findViewById(R.id.material_drawer_account_header_org_subtitle); //set the typeface for the AccountHeader if (mNameTypeface != null) { @@ -847,8 +903,18 @@ public AccountHeader build() { mCurrentProfileEmail.setTypeface(mTypeface); } + if (mEmailSubtitleTypeface != null) { + mCurrentProfileEmailSubtitle.setTypeface(mEmailSubtitleTypeface); + } else if (mTypeface != null) { + mCurrentProfileEmailSubtitle.setTypeface(mTypeface); + } + + // set subtitle into textView + StringHolder.applyTo(headerOrgSubtitle, mCurrentProfileEmailSubtitle); + mCurrentProfileName.setTextColor(textColor); mCurrentProfileEmail.setTextColor(textColor); + mCurrentProfileEmailSubtitle.setTextColor(textColor); mProfileFirstView = (BezelImageView) mAccountHeader.findViewById(R.id.material_drawer_account_header_small_first); mProfileSecondView = (BezelImageView) mAccountHeader.findViewById(R.id.material_drawer_account_header_small_second); @@ -1060,6 +1126,7 @@ protected boolean switchProfiles(IProfile newSelection) { */ protected void buildProfiles() { mCurrentProfileView.setVisibility(View.INVISIBLE); + mCurrentBackgroundColor.setVisibility(View.INVISIBLE); mAccountHeaderTextSection.setVisibility(View.INVISIBLE); mAccountSwitcherArrow.setVisibility(View.GONE); mProfileFirstView.setVisibility(View.GONE); @@ -1071,9 +1138,10 @@ protected void buildProfiles() { mCurrentProfileName.setText(""); mCurrentProfileEmail.setText(""); + //we only handle the padding if we are not in compact mode if (!mCompactStyle) { - mAccountHeaderTextSection.setPadding(0, 0, (int) UIUtils.convertDpToPixel(56, mAccountHeaderTextSection.getContext()), 0); + mAccountHeaderTextSection.setPadding((int) UIUtils.convertDpToPixel(56, mAccountHeaderTextSection.getContext()), 0, 0, 0); } handleSelectionView(mCurrentProfile, true); @@ -1081,6 +1149,8 @@ protected void buildProfiles() { if (mCurrentProfile != null) { if ((mProfileImagesVisible || mOnlyMainProfileImageVisible) && !mOnlySmallProfileImagesVisible) { setImageOrPlaceholder(mCurrentProfileView, mCurrentProfile.getIcon()); + setImage(mCurrentBackgroundColor, mCurrentProfile.getBackgroundImage()); + setBackgroundColor(mAccountHeader, mCurrentProfile.getBackgroundColor()); if (mProfileImagesClickable) { mCurrentProfileView.setOnClickListener(onCurrentProfileClickListener); mCurrentProfileView.setOnLongClickListener(onCurrentProfileLongClickListener); @@ -1089,8 +1159,10 @@ protected void buildProfiles() { mCurrentProfileView.disableTouchFeedback(true); } mCurrentProfileView.setVisibility(View.VISIBLE); + mCurrentBackgroundColor.setVisibility(View.VISIBLE); mCurrentProfileView.invalidate(); + mCurrentBackgroundColor.invalidate(); } else if (mCompactStyle) { mCurrentProfileView.setVisibility(View.GONE); } @@ -1099,10 +1171,12 @@ protected void buildProfiles() { handleSelectionView(mCurrentProfile, true); mAccountSwitcherArrow.setVisibility(View.VISIBLE); mCurrentProfileView.setTag(R.id.material_drawer_profile_header, mCurrentProfile); + mCurrentBackgroundColor.setTag(R.id.material_drawer_account_header_org_color, mCurrentProfile); StringHolder.applyTo(mCurrentProfile.getName(), mCurrentProfileName); StringHolder.applyTo(mCurrentProfile.getEmail(), mCurrentProfileEmail); + if (mProfileFirst != null && mProfileImagesVisible && !mOnlyMainProfileImageVisible) { setImageOrPlaceholder(mProfileFirstView, mProfileFirst.getIcon()); mProfileFirstView.setTag(R.id.material_drawer_profile_header, mProfileFirst); @@ -1151,6 +1225,7 @@ protected void buildProfiles() { if (mCurrentProfile != null) { StringHolder.applyTo(mCurrentProfile.getName(), mCurrentProfileName); StringHolder.applyTo(mCurrentProfile.getEmail(), mCurrentProfileEmail); + StringHolder.applyTo(mCurrentProfile.getOrgSubtitle(), mCurrentProfileEmailSubtitle); } } @@ -1163,6 +1238,7 @@ protected void buildProfiles() { } if (!mSelectionSecondLineShown) { mCurrentProfileEmail.setVisibility(View.GONE); + mCurrentProfileEmailSubtitle.setVisibility(View.GONE); } if (!TextUtils.isEmpty(mSelectionSecondLine)) { mCurrentProfileEmail.setText(mSelectionSecondLine); @@ -1186,6 +1262,16 @@ protected void buildProfiles() { } } + private void setBackgroundColor(View mAccountHeader, int backgroundColor) { + + if (backgroundColor == 0) { + mAccountHeader.setBackgroundColor(Color.TRANSPARENT); + } else { + mAccountHeader.setBackgroundColor(backgroundColor); + } + + } + /** * small helper method to set an profile image or a placeholder * @@ -1201,6 +1287,25 @@ private void setImageOrPlaceholder(ImageView iv, ImageHolder imageHolder) { ImageHolder.applyTo(imageHolder, iv, DrawerImageLoader.Tags.PROFILE.name()); } + /** + * small helper method to set an profile image or a placeholder + * + * @param iv + * @param imageHolder + */ + private void setImage(ImageView iv, ImageHolder imageHolder) { + + //cancel previous started image loading processes + DrawerImageLoader.getInstance().cancelImage(iv); + + if (imageHolder == null) { + iv.setImageDrawable(null); + } else { + //set the real image (probably also the uri) + ImageHolder.applyTo(imageHolder, iv, DrawerImageLoader.Tags.PROFILE_ORG_BACKGROUND.name()); + } + } + /** * onProfileClickListener to notify onClick on the current profile image */ @@ -1485,4 +1590,5 @@ protected void updateHeaderAndList() { buildDrawerSelectionList(); } } + } diff --git a/library/src/main/java/com/mikepenz/materialdrawer/model/MiniProfileDrawerItem.java b/library/src/main/java/com/mikepenz/materialdrawer/model/MiniProfileDrawerItem.java index 7742cedc2..45f1da902 100644 --- a/library/src/main/java/com/mikepenz/materialdrawer/model/MiniProfileDrawerItem.java +++ b/library/src/main/java/com/mikepenz/materialdrawer/model/MiniProfileDrawerItem.java @@ -1,8 +1,10 @@ package com.mikepenz.materialdrawer.model; import android.graphics.Bitmap; +import android.graphics.Color; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.support.annotation.ColorInt; import android.support.annotation.DimenRes; import android.support.annotation.DrawableRes; import android.support.annotation.LayoutRes; @@ -27,6 +29,8 @@ public class MiniProfileDrawerItem extends AbstractDrawerItem extends IIdentifyable { StringHolder getEmail(); + T withOrgSubtitle(String orgSubtitle); + + StringHolder getOrgSubtitle(); + T withIcon(Drawable icon); T withIcon(Bitmap bitmap); @@ -34,9 +39,27 @@ public interface IProfile extends IIdentifyable { T withIcon(IIcon icon); + T withBackgroundImage(Drawable icon); + + T withBackgroundImage(Bitmap icon); + + T withBackgroundImage(@DrawableRes int icon); + + T withBackgroundImage(String icon); + + T withBackgroundImage(Uri icon); + ImageHolder getIcon(); T withSelectable(boolean selectable); boolean isSelectable(); + + ImageHolder getBackgroundImage(); + + int getBackgroundColor(); + + T withBackgroundColor(@ColorInt int color); + + T withBackgroundColor(String color); } diff --git a/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerImageLoader.java b/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerImageLoader.java index ea8eda646..f7484a814 100644 --- a/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerImageLoader.java +++ b/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerImageLoader.java @@ -12,7 +12,8 @@ public class DrawerImageLoader { public enum Tags { PROFILE, PROFILE_DRAWER_ITEM, - ACCOUNT_HEADER + ACCOUNT_HEADER, + PROFILE_ORG_BACKGROUND, ACCOUNT_HEADER_PROFILE } private static DrawerImageLoader SINGLETON = null; diff --git a/library/src/main/res/drawable-xxhdpi/default_avatar.png b/library/src/main/res/drawable-xxhdpi/default_avatar.png new file mode 100644 index 000000000..6d0fe359a Binary files /dev/null and b/library/src/main/res/drawable-xxhdpi/default_avatar.png differ diff --git a/library/src/main/res/drawable-xxhdpi/default_bg.jpg b/library/src/main/res/drawable-xxhdpi/default_bg.jpg new file mode 100644 index 000000000..98ce4abe1 Binary files /dev/null and b/library/src/main/res/drawable-xxhdpi/default_bg.jpg differ diff --git a/library/src/main/res/layout/material_drawer_compact_header.xml b/library/src/main/res/layout/material_drawer_compact_header.xml index f8cd01d55..94ce5872b 100644 --- a/library/src/main/res/layout/material_drawer_compact_header.xml +++ b/library/src/main/res/layout/material_drawer_compact_header.xml @@ -1,7 +1,9 @@ + android:clickable="true" + tools:ignore="RtlHardcoded, ContentDescription, UnusedAttribute"> + + + android:visibility="gone" + tools:src="@drawable/default_avatar" + tools:visibility="visible" /> + android:visibility="gone" + tools:src="@drawable/default_avatar" + tools:visibility="visible" /> + android:visibility="gone" + tools:src="@drawable/default_avatar" + tools:visibility="visible" /> - + android:layout_marginTop="@dimen/material_drawer_account_header_dropdown" /> + android:textSize="@dimen/material_drawer_account_header_text" + tools:text="test" /> - + android:orientation="horizontal"> + + + + + - + android:clickable="true" + android:elevation="2dp" + tools:src="@drawable/default_avatar" /> \ No newline at end of file diff --git a/library/src/main/res/layout/material_drawer_header.xml b/library/src/main/res/layout/material_drawer_header.xml index cdcb49729..197b3ce59 100644 --- a/library/src/main/res/layout/material_drawer_header.xml +++ b/library/src/main/res/layout/material_drawer_header.xml @@ -1,64 +1,93 @@ + android:clickable="true" + tools:ignore="RtlHardcoded"> + android:scaleType="centerCrop" + tools:src="@drawable/default_bg" /> + + + android:elevation="2dp" + android:scaleType="centerCrop" + android:src="@drawable/default_avatar" /> + + + android:visibility="gone" + tools:src="@drawable/default_avatar" + tools:visibility="visible" /> + android:visibility="gone" + tools:src="@drawable/default_avatar" + tools:visibility="visible" /> + android:visibility="gone" + tools:src="@drawable/default_avatar" + tools:visibility="visible" /> + android:paddingLeft="56dp" + android:paddingRight="0dp"> + android:textSize="@dimen/material_drawer_account_header_text" + tools:text="علی عبداللهی" /> - + android:orientation="horizontal"> + + + + + + @@ -104,9 +153,9 @@ android:layout_width="@dimen/material_drawer_account_header_dropdown" android:layout_height="@dimen/material_drawer_account_header_dropdown" android:layout_alignParentBottom="true" - android:layout_alignParentRight="true" + android:layout_alignParentLeft="true" android:layout_marginBottom="@dimen/material_drawer_account_header_dropdown_margin_bottom" - android:layout_marginRight="@dimen/material_drawer_vertical_padding" /> + android:layout_marginLeft="@dimen/material_drawer_vertical_padding" /> \ No newline at end of file diff --git a/library/src/main/res/layout/material_drawer_item_profile_setting.xml b/library/src/main/res/layout/material_drawer_item_profile_setting.xml index 0b7e3589d..8d280d484 100755 --- a/library/src/main/res/layout/material_drawer_item_profile_setting.xml +++ b/library/src/main/res/layout/material_drawer_item_profile_setting.xml @@ -9,26 +9,26 @@ android:paddingRight="@dimen/material_drawer_vertical_padding" android:paddingStart="@dimen/material_drawer_vertical_padding"> - - + + + \ No newline at end of file diff --git a/library/src/main/res/layout/material_drawer_item_secondary.xml b/library/src/main/res/layout/material_drawer_item_secondary.xml index bab206269..0db225232 100755 --- a/library/src/main/res/layout/material_drawer_item_secondary.xml +++ b/library/src/main/res/layout/material_drawer_item_secondary.xml @@ -9,23 +9,35 @@ android:paddingRight="@dimen/material_drawer_vertical_padding" android:paddingStart="@dimen/material_drawer_vertical_padding"> - + android:paddingRight="@dimen/material_drawer_padding"> + + + - + android:paddingTop="@dimen/material_drawer_item_secondary_icon_padding" /> - - \ No newline at end of file diff --git a/library/src/main/res/layout/material_drawer_item_secondary_switch.xml b/library/src/main/res/layout/material_drawer_item_secondary_switch.xml index 42fdeb575..024583813 100644 --- a/library/src/main/res/layout/material_drawer_item_secondary_switch.xml +++ b/library/src/main/res/layout/material_drawer_item_secondary_switch.xml @@ -11,23 +11,24 @@ android:paddingRight="@dimen/material_drawer_vertical_padding" android:paddingStart="@dimen/material_drawer_vertical_padding"> - + android:paddingRight="@dimen/material_drawer_padding" + android:textOff="" + android:textOn="" + android:textSize="@dimen/material_drawer_item_secondary_extra_text" + app:showText="false" /> - + android:paddingTop="@dimen/material_drawer_item_secondary_icon_padding" /> + \ No newline at end of file diff --git a/library/src/main/res/layout/material_drawer_item_secondary_toggle.xml b/library/src/main/res/layout/material_drawer_item_secondary_toggle.xml index 4c0adef80..e87db27ab 100644 --- a/library/src/main/res/layout/material_drawer_item_secondary_toggle.xml +++ b/library/src/main/res/layout/material_drawer_item_secondary_toggle.xml @@ -6,23 +6,27 @@ android:descendantFocusability="blocksDescendants" android:orientation="horizontal"> - + android:paddingRight="@dimen/material_drawer_padding"> + + + - + android:paddingTop="@dimen/material_drawer_item_secondary_icon_padding" /> - - \ No newline at end of file diff --git a/library/src/main/res/layout/material_drawer_item_section.xml b/library/src/main/res/layout/material_drawer_item_section.xml index f5bd453c9..a6c016a2e 100644 --- a/library/src/main/res/layout/material_drawer_item_section.xml +++ b/library/src/main/res/layout/material_drawer_item_section.xml @@ -1,5 +1,6 @@ @@ -15,10 +16,11 @@ android:layout_width="match_parent" android:layout_height="@dimen/material_drawer_item_primary" android:fontFamily="sans-serif-medium" - android:gravity="center_vertical|start" + android:gravity="center_vertical|right" android:lines="1" android:paddingLeft="@dimen/material_drawer_vertical_padding" android:paddingRight="@dimen/material_drawer_vertical_padding" android:singleLine="true" - android:textSize="@dimen/material_drawer_item_section_text" /> + android:textSize="@dimen/material_drawer_item_section_text" + tools:text="test" /> \ No newline at end of file diff --git a/library/src/main/res/layout/material_drawer_item_switch.xml b/library/src/main/res/layout/material_drawer_item_switch.xml index 5148757b6..81a75493e 100644 --- a/library/src/main/res/layout/material_drawer_item_switch.xml +++ b/library/src/main/res/layout/material_drawer_item_switch.xml @@ -11,17 +11,18 @@ android:paddingRight="@dimen/material_drawer_vertical_padding" android:paddingStart="@dimen/material_drawer_vertical_padding"> - + android:paddingRight="@dimen/material_drawer_padding" + android:textOff="" + android:textOn="" + android:textSize="@dimen/material_drawer_item_primary_text" + app:showText="false" /> + - + android:paddingTop="@dimen/material_drawer_item_primary_icon_padding" /> + \ No newline at end of file diff --git a/library/src/main/res/layout/material_drawer_item_toggle.xml b/library/src/main/res/layout/material_drawer_item_toggle.xml index 853cc584e..11ec4ab49 100755 --- a/library/src/main/res/layout/material_drawer_item_toggle.xml +++ b/library/src/main/res/layout/material_drawer_item_toggle.xml @@ -6,23 +6,28 @@ android:descendantFocusability="blocksDescendants" android:orientation="horizontal"> - + android:paddingRight="@dimen/material_drawer_padding"> + + + + - - - - + android:paddingTop="@dimen/material_drawer_item_primary_icon_padding" /> \ No newline at end of file diff --git a/library/src/main/res/values/dimens.xml b/library/src/main/res/values/dimens.xml index 0cb1952f7..061d205cc 100755 --- a/library/src/main/res/values/dimens.xml +++ b/library/src/main/res/values/dimens.xml @@ -19,7 +19,8 @@ 72dp 16dp 4dp - 64dp + 64dp + 32dp 40dp 56dp 14sp diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml index c26a8b875..b3dd86058 100755 --- a/library/src/main/res/values/strings.xml +++ b/library/src/main/res/values/strings.xml @@ -2,4 +2,5 @@ Open Close + سازمان انتخابی شما: