├── .gitignore ├── CHANGELOG.md ├── README.md ├── README_v1.0.5.md ├── Screenshot ├── Screenshot_01.png ├── Screenshot_02.png ├── Screenshot_03.png └── Screenshot_04.png ├── build.gradle ├── demo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── br │ │ └── liveo │ │ └── ndrawer │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── br │ │ └── liveo │ │ └── ndrawer │ │ ├── adapter │ │ ├── TabPagerItem.java │ │ └── ViewPagerAdapter.java │ │ └── ui │ │ ├── activity │ │ ├── MainActivity.java │ │ └── SettingsActivity.java │ │ └── fragment │ │ ├── MainFragment.java │ │ └── ViewPagerFragment.java │ └── res │ ├── drawable-hdpi │ ├── ic_add_white_24dp.png │ ├── ic_delete_black_24dp.png │ ├── ic_drafts_black_24dp.png │ ├── ic_inbox_black_24dp.png │ ├── ic_liveo.png │ ├── ic_no_user.png │ ├── ic_report_black_24dp.png │ ├── ic_search_white_24dp.png │ ├── ic_send_black_24dp.png │ ├── ic_settings_black_24dp.png │ └── ic_star_black_24dp.png │ ├── drawable-mdpi │ ├── ic_add_white_24dp.png │ ├── ic_delete_black_24dp.png │ ├── ic_drafts_black_24dp.png │ ├── ic_inbox_black_24dp.png │ ├── ic_liveo.png │ ├── ic_no_user.png │ ├── ic_report_black_24dp.png │ ├── ic_search_white_24dp.png │ ├── ic_send_black_24dp.png │ ├── ic_settings_black_24dp.png │ └── ic_star_black_24dp.png │ ├── drawable-xhdpi │ ├── ic_add_white_24dp.png │ ├── ic_delete_black_24dp.png │ ├── ic_drafts_black_24dp.png │ ├── ic_inbox_black_24dp.png │ ├── ic_liveo.png │ ├── ic_no_user.png │ ├── ic_report_black_24dp.png │ ├── ic_search_white_24dp.png │ ├── ic_send_black_24dp.png │ ├── ic_settings_black_24dp.png │ └── ic_star_black_24dp.png │ ├── drawable-xxhdpi │ ├── ic_add_white_24dp.png │ ├── ic_delete_black_24dp.png │ ├── ic_drafts_black_24dp.png │ ├── ic_inbox_black_24dp.png │ ├── ic_no_user.png │ ├── ic_report_black_24dp.png │ ├── ic_search_white_24dp.png │ ├── ic_send_black_24dp.png │ ├── ic_settings_black_24dp.png │ └── ic_star_black_24dp.png │ ├── drawable-xxxhdpi │ ├── ic_add_white_24dp.png │ ├── ic_delete_black_24dp.png │ ├── ic_drafts_black_24dp.png │ ├── ic_inbox_black_24dp.png │ ├── ic_no_user.png │ ├── ic_report_black_24dp.png │ ├── ic_search_white_24dp.png │ ├── ic_send_black_24dp.png │ ├── ic_settings_black_24dp.png │ └── ic_star_black_24dp.png │ ├── drawable │ ├── ic_user_background.jpg │ └── selector_check.xml │ ├── layout │ ├── custom_header_user.xml │ ├── fragment_main.xml │ └── fragment_viewpager.xml │ ├── menu │ └── menu.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-ldpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── values-es │ └── strings.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── themes.xml ├── gradle.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── br │ │ └── liveo │ │ └── navigationliveo │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── fonts │ │ ├── Roboto-Medium.ttf │ │ └── Roboto-Regular.ttf │ ├── java │ └── br │ │ └── liveo │ │ ├── Model │ │ ├── HelpItem.java │ │ ├── HelpLiveo.java │ │ └── Navigation.java │ │ ├── adapter │ │ ├── NavigationLiveoAdapter.java │ │ └── NavigationLiveoItemAdapter.java │ │ ├── interfaces │ │ ├── OnItemClickListener.java │ │ └── OnPrepareOptionsMenuLiveo.java │ │ ├── navigationliveo │ │ ├── NavigationActionBarLiveo.java │ │ ├── NavigationLiveo.java │ │ └── NavigationLiveoList.java │ │ └── ui │ │ └── RoundedImageView.java │ └── res │ ├── drawable │ ├── ic_rudsonlive.jpg │ ├── ic_user_background_first.jpg │ ├── ic_user_background_second.jpg │ ├── selector_check_item_navigation.xml │ ├── selector_no_check_item_navigation.xml │ └── selector_no_item_navigation.xml │ ├── layout │ ├── navigation_container.xml │ ├── navigation_list_drawer.xml │ ├── navigation_list_footer.xml │ ├── navigation_list_header.xml │ ├── navigation_list_item.xml │ ├── navigation_main_actionbar_dark.xml │ ├── navigation_main_actionbar_light.xml │ ├── navigation_main_dark.xml │ └── navigation_main_light.xml │ ├── values-es │ └── strings.xml │ ├── values-land │ └── dimens.xml │ ├── values-large-land │ └── dimens.xml │ ├── values-large │ └── dimens.xml │ ├── values-v21 │ ├── dimens.xml │ └── themes.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── themes.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | */build/ 15 | build/ 16 | gradle/ 17 | 18 | # Local configuration file (sdk path, etc) 19 | local.properties 20 | 21 | # IntelliJ / Android Studio 22 | .idea/ 23 | *.iml 24 | 25 | # Gradle 26 | .gradle/ 27 | 28 | # Eclipse project files 29 | .classpath 30 | .project 31 | 32 | # DSStore 33 | **/.DS_Store 34 | */.DS_Store 35 | /release.keystore 36 | /release.properties -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | #Change Log 2 | Version 2.5.1 *(12-03-2016)* 3 | ---------------------------- 4 | It requires 14+ API and android support v7 23.2.1 (AppCompatActivity + Toolbar) 5 | 6 | * New functions 7 | ```groovy 8 | Bug click header 9 | Update support library 10 | ``` 11 | 12 | 13 | Version 2.5 *(11-03-2016)* 14 | ---------------------------- 15 | It requires 14+ API and android support v7 23.2.0 (AppCompatActivity + Toolbar) 16 | 17 | * New functions 18 | ```groovy 19 | add item no check 20 | ``` 21 | 22 | 23 | Version 2.4.1 *(26-02-2016)* 24 | ---------------------------- 25 | It requires 14+ API and android support v7 23.2.0 (AppCompatActivity + Toolbar) 26 | 27 | * New functions 28 | ```groovy 29 | update support library 30 | bug footer item 31 | ``` 32 | 33 | Version 2.4 *(23-02-2016)* 34 | ---------------------------- 35 | It requires 14+ API and android support v7 23.1.1 (AppCompatActivity + Toolbar) 36 | 37 | * New functions 38 | ```groovy 39 | update gradle 40 | add counter in a subheader. 41 | ``` 42 | 43 | 44 | Version 2.3.6 *(24-11-2015)* 45 | ---------------------------- 46 | It requires 14+ API and android support v7 23.0.1 (AppCompatActivity + Toolbar) 47 | 48 | * New functions 49 | ```groovy 50 | update gradle 51 | update library Google 52 | ``` 53 | 54 | Version 2.3.5 *(15-07-2015)* 55 | ---------------------------- 56 | It requires 14+ API and android support v7 22.2.0 (AppCompatActivity + Toolbar) 57 | 58 | * New functions 59 | ```groovy 60 | update gradle 61 | ``` 62 | 63 | Version 2.3.4 *(15-07-2015)* 64 | ---------------------------- 65 | It requires 14+ API and android support v7 22.2.0 (AppCompatActivity + Toolbar) 66 | 67 | * New functions 68 | ```groovy 69 | Change in the choice of theme 70 | with(this) default theme is the dark 71 | with(this, Navigation.THEME_DARK) add theme Dark 72 | with(this, Navigation.THEME_LIGHT) add theme Light 73 | 74 | Error correction to add a custom header 75 | ``` 76 | 77 | Version 2.3.3 *(03-07-2015)* 78 | ---------------------------- 79 | It requires 14+ API and android support v7 22.2.0 (AppCompatActivity + Toolbar) 80 | 81 | * New functions 82 | ```groovy 83 | Bug Color Dialog 84 | ``` 85 | 86 | Version 2.3.2 *(03-06-2015)* 87 | ---------------------------- 88 | It requires 14+ API and android support v7 22.2.0 (AppCompatActivity + Toolbar) 89 | 90 | * New functions 91 | ```groovy 92 | Bug addHeaderView 93 | ``` 94 | 95 | 96 | Version 2.2.2 *(29-05-2015)* 97 | ---------------------------- 98 | It requires 14+ API and android support v7 22.2.0 (AppCompatActivity + Toolbar) 99 | 100 | * New functions 101 | ```groovy 102 | Add NavigationLiveo 103 | .removeHeader() 104 | ``` 105 | 106 | Version 2.1.1 *(25-05-2015)* 107 | ---------------------------- 108 | It requires 14+ API and android support v7 22.1.1 (AppCompatActivity + Toolbar) 109 | 110 | * New functions 111 | ```groovy 112 | Bug position 113 | 114 | .footerNameColor(int color) 115 | .footerIconColor(int color) 116 | .footerBackground(int color) 117 | ``` 118 | 119 | 120 | Version 2.0.1 *(25-05-2015)* 121 | ---------------------------- 122 | It requires 14+ API and android support v7 22.1.1 (AppCompatActivity + Toolbar) 123 | 124 | * New functions 125 | ```groovy 126 | Add NavigationActionBarLiveo 127 | .removeHeader() //only in NavigationActionBarLiveo 128 | ``` 129 | 130 | Version 2.0.0 *(24-05-2015)* 131 | ---------------------------- 132 | It requires 14+ API and android support v7 22.1.1 (AppCompatActivity + Toolbar) 133 | 134 | * New functions 135 | ```groovy 136 | with(this).startingPosition(1) //Starting position in the list 137 | .nameItem(mListNameItem) 138 | .iconItem(mListIconItem) 139 | .headerItem(mListHeaderItem) 140 | .countItem(mSparseCounterItem) 141 | 142 | //{optional} - List Customization "If you remove these methods and the list will take his white standard color" 143 | .selectorCheck(R.drawable.selector_check) //Inform the background of the selected item color 144 | .colorItemDefault(R.color.nliveo_gray) //Inform the standard color name, icon and counter 145 | .colorItemSelected(R.color.nliveo_purple_colorPrimary) //State the name of the color, icon and meter when it is selected 146 | .backgroundList(R.color.nliveo_black_light) //Inform the list of background color 147 | .colorLineSeparator(R.color.nliveo_transparent) //Inform the color of the subheader line 148 | 149 | .footerItem(R.string.settings, R.drawable.ic_settings_black_24dp) 150 | 151 | .setOnClickUser(onClickPhoto) 152 | .setOnClickFooter(onClickFooter) 153 | .build(); 154 | ``` 155 | 156 | Version 1.0.5 *(22-04-2015)* @deprecated 157 | ---------------------------- 158 | It requires 14+ API and android support v7 22.1.0 (AppCompatActivity + Toolbar) 159 | 160 | * New functions 161 | ```groovy 162 | Add AppCompatActivity 163 | ``` 164 | AppCompatActivity
165 | 166 | 167 | Version 1.0.4 *(26-02-2015)* 168 | ---------------------------- 169 | It requires 14+ API and android support v7 21.0.3 (Toolbar) 170 | 171 | * New functions 172 | ```groovy 173 | public void setColorSeparatorItemSubHeaderNavigation(int colorId){} 174 | public void setNewName(int position, String name){} 175 | public void setNewName(int position, int name){} 176 | public void setNewIcon(int position, int icon){} 177 | public void setNewInformationItem(int position, int name, int icon, int counter){} 178 | public void setNewInformationItem(int position, String name, int icon, int counter){} 179 | ``` 180 | Other methods
181 | 182 | 183 | Version 1.0.3 *(25-01-2015)* 184 | ---------------------------- 185 | It requires 14+ API and android support v7 21.0.3 (Toolbar) 186 | 187 | * Corrections 188 | ```groovy 189 | Bugs list items 190 | List width in landscape mode 191 | Center toolbar icons in landscape mode 192 | ``` 193 | * New functions 194 | ```groovy 195 | public void setColorIconItemNavigation(int colorId){} 196 | public void setColorNameItemNavigation(int colorId){} 197 | public void setFooterInformationDrawer(String title, int icon, int colorName, int colorIcon){} 198 | public void setFooterInformationDrawer(int title, int icon, int colorName, int colorIcon){} 199 | ``` 200 | Other methods
201 | 202 | Version 1.0.2 *(20-01-2015)* 203 | ---------------------------- 204 | It requires 14+ API and android support v7 21.0.3 (Toolbar) 205 | 206 | * New functions 207 | ```groovy 208 | public void showDefauldHeader(){} 209 | private void removeDefauldHeader(){} 210 | public void addCustomHeader(View v){} 211 | public void removeCustomdHeader(View v){} 212 | public void setElevationToolBar(float elevation){} 213 | ``` 214 | Other methods
215 | 216 | Version 1.1.0 *(17-01-2015)* 217 | ---------------------------- 218 | It requires 8+ API and android support v7 21.0.3 (Toolbar) 219 | 220 | * Add @param 221 | * New functions 222 | ```groovy 223 | public void setFooterIconColorNavigation(int colorId){} 224 | public void removeAlphaItemNavigation(){} 225 | public void setColorDefaultItemNavigation(int colorId){} 226 | public DrawerLayout getDrawerLayout() {} 227 | ``` 228 | Other methods
229 | 230 | Version 1.0.0 *(15-01-2015)* 231 | ---------------------------- 232 | It requires 8+ API and android support v7 21.0.3 (Toolbar) 233 | 234 | * Library publication :D 235 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Navigation drawer (library) 2 | 3 | It requires 14+ API and android support v7 23.2.1 (AppCompatActivity + Toolbar) 4 | 5 | ###Special thanks :D 6 | Jacob A. Moura for all his ideas, dedication, time and help.
7 | You are part of this project. 8 | 9 | ###Sample Application 10 | 11 | 12 | Android app on Google Play 14 | 15 | 16 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-NavigationDrawer--MaterialDesign-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1398) 17 | 18 | How to use? Very simple! : D 19 | 20 | #If you want, check versions before 21 | 22 | Change Log
23 | Log file 24 | 25 | #How to add to your project 26 | 27 | ###Gradle 28 | 29 | ```java 30 | dependencies { 31 | compile 'br.com.liveo:navigationdrawer-material:2.5.1' 32 | } 33 | ``` 34 | ###Maven 35 | 36 | ```xml 37 | 38 | br.com.liveo 39 | navigationdrawer-material 40 | 2.5.1 41 | aar 42 | 43 | ``` 44 | 45 | In your styles.xml choose your version: 46 | 47 | 48 | ```xml 49 | 55 | ```` 56 | 57 | ```xml 58 | 64 | ``` 65 | Also there is nLiveo.Theme.Light theme
66 | 67 | Available colors 68 | 69 | note: colorPrimaryDark property theme "nLiveoDrawer" should receive a color with alpha eg # 80RRGGBB - The "# 80" will ensure the transparency of statusBar. 70 | 71 | Remember to set your theme in your AndroidManifest.xml: 72 | 73 | ```xml 74 | 76 | android:theme="@style/myTheme" > 77 | ``` 78 | ```xml 79 | 81 | android:name=".MainActivity" 82 | android:theme="@style/nLiveoDrawer" //This is only necessary if using the NavigationLiveo 83 | 84 | 85 | ```` 86 | 87 | #In your Activity... 88 | 89 | Create a class and it extends the NavigationLiveo and implement the br.liveo.interfaces.OnItemClickListener. 90 | 91 | Ex: public class MainActivity extends NavigationLiveo implements OnItemClickListener { 92 | 93 | ###Do not use the method "onCreate" and "setContentView" of your Activity, you will use the method "onInt" 94 | 95 | In the method "onInt" inform the items on your list 96 | 97 | ```java 98 | private HelpLiveo mHelpLiveo; 99 | 100 | @Override 101 | public void onInt(Bundle savedInstanceState) { 102 | // User Information 103 | this.userName.setText("Rudson Lima"); 104 | this.userEmail.setText("rudsonlive@gmail.com"); 105 | this.userPhoto.setImageResource(R.drawable.ic_rudsonlive); 106 | this.userBackground.setImageResource(R.drawable.ic_user_background_first); 107 | 108 | // Creating items navigation 109 | mHelpLiveo = new HelpLiveo(); 110 | mHelpLiveo.add(getString(R.string.inbox), R.drawable.ic_inbox_black_24dp, 7); 111 | mHelpLiveo.addSubHeader(getString(R.string.categories)); //Item subHeader 112 | mHelpLiveo.add(getString(R.string.starred), R.drawable.ic_star_black_24dp); 113 | mHelpLiveo.add(getString(R.string.sent_mail), R.drawable.ic_send_black_24dp); 114 | mHelpLiveo.add(getString(R.string.drafts), R.drawable.ic_drafts_black_24dp); 115 | mHelpLiveo.addSeparator(); // Item separator 116 | mHelpLiveo.add(getString(R.string.trash), R.drawable.ic_delete_black_24dp); 117 | mHelpLiveo.add(getString(R.string.spam), R.drawable.ic_report_black_24dp, 120); 118 | 119 | //with(this, Navigation.THEME_DARK). add theme dark 120 | //with(this, Navigation.THEME_LIGHT). add theme light 121 | 122 | with(this) // default theme is dark 123 | .startingPosition(2) //Starting position in the list 124 | .addAllHelpItem(mHelpLiveo.getHelp()) 125 | .footerItem(R.string.settings, R.drawable.ic_settings_black_24dp) 126 | .setOnClickUser(onClickPhoto) 127 | .setOnPrepareOptionsMenu(onPrepare) 128 | .setOnClickFooter(onClickFooter) 129 | .build(); 130 | } 131 | ```` 132 | 133 |
In the method "onItemClick" you can get the position of the clicked item and the layout that you must inform the replace is the library R.id.container.
134 | 135 | ```java 136 | @Override //The "R.id.container" should be used in "beginTransaction (). Replace" 137 | public void onItemClick(int position) { 138 | FragmentManager mFragmentManager = getSupportFragmentManager(); 139 | Fragment mFragment = new FragmentMain().newInstance(mHelpLiveo.get(position).getName()); 140 | 141 | if (mFragment != null){ 142 | mFragmentManager.beginTransaction().replace(R.id.container, mFragment).commit(); 143 | } 144 | } 145 | ```` 146 | 147 | User OnPrepareOptionsMenu onClick - Inform the listener in .setOnPrepareOptionsMenu(onPrepare) method in onInit ();
148 | ```java 149 | private OnPrepareOptionsMenuLiveo onPrepare = new OnPrepareOptionsMenuLiveo() { 150 | @Override 151 | public void onPrepareOptionsMenu(Menu menu, int position, boolean visible) { 152 | } 153 | }; 154 | ``` 155 | 156 | User photo onClick - Inform the listener in .setOnClickUser(onClickPhoto) method in onInit ();
157 | ```java 158 | private View.OnClickListener onClickPhoto = new View.OnClickListener() { 159 | @Override 160 | public void onClick(View v) { 161 | closeDrawer(); 162 | } 163 | }; 164 | 165 | ``` 166 | Footer onClick - Inform the listener in .setOnClickFooter(onClickFooter) method in onInit ();
167 | ```java 168 | private View.OnClickListener onClickFooter = new View.OnClickListener() { 169 | @Override 170 | public void onClick(View v) { 171 | closeDrawer(); 172 | } 173 | }; 174 | ``` 175 | 176 | 177 | 178 | 179 | ###NavigationActionBarLiveo
180 | To use extends the NavigationActionBarLiveo
181 | 182 | 183 | To remove the header, use the method ".removeHeader()"
184 | 185 | 186 |
187 | Your application uses this library? You can promote it here! Just send your application that will be happy to disclose..
188 | 189 | #Developed By
190 | Name: Rudson Lima
191 | E-mail: rudsonlive@gmail.com
192 | Subject: Navigation Drawer - Material Design 193 |
194 | 195 | When using the design please remove all images and strings referring to Live-O. Thank you: D
196 | 197 | #License 198 | ``` 199 | Copyright 2015 Rudson Lima 200 | 201 | Licensed under the Apache License, Version 2.0 (the "License"); 202 | you may not use this file except in compliance with the License. 203 | You may obtain a copy of the License at 204 | 205 | http://www.apache.org/licenses/LICENSE-2.0 206 | 207 | Unless required by applicable law or agreed to in writing, software 208 | distributed under the License is distributed on an "AS IS" BASIS, 209 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 210 | See the License for the specific language governing permissions and 211 | limitations under the License. 212 | 213 | ```` 214 | 215 |
216 | reference: 217 | NavigationDrawer 218 | -------------------------------------------------------------------------------- /README_v1.0.5.md: -------------------------------------------------------------------------------- 1 | #Navigation drawer (library) 2 | 3 | It requires 14+ API and android support v7 22.1.0 (AppCompatActivity + Toolbar) 4 | 5 | ###Sample Application 6 | 7 | 8 | Android app on Google Play 10 | 11 | 12 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-NavigationDrawer--MaterialDesign-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1398) 13 | 14 | How to use? Very simple! : D 15 | 16 | #If you want, check versions before 17 | 18 | Change Log
19 | Log file 20 | 21 | #How to add to your project 22 | 23 | ###Gradle 24 | 25 | ```groovy 26 | dependencies { 27 | compile 'br.com.liveo:navigationdrawer-material:1.0.5' 28 | } 29 | ``` 30 | ###Maven 31 | 32 | ```groovy 33 | 34 | br.com.liveo 35 | navigationdrawer-material 36 | 1.0.5 37 | aar 38 | 39 | ``` 40 | 41 | In your styles.xml choose your version: 42 | 43 | 44 | ```groovy 45 | 51 | ```` 52 | 53 | ```groovy 54 | 60 | ``` 61 | Also there is nLiveo.Theme.Light theme
62 | 63 | Available colors 64 | 65 | note: colorPrimaryDark property theme "nLiveoDrawer" should receive a color with alpha eg # 80RRGGBB - The "# 80" will ensure the transparency of statusBar. 66 | 67 | Remember to set your theme in your AndroidManifest.xml: 68 | 69 | ```groovy 70 | 72 | android:theme="@style/myTheme" > 73 | ``` 74 | ```groovy 75 | 77 | android:name=".MainActivity" 78 | android:theme="@style/nLiveoDrawer" 79 | 80 | 81 | ```` 82 | 83 | #In your Activity... 84 | 85 | Create a class and it extends the NavigationLiveo and implement the NavigationLiveoListener. 86 | 87 | Ex: public class MainActivity extends NavigationLiveo implements NavigationLiveoListener { 88 | 89 | In the method "onUserInformation" report user data logged 90 | 91 | ```groovy 92 | @Override 93 | public void onUserInformation() { 94 | //User information here 95 | this.mUserName.setText("Rudson Lima"); 96 | this.mUserEmail.setText("rudsonlive@gmail.com"); 97 | this.mUserPhoto.setImageResource(R.drawable.ic_rudsonlive); 98 | this.mUserBackground.setImageResource(R.drawable.ic_user_background); 99 | 100 | 101 | 102 | View mCustomHeader = getLayoutInflater().inflate(R.layout.custom_header_user, this.getListView(), false); 103 | ImageView imageView = (ImageView) mCustomHeader.findViewById(R.id.imageView); 104 | this.addCustomHeader(mCustomHeader); //This will add the new header and remove the default user header 105 | } 106 | ```` 107 | 108 | ###Do not use the method "onCreate" and "setContentView" of your Activity, you will use the method "onInt" 109 | 110 | In the method "onInt" inform the items on your list 111 | 112 | ```groovy 113 | @Override 114 | public void onInt(Bundle savedInstanceState) { 115 | //Creation of the list items is here 116 | 117 | // set listener {required} 118 | this.setNavigationListener(this); 119 | 120 | // name of the list items 121 | List mListNameItem = new ArrayList<>(); 122 | mListNameItem.add(0, getString(R.string.inbox)); 123 | mListNameItem.add(1, getString(R.string.starred)); 124 | mListNameItem.add(2, getString(R.string.sent_mail)); 125 | mListNameItem.add(3, getString(R.string.drafts)); 126 | mListNameItem.add(4, getString(R.string.more_markers)); //This item will be a subHeader 127 | mListNameItem.add(5, getString(R.string.trash)); 128 | mListNameItem.add(6, getString(R.string.spam)); 129 | 130 | // icons list items 131 | List mListIconItem = new ArrayList<>(); 132 | mListIconItem.add(0, R.drawable.ic_inbox_black_24dp); 133 | mListIconItem.add(1, 0); //Item no icon set 0 134 | mListIconItem.add(2, 0); //Item no icon set 0 135 | mListIconItem.add(3, R.drawable.ic_drafts_black_24dp); 136 | mListIconItem.add(4, 0); //When the item is a subHeader the value of the icon 0 137 | mListIconItem.add(5, R.drawable.ic_delete_black_24dp); 138 | mListIconItem.add(6, R.drawable.ic_report_black_24dp); 139 | 140 | //{optional} - Among the names there is some subheader, you must indicate it here 141 | List mListHeaderItem = new ArrayList<>(); 142 | mListHeaderItem.add(4); 143 | 144 | //{optional} - Among the names there is any item counter, you must indicate it (position) and the value here 145 | SparseIntArray mSparseCounterItem = new SparseIntArray(); //indicate all items that have a counter 146 | mSparseCounterItem.put(0, 7); 147 | mSparseCounterItem.put(6, 250); 148 | 149 | //If not please use the FooterDrawer use the setFooterVisible(boolean visible) method with value false 150 | this.setFooterInformationDrawer(R.string.settings, R.drawable.ic_settings_black_24dp); 151 | 152 | this.setNavigationAdapter(mListNameItem, mListIconItem, mListHeaderItem, mSparseCounterItem); 153 | } 154 | ```` 155 | 156 | updated - Other methods
157 | 158 |
In the method "onItemClickNavigation" you can get the position of the clicked item and the layout that you must inform the replace fragment
159 | 160 | ```groovy 161 | @Override //The "layoutContainerId" should be used in "beginTransaction (). Replace" 162 | public void onItemClickNavigation(int position, int layoutContainerId) { 163 | 164 | FragmentManager mFragmentManager = getSupportFragmentManager(); 165 | Fragment mFragment = new FragmentMain().newInstance(mListNameItem.get(position)); 166 | 167 | if (mFragment != null){ 168 | mFragmentManager.beginTransaction().replace(layoutContainerId, mFragment).commit(); 169 | } 170 | } 171 | ```` 172 | 173 | It has the same functionality as public boolean onPrepareOptionsMenu(Menu menu) and the example was used to hide the fragment menus.
174 | 175 | ```groovy 176 | @Override 177 | public void onPrepareOptionsMenuNavigation(Menu menu, int position, boolean visible) { 178 | 179 | //hide the menu when the navigation is opens 180 | switch (position) { 181 | case 0: 182 | menu.findItem(R.id.menu_add).setVisible(!visible); 183 | menu.findItem(R.id.menu_search).setVisible(!visible); 184 | break; 185 | 186 | case 1: 187 | menu.findItem(R.id.menu_add).setVisible(!visible); 188 | menu.findItem(R.id.menu_search).setVisible(!visible); 189 | break; 190 | } 191 | } 192 | ``` 193 | 194 | User photo onClick
195 | ```groovy 196 | @Override 197 | public void onClickUserPhotoNavigation(View v) {} 198 | ``` 199 | Footer onClick
200 | ```groovy 201 | @Override 202 | public void onClickFooterItemNavigation(View v) {} 203 | ``` 204 | 205 | 206 | 207 | 208 | 209 | Your app uses this library? You can promote it here! Just send your app that'll be happy to disclose.
210 | 211 |
212 | #Developed By
213 | Name: Rudson Lima
214 | E-mail: rudsonlive@gmail.com
215 | Subject: Navigation Drawer - Material Design 216 |
217 | 218 | When using the design please remove all images and strings referring to Live-O. Thank you: D
219 | 220 | #License 221 | ``` 222 | Copyright 2015 Rudson Lima 223 | 224 | Licensed under the Apache License, Version 2.0 (the "License"); 225 | you may not use this file except in compliance with the License. 226 | You may obtain a copy of the License at 227 | 228 | http://www.apache.org/licenses/LICENSE-2.0 229 | 230 | Unless required by applicable law or agreed to in writing, software 231 | distributed under the License is distributed on an "AS IS" BASIS, 232 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 233 | See the License for the specific language governing permissions and 234 | limitations under the License. 235 | 236 | ```` 237 | 238 |
239 | reference: 240 | NavigationDrawer 241 | -------------------------------------------------------------------------------- /Screenshot/Screenshot_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/Screenshot/Screenshot_01.png -------------------------------------------------------------------------------- /Screenshot/Screenshot_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/Screenshot/Screenshot_02.png -------------------------------------------------------------------------------- /Screenshot/Screenshot_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/Screenshot/Screenshot_03.png -------------------------------------------------------------------------------- /Screenshot/Screenshot_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/Screenshot/Screenshot_04.png -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.5.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | */build/ 15 | build/ 16 | gradle/ 17 | 18 | # Local configuration file (sdk path, etc) 19 | local.properties 20 | 21 | # IntelliJ / Android Studio 22 | .idea/ 23 | *.iml 24 | 25 | # Gradle 26 | .gradle/ 27 | gradle.properties 28 | 29 | # Eclipse project files 30 | .classpath 31 | .project 32 | 33 | # DSStore 34 | .DS_Store 35 | /release.keystore 36 | /release.properties -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "br.liveo.ndrawer" 9 | minSdkVersion 14 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile project(':library') 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | } 26 | -------------------------------------------------------------------------------- /demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Rudsonlive/DevLiveo/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /demo/src/androidTest/java/br/liveo/ndrawer/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package br.liveo.ndrawer; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /demo/src/main/java/br/liveo/ndrawer/adapter/TabPagerItem.java: -------------------------------------------------------------------------------- 1 | package br.liveo.ndrawer.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | 5 | public class TabPagerItem { 6 | 7 | private final CharSequence mTitle; 8 | private final Fragment mFragment; 9 | 10 | public TabPagerItem(CharSequence title, Fragment fragment) { 11 | this.mTitle = title; 12 | this.mFragment = fragment; 13 | } 14 | 15 | public Fragment getFragment() { 16 | return mFragment; 17 | } 18 | 19 | public CharSequence getTitle() { 20 | return mTitle; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /demo/src/main/java/br/liveo/ndrawer/adapter/ViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package br.liveo.ndrawer.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | public class ViewPagerAdapter extends FragmentPagerAdapter { 10 | 11 | private List mTabs; 12 | public ViewPagerAdapter(FragmentManager fragmentManager, List tabs) { 13 | super(fragmentManager); 14 | this.mTabs = tabs; 15 | } 16 | 17 | public void setDatasource(List datasource){ 18 | mTabs = datasource; 19 | notifyDataSetChanged(); 20 | } 21 | 22 | @Override 23 | public Fragment getItem(int i) { 24 | return mTabs.get(i).getFragment(); 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | return mTabs.size(); 30 | } 31 | 32 | @Override 33 | public CharSequence getPageTitle(int position) { 34 | return mTabs.get(position).getTitle(); 35 | } 36 | } -------------------------------------------------------------------------------- /demo/src/main/java/br/liveo/ndrawer/ui/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package br.liveo.ndrawer.ui.activity; 17 | 18 | import android.content.Intent; 19 | import android.os.Bundle; 20 | import android.support.v4.app.Fragment; 21 | import android.support.v4.app.FragmentManager; 22 | import android.view.Menu; 23 | import android.view.View; 24 | import android.widget.Toast; 25 | 26 | import br.liveo.interfaces.OnItemClickListener; 27 | import br.liveo.interfaces.OnPrepareOptionsMenuLiveo; 28 | import br.liveo.model.HelpLiveo; 29 | import br.liveo.navigationliveo.NavigationLiveo; 30 | import br.liveo.ndrawer.R; 31 | import br.liveo.ndrawer.ui.fragment.MainFragment; 32 | import br.liveo.ndrawer.ui.fragment.ViewPagerFragment; 33 | 34 | public class MainActivity extends NavigationLiveo implements OnItemClickListener { 35 | 36 | private HelpLiveo mHelpLiveo; 37 | 38 | @Override 39 | public void onInt(Bundle savedInstanceState) { 40 | 41 | // User Information 42 | this.userName.setText("Rudson Lima"); 43 | this.userEmail.setText("rudsonlive@gmail.com"); 44 | this.userPhoto.setImageResource(R.drawable.ic_rudsonlive); 45 | this.userBackground.setImageResource(R.drawable.ic_user_background_first); 46 | 47 | // Creating items navigation 48 | mHelpLiveo = new HelpLiveo(); 49 | mHelpLiveo.add(getString(R.string.inbox), R.drawable.ic_inbox_black_24dp, 7); 50 | mHelpLiveo.addSubHeader(getString(R.string.categories)); //Item subHeader 51 | mHelpLiveo.add(getString(R.string.starred), R.drawable.ic_star_black_24dp); 52 | mHelpLiveo.add(getString(R.string.sent_mail), R.drawable.ic_send_black_24dp); 53 | mHelpLiveo.addNoCheck(getString(R.string.drafts), R.drawable.ic_drafts_black_24dp); 54 | mHelpLiveo.addSeparator(); //Item separator 55 | mHelpLiveo.add(getString(R.string.trash), R.drawable.ic_delete_black_24dp); 56 | mHelpLiveo.add(getString(R.string.spam), R.drawable.ic_report_black_24dp, 120); 57 | 58 | //{optional} - Header Customization - method customHeader 59 | //View mCustomHeader = getLayoutInflater().inflate(R.layout.custom_header_user, this.getListView(), false); 60 | //ImageView imageView = (ImageView) mCustomHeader.findViewById(R.id.imageView); 61 | 62 | with(this).startingPosition(2) //Starting position in the list 63 | .addAllHelpItem(mHelpLiveo.getHelp()) 64 | //{optional} - List Customization "If you remove these methods and the list will take his white standard color" 65 | //.selectorCheck(R.drawable.selector_check) //Inform the background of the selected item color 66 | //.colorItemDefault(R.color.nliveo_blue_colorPrimary) //Inform the standard color name, icon and counter 67 | .colorItemSelected(R.color.nliveo_blue_colorPrimary) //State the name of the color, icon and meter when it is selected 68 | //.backgroundList(R.color.nliveo_black_light) //Inform the list of background color 69 | //.colorLineSeparator(R.color.nliveo_transparent) //Inform the color of the subheader line 70 | 71 | //{optional} - SubHeader Customization 72 | //.colorNameSubHeader(R.color.nliveo_blue_colorPrimary) 73 | //.colorLineSeparator(R.color.nliveo_green_colorPrimaryDark) 74 | 75 | //.removeFooter() 76 | .footerItem(R.string.settings, R.drawable.ic_settings_black_24dp) 77 | 78 | //{optional} - Second footer 79 | //.footerSecondItem(R.string.settings, R.drawable.ic_settings_black_24dp) 80 | 81 | //{optional} - Header Customization 82 | //.customHeader(mCustomHeader) 83 | 84 | //{optional} - Footer Customization 85 | //.footerNameColor(R.color.nliveo_blue_colorPrimary) 86 | //.footerIconColor(R.color.nliveo_blue_colorPrimary) 87 | 88 | //.footerSecondNameColor(R.color.nliveo_blue_colorPrimary) 89 | //.footerSecondIconColor(R.color.nliveo_blue_colorPrimary) 90 | 91 | //.footerBackground(R.color.nliveo_white) 92 | 93 | //{optional} - Remove color filter icon 94 | //.removeColorFilter() 95 | 96 | .setOnClickUser(onClickPhoto) 97 | .setOnPrepareOptionsMenu(onPrepare) 98 | .setOnClickFooter(onClickFooter) 99 | 100 | //{optional} - Second footer 101 | //.setOnClickFooterSecond(onClickFooter) 102 | .build(); 103 | 104 | int position = this.getCurrentPosition(); 105 | this.setElevationToolBar(position != 2 ? 15 : 0); 106 | } 107 | 108 | @Override 109 | public void onItemClick(int position) { 110 | Fragment mFragment; 111 | FragmentManager mFragmentManager = getSupportFragmentManager(); 112 | 113 | switch (position){ 114 | case 2: 115 | mFragment = new ViewPagerFragment(); 116 | break; 117 | 118 | default: 119 | mFragment = MainFragment.newInstance(mHelpLiveo.get(position).getName()); 120 | break; 121 | } 122 | 123 | if (mFragment != null){ 124 | mFragmentManager.beginTransaction().replace(R.id.container, mFragment).commit(); 125 | } 126 | 127 | setElevationToolBar(position != 2 ? 15 : 0); 128 | } 129 | 130 | private OnPrepareOptionsMenuLiveo onPrepare = new OnPrepareOptionsMenuLiveo() { 131 | @Override 132 | public void onPrepareOptionsMenu(Menu menu, int position, boolean visible) { 133 | } 134 | }; 135 | 136 | private View.OnClickListener onClickPhoto = new View.OnClickListener() { 137 | @Override 138 | public void onClick(View v) { 139 | Toast.makeText(getApplicationContext(), "onClickPhoto :D", Toast.LENGTH_SHORT).show(); 140 | closeDrawer(); 141 | } 142 | }; 143 | 144 | private View.OnClickListener onClickFooter = new View.OnClickListener() { 145 | @Override 146 | public void onClick(View v) { 147 | startActivity(new Intent(getApplicationContext(), SettingsActivity.class)); 148 | closeDrawer(); 149 | } 150 | }; 151 | } 152 | 153 | -------------------------------------------------------------------------------- /demo/src/main/java/br/liveo/ndrawer/ui/activity/SettingsActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package br.liveo.ndrawer.ui.activity; 17 | 18 | import android.os.Bundle; 19 | import android.support.v7.app.ActionBar; 20 | import android.support.v7.app.AppCompatActivity; 21 | import android.view.MenuItem; 22 | import android.widget.TextView; 23 | 24 | import br.liveo.ndrawer.R; 25 | 26 | public class SettingsActivity extends AppCompatActivity { 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.fragment_main); 32 | 33 | TextView mTxtTitle = (TextView) findViewById(R.id.txtTitle); 34 | mTxtTitle.setText(getString(R.string.settings)); 35 | 36 | ActionBar actionBar = getSupportActionBar(); 37 | 38 | if (actionBar != null){ 39 | actionBar.setDisplayHomeAsUpEnabled(true); 40 | actionBar.setHomeButtonEnabled(true); 41 | } 42 | } 43 | 44 | @Override 45 | public boolean onOptionsItemSelected(MenuItem item) { 46 | switch (item.getItemId()) { 47 | case android.R.id.home: 48 | finish(); 49 | return true; 50 | } 51 | return super.onOptionsItemSelected(item); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /demo/src/main/java/br/liveo/ndrawer/ui/fragment/MainFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package br.liveo.ndrawer.ui.fragment; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.support.v7.widget.SearchView; 21 | import android.view.LayoutInflater; 22 | import android.view.Menu; 23 | import android.view.MenuInflater; 24 | import android.view.MenuItem; 25 | import android.view.View; 26 | import android.view.ViewGroup; 27 | import android.view.ViewGroup.LayoutParams; 28 | import android.widget.EditText; 29 | import android.widget.TextView; 30 | import android.widget.Toast; 31 | 32 | import br.liveo.ndrawer.R; 33 | 34 | public class MainFragment extends Fragment { 35 | 36 | private boolean mSearchCheck; 37 | private static final String TEXT_FRAGMENT = "TEXT_FRAGMENT"; 38 | 39 | public static MainFragment newInstance(String text){ 40 | MainFragment mFragment = new MainFragment(); 41 | Bundle mBundle = new Bundle(); 42 | mBundle.putString(TEXT_FRAGMENT, text); 43 | mFragment.setArguments(mBundle); 44 | return mFragment; 45 | } 46 | 47 | @Override 48 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 49 | Bundle savedInstanceState) { 50 | // TODO Auto-generated method stub 51 | View rootView = inflater.inflate(R.layout.fragment_main, container, false); 52 | 53 | TextView mTxtTitle = (TextView) rootView.findViewById(R.id.txtTitle); 54 | mTxtTitle.setText(getArguments().getString(TEXT_FRAGMENT)); 55 | 56 | rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT )); 57 | return rootView; 58 | } 59 | 60 | @Override 61 | public void onActivityCreated(Bundle savedInstanceState) { 62 | // TODO Auto-generated method stub 63 | super.onActivityCreated(savedInstanceState); 64 | setHasOptionsMenu(true); 65 | } 66 | 67 | @Override 68 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 69 | // TODO Auto-generated method stub 70 | super.onCreateOptionsMenu(menu, inflater); 71 | inflater.inflate(R.menu.menu, menu); 72 | 73 | //Select search item 74 | final MenuItem menuItem = menu.findItem(R.id.menu_search); 75 | menuItem.setVisible(true); 76 | 77 | SearchView searchView = (SearchView) menuItem.getActionView(); 78 | searchView.setQueryHint(this.getString(R.string.search)); 79 | 80 | ((EditText) searchView.findViewById(R.id.search_src_text)) 81 | .setHintTextColor(getResources().getColor(R.color.nliveo_white)); 82 | searchView.setOnQueryTextListener(onQuerySearchView); 83 | 84 | menu.findItem(R.id.menu_add).setVisible(true); 85 | 86 | mSearchCheck = false; 87 | } 88 | 89 | @Override 90 | public boolean onOptionsItemSelected(MenuItem item) { 91 | // TODO Auto-generated method stub 92 | 93 | switch (item.getItemId()) { 94 | 95 | case R.id.menu_add: 96 | Toast.makeText(getActivity(), R.string.add, Toast.LENGTH_SHORT).show(); 97 | break; 98 | 99 | case R.id.menu_search: 100 | mSearchCheck = true; 101 | Toast.makeText(getActivity(), R.string.search, Toast.LENGTH_SHORT).show(); 102 | break; 103 | } 104 | return true; 105 | } 106 | 107 | private SearchView.OnQueryTextListener onQuerySearchView = new SearchView.OnQueryTextListener() { 108 | @Override 109 | public boolean onQueryTextSubmit(String s) { 110 | return false; 111 | } 112 | 113 | @Override 114 | public boolean onQueryTextChange(String s) { 115 | if (mSearchCheck){ 116 | // implement your search here 117 | } 118 | return false; 119 | } 120 | }; 121 | } 122 | -------------------------------------------------------------------------------- /demo/src/main/java/br/liveo/ndrawer/ui/fragment/ViewPagerFragment.java: -------------------------------------------------------------------------------- 1 | package br.liveo.ndrawer.ui.fragment; 2 | 3 | import android.os.Build; 4 | import android.os.Bundle; 5 | import android.support.design.widget.TabLayout; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.view.ViewPager; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | import br.liveo.ndrawer.R; 16 | import br.liveo.ndrawer.adapter.TabPagerItem; 17 | import br.liveo.ndrawer.adapter.ViewPagerAdapter; 18 | 19 | public class ViewPagerFragment extends Fragment { 20 | private List mTabs = new ArrayList<>(); 21 | 22 | @Override 23 | public void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | createTabPagerItem(); 26 | } 27 | 28 | private void createTabPagerItem(){ 29 | mTabs.add(new TabPagerItem(getString(R.string.starred), MainFragment.newInstance(getString(R.string.starred)))); 30 | mTabs.add(new TabPagerItem(getString(R.string.important), MainFragment.newInstance(getString(R.string.important)))); 31 | mTabs.add(new TabPagerItem(getString(R.string.documents), MainFragment.newInstance(getString(R.string.documents)))); 32 | } 33 | 34 | @Override 35 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 36 | Bundle savedInstanceState) { 37 | View rootView = inflater.inflate(R.layout.fragment_viewpager, container, false); 38 | rootView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT )); 39 | return rootView; 40 | } 41 | 42 | @Override 43 | public void onViewCreated(View view, Bundle savedInstanceState) { 44 | ViewPager mViewPager = (ViewPager) view.findViewById(R.id.viewPager); 45 | 46 | mViewPager.setOffscreenPageLimit(mTabs.size()); 47 | mViewPager.setAdapter(new ViewPagerAdapter(getChildFragmentManager(), mTabs)); 48 | TabLayout mSlidingTabLayout = (TabLayout) view.findViewById(R.id.tabLayout); 49 | 50 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 51 | mSlidingTabLayout.setElevation(15); 52 | } 53 | mSlidingTabLayout.setupWithViewPager(mViewPager); 54 | } 55 | } -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_delete_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_delete_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_drafts_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_drafts_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_inbox_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_inbox_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_liveo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_liveo.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_no_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_no_user.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_report_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_report_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_send_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_send_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_star_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-hdpi/ic_star_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_delete_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_delete_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_drafts_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_drafts_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_inbox_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_inbox_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_liveo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_liveo.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_no_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_no_user.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_report_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_report_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_send_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_send_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_star_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-mdpi/ic_star_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_delete_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_delete_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_drafts_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_drafts_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_inbox_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_inbox_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_liveo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_liveo.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_no_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_no_user.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_report_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_report_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_send_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_send_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_star_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xhdpi/ic_star_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_delete_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_delete_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_drafts_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_drafts_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_inbox_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_inbox_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_no_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_no_user.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_report_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_report_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_send_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_send_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_star_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxhdpi/ic_star_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_drafts_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_drafts_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_inbox_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_inbox_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_no_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_no_user.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_report_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_report_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_send_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_send_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi/ic_star_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable-xxxhdpi/ic_star_black_24dp.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable/ic_user_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/drawable/ic_user_background.jpg -------------------------------------------------------------------------------- /demo/src/main/res/drawable/selector_check.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 22 | 24 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/custom_header_user.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 31 | 32 | 43 | 44 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 30 | 31 | 41 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/fragment_viewpager.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | 21 | 22 | 27 | -------------------------------------------------------------------------------- /demo/src/main/res/menu/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 26 | 31 | 32 | -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/mipmap-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | nDrawer 5 | 6 | Sign in 7 | 8 | Inbox 9 | Favorito 10 | Mensajes Enviados 11 | Borradores 12 | Categorías 13 | Papelera 14 | Spam 15 | Configuración 16 | 17 | Agregar 18 | Buscar 19 | 20 | Importante 21 | Documentos 22 | 23 | 24 | Abrir perfil de usuario 25 | Abrir configuración 26 | 27 | -------------------------------------------------------------------------------- /demo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 16dp 20 | 16dp 21 | 22 | -------------------------------------------------------------------------------- /demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | nDrawer 20 | 21 | Sign in 22 | 23 | Inbox 24 | Starred 25 | Sent Mail 26 | Drafts 27 | Categories 28 | Trash 29 | Spam 30 | Settings 31 | 32 | Add 33 | Search 34 | 35 | Important 36 | Documents 37 | 38 | 39 | Open user profile 40 | Open settings 41 | 42 | 43 | -------------------------------------------------------------------------------- /demo/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | */build/ 15 | build/ 16 | gradle/ 17 | 18 | # Local configuration file (sdk path, etc) 19 | local.properties 20 | 21 | # IntelliJ / Android Studio 22 | .idea/ 23 | *.iml 24 | 25 | # Gradle 26 | .gradle/ 27 | */gradle.properties 28 | gradle.properties 29 | 30 | # Eclipse project files 31 | .classpath 32 | .project 33 | 34 | # DSStore 35 | .DS_Store 36 | /release.keystore 37 | /release.properties -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion 23 21 | buildToolsVersion "23.0.2" 22 | 23 | defaultConfig { 24 | minSdkVersion 14 25 | targetSdkVersion 23 26 | versionCode 1 27 | versionName "v0.1L" 28 | } 29 | buildTypes { 30 | release { 31 | minifyEnabled false 32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 33 | } 34 | } 35 | } 36 | 37 | dependencies { 38 | compile fileTree(dir: 'libs', include: ['*.jar']) 39 | compile 'com.balysv:material-ripple:1.0.2' 40 | compile 'com.android.support:design:23.2.1' 41 | compile 'com.android.support:support-v4:23.2.1' 42 | compile 'com.android.support:appcompat-v7:23.2.1' 43 | } 44 | 45 | apply plugin: 'maven' 46 | 47 | uploadArchives { 48 | repositories { 49 | mavenDeployer { 50 | repository(url: "https://oss.sonatype.org/content/repositories/snapshots") 51 | pom.groupId = GROUP 52 | pom.artifactId = POM_ARTIFACT_ID 53 | pom.version = VERSION_NAME 54 | } 55 | } 56 | } 57 | 58 | task install(dependsOn: uploadArchives) 59 | apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Rudsonlive/DevLiveo/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /library/src/androidTest/java/br/liveo/navigationliveo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package br.liveo.navigationliveo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /library/src/main/assets/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/library/src/main/assets/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /library/src/main/assets/fonts/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/library/src/main/assets/fonts/Roboto-Regular.ttf -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/Model/HelpItem.java: -------------------------------------------------------------------------------- 1 | package br.liveo.model; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | /** 7 | * Created by Rudsonlive on 26/05/15. 8 | */ 9 | public class HelpItem implements Parcelable { 10 | 11 | private String name; 12 | private int icon = 0; 13 | private int counter = 0; 14 | 15 | private boolean hide = false; 16 | private boolean check = true; 17 | private boolean header = false; 18 | 19 | @Override 20 | public int describeContents() { 21 | return 0; 22 | } 23 | 24 | @Override 25 | public void writeToParcel(Parcel dest, int flags) { 26 | dest.writeString(this.getName()); 27 | dest.writeInt(this.getIcon()); 28 | dest.writeInt(this.getCounter()); 29 | dest.writeByte(isHide() ? (byte) 1 : (byte) 0); 30 | dest.writeByte(isCheck() ? (byte) 1 : (byte) 0); 31 | dest.writeByte(isHeader() ? (byte) 1 : (byte) 0); 32 | } 33 | 34 | public HelpItem() { 35 | } 36 | 37 | protected HelpItem(Parcel in) { 38 | this.setName(in.readString()); 39 | this.setIcon(in.readInt()); 40 | this.setCounter(in.readInt()); 41 | this.setHide(in.readByte() != 0); 42 | this.setCheck(in.readByte() != 0); 43 | this.setHeader(in.readByte() != 0); 44 | } 45 | 46 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { 47 | public HelpItem createFromParcel(Parcel source) { 48 | return new HelpItem(source); 49 | } 50 | 51 | public HelpItem[] newArray(int size) { 52 | return new HelpItem[size]; 53 | } 54 | }; 55 | 56 | public String getName() { 57 | return name; 58 | } 59 | 60 | public void setName(String name) { 61 | this.name = name; 62 | } 63 | 64 | public int getIcon() { 65 | return icon; 66 | } 67 | 68 | public void setIcon(int icon) { 69 | this.icon = icon; 70 | } 71 | 72 | public int getCounter() { 73 | return counter; 74 | } 75 | 76 | public void setCounter(int counter) { 77 | this.counter = counter; 78 | } 79 | 80 | public boolean isHide() { 81 | return hide; 82 | } 83 | 84 | public void setHide(boolean hide) { 85 | this.hide = hide; 86 | } 87 | 88 | public boolean isCheck() { 89 | return check; 90 | } 91 | 92 | public void setCheck(boolean check) { 93 | this.check = check; 94 | } 95 | 96 | public boolean isHeader() { 97 | return header; 98 | } 99 | 100 | public void setHeader(boolean header) { 101 | this.header = header; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/Model/HelpLiveo.java: -------------------------------------------------------------------------------- 1 | package br.liveo.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by Rudsonlive on 26/05/15. 8 | */ 9 | public class HelpLiveo { 10 | 11 | private HelpItem helpItem; 12 | private List listHelp; 13 | 14 | public final int NO_ICON = 0; 15 | public final boolean IS_HIDE = true; 16 | public final boolean IS_CHECK = true; 17 | public final boolean IS_HEADER = true; 18 | public final String ONLY_SEPARATOR = ""; 19 | 20 | public HelpLiveo(){ 21 | this.listHelp = new ArrayList<>(); 22 | } 23 | 24 | private void newHelpItem(){ 25 | this.helpItem = new HelpItem(); 26 | } 27 | 28 | public void add(String name){ 29 | this.newHelpItem(); 30 | this.helpItem.setName(name); 31 | this.helpItem.setCheck(IS_CHECK); 32 | this.listHelp.add(helpItem); 33 | } 34 | 35 | public void addNoCheck(String name){ 36 | this.newHelpItem(); 37 | this.helpItem.setName(name); 38 | this.helpItem.setCheck(false); 39 | this.listHelp.add(helpItem); 40 | } 41 | 42 | public void addHide(String name){ 43 | this.newHelpItem(); 44 | this.helpItem.setName(name); 45 | this.helpItem.setHide(IS_HIDE); 46 | this.helpItem.setCheck(IS_CHECK); 47 | this.listHelp.add(helpItem); 48 | } 49 | 50 | public void addHideNoCheck(String name){ 51 | this.newHelpItem(); 52 | this.helpItem.setName(name); 53 | this.helpItem.setHide(IS_HIDE); 54 | this.helpItem.setCheck(false); 55 | this.listHelp.add(helpItem); 56 | } 57 | 58 | public void add(String name, int icon){ 59 | this.newHelpItem(); 60 | this.helpItem.setName(name); 61 | this.helpItem.setIcon(icon); 62 | this.helpItem.setCheck(IS_CHECK); 63 | this.listHelp.add(helpItem); 64 | } 65 | 66 | public void addNoCheck(String name, int icon){ 67 | this.newHelpItem(); 68 | this.helpItem.setName(name); 69 | this.helpItem.setIcon(icon); 70 | this.helpItem.setCheck(false); 71 | this.listHelp.add(helpItem); 72 | } 73 | 74 | public void addHide(String name, int icon){ 75 | this.newHelpItem(); 76 | this.helpItem.setName(name); 77 | this.helpItem.setIcon(icon); 78 | this.helpItem.setHide(IS_HIDE); 79 | this.helpItem.setCheck(IS_CHECK); 80 | this.listHelp.add(helpItem); 81 | } 82 | 83 | public void addHideNoCheck(String name, int icon){ 84 | this.newHelpItem(); 85 | this.helpItem.setName(name); 86 | this.helpItem.setIcon(icon); 87 | this.helpItem.setHide(IS_HIDE); 88 | this.helpItem.setCheck(false); 89 | this.listHelp.add(helpItem); 90 | } 91 | 92 | public void add(String name, int icon, int counter){ 93 | this.newHelpItem(); 94 | this.helpItem.setName(name); 95 | this.helpItem.setIcon(icon); 96 | this.helpItem.setCheck(IS_CHECK); 97 | this.helpItem.setCounter(counter); 98 | this.listHelp.add(helpItem); 99 | } 100 | 101 | public void addNoCheck(String name, int icon, int counter){ 102 | this.newHelpItem(); 103 | this.helpItem.setName(name); 104 | this.helpItem.setIcon(icon); 105 | this.helpItem.setCheck(false); 106 | this.helpItem.setCounter(counter); 107 | this.listHelp.add(helpItem); 108 | } 109 | 110 | public void addHide(String name, int icon, int counter){ 111 | this.newHelpItem(); 112 | this.helpItem.setName(name); 113 | this.helpItem.setIcon(icon); 114 | this.helpItem.setCounter(counter); 115 | this.helpItem.setHide(IS_HIDE); 116 | this.helpItem.setCheck(IS_CHECK); 117 | this.listHelp.add(helpItem); 118 | } 119 | 120 | public void addHideNoCheck(String name, int icon, int counter){ 121 | this.newHelpItem(); 122 | this.helpItem.setName(name); 123 | this.helpItem.setIcon(icon); 124 | this.helpItem.setCounter(counter); 125 | this.helpItem.setHide(IS_HIDE); 126 | this.helpItem.setCheck(false); 127 | this.listHelp.add(helpItem); 128 | } 129 | 130 | public void addSubHeader(String name){ 131 | this.newHelpItem(); 132 | this.helpItem.setName(name); 133 | this.helpItem.setIcon(NO_ICON); 134 | this.helpItem.setHeader(IS_HEADER); 135 | this.helpItem.setCheck(false); 136 | this.listHelp.add(helpItem); 137 | } 138 | 139 | public void addSubHeader(String name, int counter){ 140 | this.newHelpItem(); 141 | this.helpItem.setName(name); 142 | this.helpItem.setCounter(counter); 143 | this.helpItem.setIcon(NO_ICON); 144 | this.helpItem.setCheck(false); 145 | this.helpItem.setHeader(IS_HEADER); 146 | this.listHelp.add(helpItem); 147 | } 148 | 149 | public void addSeparator(){ 150 | this.newHelpItem(); 151 | this.helpItem.setName(ONLY_SEPARATOR); 152 | this.helpItem.setIcon(NO_ICON); 153 | this.helpItem.setHeader(IS_HEADER); 154 | this.helpItem.setCheck(false); 155 | this.listHelp.add(helpItem); 156 | } 157 | 158 | public void addSubHeaderHide(String name, int icon){ 159 | this.newHelpItem(); 160 | this.helpItem.setName(name); 161 | this.helpItem.setIcon(icon); 162 | this.helpItem.setHeader(IS_HEADER); 163 | this.helpItem.setHide(IS_HIDE); 164 | this.helpItem.setCheck(false); 165 | this.listHelp.add(helpItem); 166 | } 167 | 168 | public HelpItem get(int position){ 169 | return this.listHelp.get(position); 170 | } 171 | 172 | public List getHelp(){ 173 | return this.listHelp; 174 | } 175 | 176 | public int getCount(){ 177 | return this.listHelp.size(); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/Model/Navigation.java: -------------------------------------------------------------------------------- 1 | package br.liveo.model; 2 | 3 | import android.util.SparseIntArray; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by Rudsonlive on 25/04/15. 9 | */ 10 | public class Navigation { 11 | public List nameItem; 12 | public List iconItem; 13 | public List headerItem; 14 | public List hideItem; 15 | public SparseIntArray countItem; 16 | public int colorSelected = 0; 17 | public boolean removeSelector = false; 18 | 19 | public static final int THEME_DARK = 0; 20 | public static final int THEME_LIGHT = 1; 21 | } 22 | -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/adapter/NavigationLiveoAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package br.liveo.adapter; 18 | 19 | import android.annotation.SuppressLint; 20 | import android.content.Context; 21 | import android.support.v4.content.ContextCompat; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.BaseAdapter; 26 | import android.widget.ImageView; 27 | import android.widget.LinearLayout; 28 | import android.widget.RelativeLayout; 29 | import android.widget.TextView; 30 | 31 | import java.util.List; 32 | 33 | import br.liveo.navigationliveo.R; 34 | 35 | 36 | public class NavigationLiveoAdapter extends BaseAdapter { 37 | 38 | private int mColorIcon = 0; 39 | private int mColorName = 0; 40 | private int mColorCounter = 0; 41 | private int mColorSeparator = 0; 42 | private int mColorSubHeader = 0; 43 | 44 | private int mNewSelector = 0; 45 | private int mColorDefault = 0; 46 | private final Context mcontext; 47 | private int mSelectorDefault = 0; 48 | private boolean mRemoveAlpha = false; 49 | private boolean mRemoveColorFilter = false; 50 | private final List mList; 51 | 52 | public NavigationLiveoAdapter(Context context, List list, List extraRemove, List extra) { 53 | this.mList = list; 54 | this.mcontext = context; 55 | this.mNewSelector = extra.get(0); 56 | this.mColorDefault = extra.get(1); 57 | this.mColorIcon = extra.get(2); 58 | this.mColorName = extra.get(3); 59 | this.mColorSeparator = extra.get(4); 60 | this.mColorCounter = extra.get(5); 61 | this.mSelectorDefault = extra.get(6); 62 | this.mColorSubHeader = extra.get(7); 63 | this.mRemoveAlpha = extraRemove.get(0); 64 | this.mRemoveColorFilter = extraRemove.get(1); 65 | } 66 | 67 | @Override 68 | public int getCount() { 69 | return mList.size(); 70 | } 71 | 72 | @Override 73 | public NavigationLiveoItemAdapter getItem(int position) { 74 | return mList.get(position); 75 | } 76 | 77 | @Override 78 | public long getItemId(int position) { 79 | return position; 80 | } 81 | 82 | @Override 83 | public int getViewTypeCount() { 84 | return 2; 85 | } 86 | 87 | @Override 88 | public int getItemViewType(int position) { 89 | return mList.get(position).isVisible ? 0 : 1; 90 | } 91 | 92 | @Override 93 | public boolean isEnabled(int position) { 94 | return !getItem(position).isHeader; 95 | } 96 | 97 | public void setChecked(int pos, boolean checked) { 98 | mList.get(pos).checked = checked; 99 | notifyDataSetChanged(); 100 | } 101 | 102 | public void resetarCheck() { 103 | for (int i = 0; i < mList.size(); i++) { 104 | mList.get(i).checked = false; 105 | } 106 | this.notifyDataSetChanged(); 107 | } 108 | 109 | public void setNewName(int position, String name){ 110 | mList.get(position).title = name; 111 | notifyDataSetChanged(); 112 | } 113 | 114 | public void setNewIcon(int position, int icon){ 115 | mList.get(position).icon = icon; 116 | notifyDataSetChanged(); 117 | } 118 | 119 | public void setNewCounterValue(int position, int value){ 120 | mList.get(position).counter = value; 121 | notifyDataSetChanged(); 122 | } 123 | 124 | public void setNewInformationItem(int position, String name, int icon, int counter){ 125 | mList.get(position).title = name; 126 | mList.get(position).icon = icon; 127 | mList.get(position).counter = counter; 128 | notifyDataSetChanged(); 129 | } 130 | 131 | public void setIncreasingCounterValue(int position, int value){ 132 | mList.get(position).counter = ( mList.get(position).counter + value); 133 | notifyDataSetChanged(); 134 | } 135 | 136 | public void setDecreaseCountervalue(int position, int value){ 137 | mList.get(position).counter = ( mList.get(position).counter - value); 138 | notifyDataSetChanged(); 139 | } 140 | 141 | public void setVisibleItemNavigation(int position, boolean visible){ 142 | mList.get(position).isVisible = visible; 143 | notifyDataSetChanged(); 144 | } 145 | 146 | class ViewHolder { 147 | public TextView title; 148 | public ImageView icon; 149 | public TextView counter; 150 | 151 | public View separator; 152 | 153 | public RelativeLayout layoutDados; 154 | public LinearLayout layoutSeparator; 155 | 156 | public ViewHolder(){ 157 | } 158 | } 159 | 160 | private void setAlpha(View v, float alpha) { 161 | v.setAlpha(!mRemoveAlpha ? alpha : 1f); 162 | } 163 | 164 | @SuppressLint("ViewHolder") 165 | public View getView(int position, View convertView, ViewGroup parent) { 166 | 167 | ViewHolder holder; 168 | holder = new ViewHolder(); 169 | 170 | LayoutInflater inflater = (LayoutInflater) mcontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 171 | convertView = inflater.inflate(R.layout.navigation_list_item, parent, false); 172 | 173 | holder.title = (TextView) convertView.findViewById(R.id.title); 174 | holder.counter = (TextView) convertView.findViewById(R.id.counter); 175 | holder.icon = (ImageView) convertView.findViewById(R.id.icon); 176 | 177 | holder.separator = convertView.findViewById(R.id.separator); 178 | 179 | holder.layoutDados = (RelativeLayout) convertView.findViewById(R.id.layoutDados); 180 | holder.layoutSeparator = (LinearLayout) convertView.findViewById(R.id.layoutSeparator); 181 | 182 | convertView.setTag(holder); 183 | 184 | NavigationLiveoItemAdapter item = mList.get(position); 185 | 186 | if (holder.title != null){ 187 | holder.title.setText(item.title); 188 | 189 | if (!item.isHeader) { 190 | holder.layoutSeparator.setVisibility(View.GONE); 191 | 192 | int type = getItemViewType(position); 193 | holder.layoutDados.setVisibility(type == 0 ? View.VISIBLE : View.GONE); 194 | 195 | setAlpha(holder.title, (item.checked ? 1f : 0.87f)); 196 | }else{ 197 | holder.layoutSeparator.setVisibility(View.VISIBLE); 198 | 199 | if (mColorSeparator > 0){ 200 | holder.separator.setBackgroundResource(mColorSeparator); 201 | } 202 | 203 | if (item.title.equals("")){ 204 | holder.title.setVisibility(View.GONE); 205 | holder.layoutDados.setVisibility(View.GONE); 206 | }else{ 207 | holder.layoutDados.setVisibility(View.VISIBLE); 208 | } 209 | } 210 | 211 | holder.title.setTextColor((!item.isHeader && item.checked && item.colorSelected > 0 ? 212 | ContextCompat.getColor(mcontext, item.colorSelected) : 213 | mColorDefault != 0 ? ContextCompat.getColor(mcontext, mColorDefault) : 214 | mColorName > 0 ? ContextCompat.getColor(mcontext, mColorName) : 215 | (item.isHeader && mColorSubHeader > 0) ? ContextCompat.getColor(mcontext, mColorSubHeader) : 216 | ContextCompat.getColor(mcontext, R.color.nliveo_black))); 217 | } 218 | 219 | if (holder.counter != null) { 220 | if (item.counter >= 1) { 221 | setAlpha(holder.counter, (item.checked ? 1f : 0.87f)); 222 | holder.counter.setVisibility(View.VISIBLE); 223 | holder.counter.setText((item.counter > 99) ? "99+" : item.counter + ""); 224 | 225 | holder.counter.setTextColor((!item.isHeader && item.checked && item.colorSelected > 0 ? 226 | ContextCompat.getColor(mcontext, item.colorSelected) : 227 | mColorDefault != 0 ? ContextCompat.getColor(mcontext, mColorDefault) : 228 | mColorCounter > 0 ? 229 | ContextCompat.getColor(mcontext, mColorCounter) : 230 | ContextCompat.getColor(mcontext, R.color.nliveo_black))); 231 | 232 | } else { 233 | holder.counter.setVisibility(View.GONE); 234 | 235 | if (item.counter < 0){ 236 | setNewCounterValue(position, 0); 237 | } 238 | } 239 | } 240 | 241 | if (holder.icon != null) { 242 | if (item.icon != 0) { 243 | holder.icon.setVisibility(View.VISIBLE); 244 | holder.icon.setImageResource(item.icon); 245 | setAlpha(holder.icon, (!item.isHeader && item.checked ? 1f : 0.54f)); 246 | 247 | if (!this.mRemoveColorFilter) { 248 | holder.icon.setColorFilter((!item.isHeader && item.checked && item.colorSelected > 0 ? 249 | ContextCompat.getColor(mcontext, item.colorSelected) : 250 | (mColorDefault != 0 ? ContextCompat.getColor(mcontext, mColorDefault) : 251 | mColorIcon > 0 ? ContextCompat.getColor(mcontext, mColorIcon) : 252 | ContextCompat.getColor(mcontext, R.color.nliveo_black)))); 253 | } 254 | } else { 255 | holder.icon.setVisibility(View.GONE); 256 | } 257 | } 258 | 259 | if (!item.isHeader) { 260 | if (item.checked) { 261 | convertView.setBackgroundResource((!item.removeSelector ? ( mNewSelector == 0 ? R.drawable.selector_check_item_navigation : mNewSelector) : R.drawable.selector_no_item_navigation)); 262 | } else { 263 | convertView.setBackgroundResource(mSelectorDefault == 0 ? R.drawable.selector_no_check_item_navigation : R.drawable.selector_no_item_navigation); 264 | } 265 | }else{ 266 | convertView.setBackgroundResource(mSelectorDefault == 0 ? R.drawable.selector_no_check_item_navigation : mSelectorDefault); 267 | } 268 | 269 | return convertView; 270 | } 271 | } 272 | -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/adapter/NavigationLiveoItemAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package br.liveo.adapter; 18 | 19 | public class NavigationLiveoItemAdapter { 20 | 21 | public String title; 22 | public int counter; 23 | public int icon; 24 | public boolean isHeader; 25 | public int colorSelected = 0; 26 | public boolean isVisible = true; 27 | public boolean checked = false; 28 | public boolean removeSelector = false; 29 | 30 | public NavigationLiveoItemAdapter(String title, int icon, boolean header, int counter, int colorSelected, boolean removeSelector, boolean isVisible) { 31 | this.title = title; 32 | this.icon = icon; 33 | this.isHeader = header; 34 | this.counter = counter; 35 | this.isVisible = isVisible; 36 | this.colorSelected = colorSelected; 37 | this.removeSelector = removeSelector; 38 | } 39 | 40 | public NavigationLiveoItemAdapter(String title, int icon, boolean header, int counter) { 41 | this.title = title; 42 | this.icon = icon; 43 | this.isHeader = header; 44 | this.counter = counter; 45 | this.isVisible = true; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/interfaces/OnItemClickListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package br.liveo.interfaces; 18 | 19 | public interface OnItemClickListener { 20 | 21 | /** 22 | * Item click Navigation (ListView.OnItemClickListener) 23 | * @param position position of the item that was clicked. 24 | */ 25 | public void onItemClick(int position); 26 | } 27 | -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/interfaces/OnPrepareOptionsMenuLiveo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package br.liveo.interfaces; 18 | 19 | import android.view.Menu; 20 | 21 | /** 22 | * Created by Rudsonlive on 24/05/15. 23 | */ 24 | public interface OnPrepareOptionsMenuLiveo { 25 | /** 26 | * Prepare options menu navigation (onPrepareOptionsMenu(Menu menu)) 27 | * @param menu menu. 28 | * @param position last position of the item that was clicked. 29 | * @param visible use to hide the menu when the navigation is open. 30 | */ 31 | public void onPrepareOptionsMenu(Menu menu, int position, boolean visible); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/navigationliveo/NavigationLiveoList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package br.liveo.navigationliveo; 18 | 19 | import android.content.Context; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import br.liveo.adapter.NavigationLiveoItemAdapter; 25 | import br.liveo.model.HelpItem; 26 | import br.liveo.model.Navigation; 27 | 28 | public class NavigationLiveoList { 29 | 30 | public static List getNavigationAdapter(Context context, Navigation navigation) { 31 | 32 | List mList = new ArrayList<>(); 33 | if (navigation.nameItem == null || navigation.nameItem.size() == 0) { 34 | throw new RuntimeException(context.getString(R.string.list_null_or_empty)); 35 | } 36 | 37 | int icon; 38 | int count; 39 | boolean isHeader; 40 | 41 | for (int i = 0; i < navigation.nameItem.size(); i++) { 42 | 43 | String title = navigation.nameItem.get(i); 44 | 45 | NavigationLiveoItemAdapter mItemAdapter; 46 | 47 | icon = (navigation.iconItem != null ? navigation.iconItem.get(i) : 0); 48 | isHeader = (navigation.headerItem != null && navigation.headerItem.contains(i)); 49 | count = (navigation.countItem != null ? navigation.countItem.get(i, -1) : -1); 50 | 51 | boolean isVisible = false; 52 | if(navigation.hideItem != null){ 53 | isVisible = navigation.hideItem.contains(i); 54 | } 55 | 56 | if (isHeader && icon > 0){ 57 | throw new RuntimeException(context.getString(R.string.value_icon_should_be_0)); 58 | } 59 | 60 | if (!isHeader) { 61 | if (title == null) { 62 | throw new RuntimeException(context.getString(R.string.enter_item_name_position) + i); 63 | } 64 | 65 | if (title.trim().equals("")) { 66 | throw new RuntimeException(context.getString(R.string.enter_item_name_position) + i); 67 | } 68 | }else{ 69 | if (title == null) { 70 | title = ""; 71 | } 72 | 73 | if (title.trim().equals("")) { 74 | title = ""; 75 | } 76 | } 77 | 78 | mItemAdapter = new NavigationLiveoItemAdapter(title, icon, isHeader, count, navigation.colorSelected, navigation.removeSelector, !isVisible); 79 | mList.add(mItemAdapter); 80 | } 81 | return mList; 82 | } 83 | 84 | public static List getNavigationAdapter(Context context, List listHelpItem, int colorSelected, boolean removeSelector) { 85 | 86 | List mList = new ArrayList<>(); 87 | if (listHelpItem == null || listHelpItem.size() == 0) { 88 | throw new RuntimeException(context.getString(R.string.list_null_or_empty)); 89 | } 90 | 91 | int icon; 92 | int count; 93 | boolean isHeader; 94 | 95 | for (int i = 0; i < listHelpItem.size(); i++) { 96 | 97 | String title = listHelpItem.get(i).getName(); 98 | 99 | NavigationLiveoItemAdapter mItemAdapter; 100 | 101 | icon = listHelpItem.get(i).getIcon(); 102 | isHeader = listHelpItem.get(i).isHeader(); 103 | count = listHelpItem.get(i).getCounter(); 104 | 105 | boolean isVisible = listHelpItem.get(i).isHide(); 106 | 107 | if (isHeader && icon > 0){ 108 | throw new RuntimeException(context.getString(R.string.value_icon_should_be_0)); 109 | } 110 | 111 | if (!isHeader) { 112 | if (title == null) { 113 | throw new RuntimeException(context.getString(R.string.enter_item_name_position) + i); 114 | } 115 | 116 | if (title.trim().equals("")) { 117 | throw new RuntimeException(context.getString(R.string.enter_item_name_position) + i); 118 | } 119 | }else{ 120 | if (title == null) { 121 | title = ""; 122 | } 123 | 124 | if (title.trim().equals("")) { 125 | title = ""; 126 | } 127 | } 128 | 129 | mItemAdapter = new NavigationLiveoItemAdapter(title, icon, isHeader, count, colorSelected, removeSelector, !isVisible); 130 | mList.add(mItemAdapter); 131 | } 132 | return mList; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /library/src/main/java/br/liveo/ui/RoundedImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Rudson Lima 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package br.liveo.ui; 18 | 19 | import android.content.Context; 20 | import android.graphics.Bitmap; 21 | import android.graphics.Canvas; 22 | import android.graphics.Color; 23 | import android.graphics.Paint; 24 | import android.graphics.PorterDuff; 25 | import android.graphics.PorterDuffXfermode; 26 | import android.graphics.Rect; 27 | import android.graphics.drawable.BitmapDrawable; 28 | import android.graphics.drawable.Drawable; 29 | import android.util.AttributeSet; 30 | import android.widget.ImageView; 31 | 32 | public class RoundedImageView extends ImageView { 33 | 34 | public RoundedImageView(Context context) { 35 | super(context); 36 | // TODO Auto-generated constructor stub 37 | } 38 | 39 | public RoundedImageView(Context context, AttributeSet attrs) { 40 | super(context, attrs); 41 | } 42 | 43 | public RoundedImageView(Context context, AttributeSet attrs, int defStyle) { 44 | super(context, attrs, defStyle); 45 | } 46 | 47 | @Override 48 | protected void onDraw(Canvas canvas) { 49 | 50 | Drawable drawable = getDrawable(); 51 | 52 | if (drawable == null) { 53 | return; 54 | } 55 | 56 | if (getWidth() == 0 || getHeight() == 0) { 57 | return; 58 | } 59 | 60 | Bitmap b = ((BitmapDrawable) drawable).getBitmap(); 61 | Bitmap bitmap = b.copy(Bitmap.Config.ARGB_8888, true); 62 | 63 | int w = getWidth(); 64 | 65 | Bitmap roundBitmap = getCroppedBitmap(bitmap, w); 66 | canvas.drawBitmap(roundBitmap, 0, 0, null); 67 | } 68 | 69 | public static Bitmap getCroppedBitmap(Bitmap bmp, int radius) { 70 | 71 | Bitmap sbmp; 72 | 73 | if (bmp.getWidth() != radius || bmp.getHeight() != radius) { 74 | sbmp = Bitmap.createScaledBitmap(bmp, radius, radius, false); 75 | }else { 76 | sbmp = bmp; 77 | } 78 | 79 | Bitmap output = Bitmap.createBitmap(sbmp.getWidth(), 80 | sbmp.getHeight(), Bitmap.Config.ARGB_8888); 81 | Canvas canvas = new Canvas(output); 82 | 83 | final Paint paint = new Paint(); 84 | final Rect rect = new Rect(0, 0, sbmp.getWidth(), sbmp.getHeight()); 85 | 86 | paint.setAntiAlias(true); 87 | paint.setFilterBitmap(true); 88 | paint.setDither(true); 89 | canvas.drawARGB(0, 0, 0, 0); 90 | paint.setColor(Color.parseColor("#BAB399")); 91 | canvas.drawCircle(sbmp.getWidth() / 2 + 0.7f, sbmp.getHeight() / 2 + 0.7f, 92 | sbmp.getWidth() / 2 + 0.1f, paint); 93 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); 94 | canvas.drawBitmap(sbmp, rect, rect, paint); 95 | 96 | return output; 97 | } 98 | } -------------------------------------------------------------------------------- /library/src/main/res/drawable/ic_rudsonlive.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/library/src/main/res/drawable/ic_rudsonlive.jpg -------------------------------------------------------------------------------- /library/src/main/res/drawable/ic_user_background_first.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/library/src/main/res/drawable/ic_user_background_first.jpg -------------------------------------------------------------------------------- /library/src/main/res/drawable/ic_user_background_second.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zirouan/NavigationDrawer-MaterialDesign/8f3bd54d81e09f261841096d02727fbd722eb820/library/src/main/res/drawable/ic_user_background_second.jpg -------------------------------------------------------------------------------- /library/src/main/res/drawable/selector_check_item_navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 22 | 24 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/selector_no_check_item_navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 22 | 24 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/selector_no_item_navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 22 | 24 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_container.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_list_drawer.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 25 | 26 | 38 | 39 | 47 | 48 | 54 | 55 | 60 | 61 | 71 | 72 | 87 | 88 | 89 | 90 | 96 | 97 | 103 | 104 | 114 | 115 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_list_footer.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 25 | 26 | 34 | 35 | 45 | 46 | 61 | 62 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_list_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 25 | 26 | 33 | 34 | 44 | 45 | 54 | 55 | 64 | 65 | 77 | 78 | 87 | 88 | 97 | 98 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_list_item.xml: -------------------------------------------------------------------------------- 1 | 16 | 22 | 23 | 29 | 30 | 35 | 36 | 41 | 42 | 43 | 47 | 48 | 58 | 59 | 76 | 77 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_main_actionbar_dark.xml: -------------------------------------------------------------------------------- 1 | 16 | 22 | 23 | 32 | 33 | 39 | 40 | 45 | 46 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_main_actionbar_light.xml: -------------------------------------------------------------------------------- 1 | 16 | 22 | 23 | 32 | 33 | 39 | 40 | 45 | 46 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_main_dark.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 28 | 29 | 34 | 35 | 44 | 45 | 46 | 47 | 48 | 55 | 56 | 58 | 59 | -------------------------------------------------------------------------------- /library/src/main/res/layout/navigation_main_light.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 28 | 29 | 34 | 35 | 44 | 45 | 46 | 47 | 48 | 55 | 56 | 58 | 59 | -------------------------------------------------------------------------------- /library/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | "" 5 | 6 | Abrir Menú 7 | Cerrar Menú 8 | -------------------------------------------------------------------------------- /library/src/main/res/values-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 320dp 21 | 22 | 23 | 14sp 24 | 25 | 164dp 26 | 27 | 64dp 28 | 64dp 29 | 35dp 30 | 16dp 31 | 32 | 40dp 33 | 40dp 34 | 16dp 35 | 36 | 40dp 37 | 40dp 38 | 16dp 39 | 40 | 56dp 41 | 8dp 42 | 43 | 14sp 44 | 16dp 45 | 46 | 14sp 47 | 16dp 48 | 49 | 50 | -------------------------------------------------------------------------------- /library/src/main/res/values-large-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 320dp 5 | 6 | 160dp 7 | 8 | 64dp 9 | 64dp 10 | 16dp 11 | 16dp 12 | 13 | 40dp 14 | 40dp 15 | 16dp 16 | 17 | 40dp 18 | 40dp 19 | 16dp 20 | 21 | 56dp 22 | 8dp 23 | 24 | 14sp 25 | 16dp 26 | 27 | 14sp 28 | 16dp 29 | 30 | -------------------------------------------------------------------------------- /library/src/main/res/values-large/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 320dp 5 | 6 | 160dp 7 | 8 | 64dp 9 | 64dp 10 | 16dp 11 | 16dp 12 | 13 | 40dp 14 | 40dp 15 | 16dp 16 | 17 | 40dp 18 | 40dp 19 | 16dp 20 | 21 | 56dp 22 | 8dp 23 | 24 | 14sp 25 | 16dp 26 | 27 | 14sp 28 | 16dp 29 | 30 | -------------------------------------------------------------------------------- /library/src/main/res/values-v21/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 189dp 4 | 5 | 64dp 6 | 64dp 7 | 41dp 8 | 16dp 9 | 10 | 40dp 11 | 40dp 12 | 16dp 13 | 14 | 40dp 15 | 40dp 16 | 16dp 17 | 18 | 56dp 19 | 8dp 20 | 21 | 14sp 22 | 16dp 23 | 24 | 14sp 25 | 16dp 26 | 27 | -------------------------------------------------------------------------------- /library/src/main/res/values-v21/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 25 | 26 | 35 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':demo' 2 | include ':library' --------------------------------------------------------------------------------