├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── yalantis │ │ └── com │ │ └── sidemenu │ │ └── sample │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── yalantis │ │ └── com │ │ └── sidemenu │ │ └── sample │ │ ├── MainActivity.java │ │ └── fragment │ │ └── ContentFragment.java │ └── res │ ├── drawable-hdpi │ ├── content_films.png │ ├── content_music.png │ ├── ic_launcher.png │ ├── icn_1.png │ ├── icn_2.png │ ├── icn_3.png │ ├── icn_4.png │ ├── icn_5.png │ ├── icn_6.png │ ├── icn_7.png │ └── icn_close.png │ ├── drawable-mdpi │ ├── content_films.png │ ├── content_music.png │ ├── ic_launcher.png │ ├── icn_1.png │ ├── icn_2.png │ ├── icn_3.png │ ├── icn_4.png │ ├── icn_5.png │ ├── icn_6.png │ ├── icn_7.png │ └── icn_close.png │ ├── drawable-xhdpi │ ├── content_films.png │ ├── content_music.png │ ├── ic_launcher.png │ ├── icn_1.png │ ├── icn_2.png │ ├── icn_3.png │ ├── icn_4.png │ ├── icn_5.png │ ├── icn_6.png │ ├── icn_7.png │ └── icn_close.png │ ├── drawable-xxhdpi │ ├── content_films.png │ ├── content_music.png │ ├── ic_launcher.png │ ├── icn_1.png │ ├── icn_2.png │ ├── icn_3.png │ ├── icn_4.png │ ├── icn_5.png │ ├── icn_6.png │ ├── icn_7.png │ └── icn_close.png │ ├── drawable-xxxhdpi │ ├── content_films.png │ ├── content_music.png │ ├── ic_launcher.png │ ├── icn_1.png │ ├── icn_2.png │ ├── icn_3.png │ ├── icn_4.png │ ├── icn_5.png │ ├── icn_6.png │ ├── icn_7.png │ └── icn_close.png │ ├── drawable │ └── menu_item_selector.xml │ ├── layout │ ├── activity_main.xml │ └── fragment_main.xml │ ├── menu │ └── menu_main.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── badge.png ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── yalantis │ │ └── com │ │ └── sidemenu │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── yalantis │ │ └── com │ │ └── sidemenu │ │ ├── animation │ │ └── FlipAnimation.java │ │ ├── interfaces │ │ ├── Resourceble.java │ │ └── ScreenShotable.java │ │ ├── model │ │ └── SlideMenuItem.java │ │ └── util │ │ └── ViewAnimator.java │ └── res │ ├── drawable-hdpi │ ├── item_down.png │ └── item_up.png │ ├── drawable-mdpi │ ├── item_down.png │ └── item_up.png │ ├── drawable-xhdpi │ ├── item_down.png │ └── item_up.png │ ├── drawable-xxhdpi │ ├── item_down.png │ └── item_up.png │ ├── drawable-xxxhdpi │ ├── item_down.png │ └── item_up.png │ ├── drawable │ └── menu_item_selector.xml │ ├── layout │ └── menu_list_item.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ └── styles.xml ├── mavenpush.gradle ├── screenshot.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # svn 2 | *.svn* 3 | 4 | # built application files 5 | *.apk 6 | *.ap_ 7 | 8 | # files for the dex VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # generated GUI files 15 | */R.java 16 | 17 | # generated folder 18 | bin 19 | gen 20 | 21 | # local 22 | local.properties 23 | proguard.cfg 24 | 25 | # log files 26 | log*.txt 27 | 28 | # archives 29 | *.gz 30 | *.tar 31 | *.zip 32 | 33 | # eclipse 34 | *.metadata 35 | *.settings 36 | 37 | # idea 38 | *.idea 39 | *.iml 40 | *.ipr 41 | *.iws 42 | out/ 43 | 44 | # gradle 45 | build/ 46 | .gradle 47 | 48 | # linux 49 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/.gitmodules -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Side--Menu.Android-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1388) [![Yalantis](https://github.com/Yalantis/Side-Menu.Android/blob/master/badge.png)](https://yalantis.com/?utm_source=github) 2 | Side Menu 3 | ============== 4 | #### Side menu with some categories to choose. 5 | Check this project on dribbble.
6 | Check this project on Behance. 7 | 8 | God bless Ukraine! 9 | 10 | ![Preview](https://cdn.dribbble.com/users/125056/screenshots/1689922/events-menu_1-1-6.gif) 11 | 12 | Sample 13 | ====== 14 | Sample & .aar file 15 | Note 16 | ==== 17 | 18 | depends on Ozodrukh's animation util for CircularReveal animation for 2.3+ version 19 | 20 | Using 21 | ====== 22 | First of all you have to upload animation submodule with `git submodule update --init` command
23 |
24 | Or you can add gradle dependency with command :
25 | ```groovy 26 | dependencies { 27 | implementation 'com.github.yalantis:Side-Menu.Android:1.0.2' 28 | } 29 | ``` 30 | .
31 | and command:
32 | ```groovy 33 | repositories { 34 | maven { 35 | url "https://jitpack.io" 36 | } 37 | } 38 | dependencies { 39 | implementation 'com.github.ozodrukh:CircularReveal:(latest-release)@aar' 40 | } 41 | 42 | ``` 43 | 44 | To add gradle dependency you need to open build.gradle (in your app folder,not in a project folder) then copy and add the dependencies there in the dependencies block; 45 | 46 | 47 |
for CircularReveal module 48 | 49 | 50 | After you have to create special overlay layout to show in behind current `Circular Reveal` animated view. 51 | And to add all items to menu you have to add all of them into `LinearLayout` 52 | 53 | ```xml 54 | 59 | 60 | 65 | 70 | 75 | 76 | 82 | 83 | 84 | 85 | 91 | 92 | 100 | 101 | 102 | 103 | 104 | ``` 105 | 106 | ```java 107 | 108 | ViewAnimator viewAnimator = new ViewAnimator<>(ActionBarActivity.this, 109 | new ArrayList(), 110 | (LinearLayout) findViewById(R.id.left_drawer), 111 | contentFragment, drawerLayout); 112 | //to open menu you have to override ActionBarDrawerToggle method 113 | @Override 114 | public void onDrawerSlide(View drawerView, float slideOffset) { 115 | super.onDrawerSlide(drawerView, slideOffset); 116 | if (slideOffset > 0.6 && viewAnimator.getLinearLayout().getChildCount() == 0) 117 | viewAnimator.showMenuContent(); 118 | } 119 | public void onDrawerClosed(View view) { 120 | super.onDrawerClosed(view); 121 | viewAnimator.getLinearLayout().removeAllViews(); 122 | viewAnimator.getLinearLayout().invalidate(); 123 | } 124 | 125 | ``` 126 | All menu items should implement `Resourceble` interface to get menu item name and drawable res 127 | And all fragments should implement `ScreenShotable` to get screenshot of a fragment 128 | 129 | You can customize icons that u place in the menu,or add mor items. Simply by changing the list you parse to view animator .For example: 130 | 131 | ```java 132 | 133 | private List list = new ArrayList<>(); \\ the list of menu items 134 | 135 | SlideMenuItem menuItem0 = new SlideMenuItem(ContentFragment.CLOSE, R.drawable.icn_close); 136 | list.add(menuItem0); 137 | SlideMenuItem menuItem = new SlideMenuItem(ContentFragment.BUILDING, R.drawable.icn_1); \\first parameter is the id of menu item,the second is the icon resouce 138 | list.add(menuItem); 139 | SlideMenuItem menuItem2 = new SlideMenuItem(ContentFragment.BOOK, R.drawable.icn_2); 140 | list.add(menuItem2); 141 | 142 | viewAnimator = new ViewAnimator<>(this, list, contentFragment, drawerLayout, this); 143 | ``` 144 | 145 | #### Let us know! 146 | 147 | We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation. 148 | 149 | P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for Android (iOS) better than better. Stay tuned! 150 | 151 | ## License 152 | 153 | Copyright 2019, Yalantis 154 | 155 | Licensed under the Apache License, Version 2.0 (the "License"); 156 | you may not use this file except in compliance with the License. 157 | You may obtain a copy of the License at 158 | 159 | http://www.apache.org/licenses/LICENSE-2.0 160 | 161 | Unless required by applicable law or agreed to in writing, software 162 | distributed under the License is distributed on an "AS IS" BASIS, 163 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 164 | See the License for the specific language governing permissions and 165 | limitations under the License. 166 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | repositories { 3 | maven { 4 | url "https://jitpack.io" 5 | } 6 | } 7 | android { 8 | compileSdkVersion 28 9 | buildToolsVersion "28.0.3" 10 | 11 | defaultConfig { 12 | minSdkVersion 16 13 | targetSdkVersion 28 14 | versionCode 1 15 | versionName "1.0" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation project(':library') 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | implementation 'com.android.support:appcompat-v7:28.0.0' 29 | implementation 'com.github.ozodrukh:CircularReveal:2.1.0' 30 | } 31 | -------------------------------------------------------------------------------- /app/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 D:\soft\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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/yalantis/com/sidemenu/sample/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu; 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 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/yalantis/com/sidemenu/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu.sample; 2 | 3 | import android.animation.Animator; 4 | import android.content.res.Configuration; 5 | import android.graphics.Color; 6 | import android.graphics.drawable.BitmapDrawable; 7 | import android.os.Bundle; 8 | import android.support.v4.widget.DrawerLayout; 9 | import android.support.v7.app.ActionBarDrawerToggle; 10 | import android.support.v7.app.AppCompatActivity; 11 | import android.support.v7.widget.Toolbar; 12 | import android.view.Menu; 13 | import android.view.MenuItem; 14 | import android.view.View; 15 | import android.view.animation.AccelerateInterpolator; 16 | import android.widget.LinearLayout; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import io.codetail.animation.ViewAnimationUtils; 22 | import yalantis.com.sidemenu.interfaces.Resourceble; 23 | import yalantis.com.sidemenu.interfaces.ScreenShotable; 24 | import yalantis.com.sidemenu.model.SlideMenuItem; 25 | import yalantis.com.sidemenu.sample.fragment.ContentFragment; 26 | import yalantis.com.sidemenu.util.ViewAnimator; 27 | 28 | 29 | public class MainActivity extends AppCompatActivity implements ViewAnimator.ViewAnimatorListener { 30 | private DrawerLayout drawerLayout; 31 | private ActionBarDrawerToggle drawerToggle; 32 | private List list = new ArrayList<>(); 33 | private ViewAnimator viewAnimator; 34 | private int res = R.drawable.content_music; 35 | private LinearLayout linearLayout; 36 | 37 | 38 | @Override 39 | protected void onCreate(Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | setContentView(R.layout.activity_main); 42 | ContentFragment contentFragment = ContentFragment.newInstance(R.drawable.content_music); 43 | getSupportFragmentManager().beginTransaction() 44 | .replace(R.id.content_frame, contentFragment) 45 | .commit(); 46 | drawerLayout = findViewById(R.id.drawer_layout); 47 | drawerLayout.setScrimColor(Color.TRANSPARENT); 48 | linearLayout = findViewById(R.id.left_drawer); 49 | linearLayout.setOnClickListener(new View.OnClickListener() { 50 | @Override 51 | public void onClick(View v) { 52 | drawerLayout.closeDrawers(); 53 | } 54 | }); 55 | 56 | 57 | setActionBar(); 58 | createMenuList(); 59 | viewAnimator = new ViewAnimator<>(this, list, contentFragment, drawerLayout, this); 60 | } 61 | 62 | private void createMenuList() { 63 | SlideMenuItem menuItem0 = new SlideMenuItem(ContentFragment.CLOSE, R.drawable.icn_close); 64 | list.add(menuItem0); 65 | SlideMenuItem menuItem = new SlideMenuItem(ContentFragment.BUILDING, R.drawable.icn_1); 66 | list.add(menuItem); 67 | SlideMenuItem menuItem2 = new SlideMenuItem(ContentFragment.BOOK, R.drawable.icn_2); 68 | list.add(menuItem2); 69 | SlideMenuItem menuItem3 = new SlideMenuItem(ContentFragment.PAINT, R.drawable.icn_3); 70 | list.add(menuItem3); 71 | SlideMenuItem menuItem4 = new SlideMenuItem(ContentFragment.CASE, R.drawable.icn_4); 72 | list.add(menuItem4); 73 | SlideMenuItem menuItem5 = new SlideMenuItem(ContentFragment.SHOP, R.drawable.icn_5); 74 | list.add(menuItem5); 75 | SlideMenuItem menuItem6 = new SlideMenuItem(ContentFragment.PARTY, R.drawable.icn_6); 76 | list.add(menuItem6); 77 | SlideMenuItem menuItem7 = new SlideMenuItem(ContentFragment.MOVIE, R.drawable.icn_7); 78 | list.add(menuItem7); 79 | } 80 | 81 | 82 | private void setActionBar() { 83 | Toolbar toolbar = findViewById(R.id.toolbar); 84 | setSupportActionBar(toolbar); 85 | getSupportActionBar().setHomeButtonEnabled(true); 86 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 87 | drawerToggle = new ActionBarDrawerToggle( 88 | this, /* host Activity */ 89 | drawerLayout, /* DrawerLayout object */ 90 | toolbar, /* nav drawer icon to replace 'Up' caret */ 91 | R.string.drawer_open, /* "open drawer" description */ 92 | R.string.drawer_close /* "close drawer" description */ 93 | ) { 94 | 95 | /** Called when a drawer has settled in a completely closed state. */ 96 | public void onDrawerClosed(View view) { 97 | super.onDrawerClosed(view); 98 | linearLayout.removeAllViews(); 99 | linearLayout.invalidate(); 100 | } 101 | 102 | @Override 103 | public void onDrawerSlide(View drawerView, float slideOffset) { 104 | super.onDrawerSlide(drawerView, slideOffset); 105 | if (slideOffset > 0.6 && linearLayout.getChildCount() == 0) 106 | viewAnimator.showMenuContent(); 107 | } 108 | 109 | /** Called when a drawer has settled in a completely open state. */ 110 | public void onDrawerOpened(View drawerView) { 111 | super.onDrawerOpened(drawerView); 112 | } 113 | }; 114 | drawerLayout.addDrawerListener(drawerToggle); 115 | } 116 | 117 | @Override 118 | protected void onPostCreate(Bundle savedInstanceState) { 119 | super.onPostCreate(savedInstanceState); 120 | drawerToggle.syncState(); 121 | } 122 | 123 | @Override 124 | public void onConfigurationChanged(Configuration newConfig) { 125 | super.onConfigurationChanged(newConfig); 126 | drawerToggle.onConfigurationChanged(newConfig); 127 | } 128 | 129 | 130 | @Override 131 | public boolean onCreateOptionsMenu(Menu menu) { 132 | getMenuInflater().inflate(R.menu.menu_main, menu); 133 | return true; 134 | } 135 | 136 | @Override 137 | public boolean onOptionsItemSelected(MenuItem item) { 138 | if (drawerToggle.onOptionsItemSelected(item)) { 139 | return true; 140 | } 141 | switch (item.getItemId()) { 142 | case R.id.action_settings: 143 | return true; 144 | default: 145 | return super.onOptionsItemSelected(item); 146 | } 147 | } 148 | 149 | private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPosition) { 150 | this.res = this.res == R.drawable.content_music ? R.drawable.content_films : R.drawable.content_music; 151 | View view = findViewById(R.id.content_frame); 152 | int finalRadius = Math.max(view.getWidth(), view.getHeight()); 153 | Animator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius); 154 | animator.setInterpolator(new AccelerateInterpolator()); 155 | animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION); 156 | 157 | findViewById(R.id.content_overlay).setBackground(new BitmapDrawable(getResources(), screenShotable.getBitmap())); 158 | animator.start(); 159 | ContentFragment contentFragment = ContentFragment.newInstance(this.res); 160 | getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentFragment).commit(); 161 | return contentFragment; 162 | } 163 | 164 | @Override 165 | public ScreenShotable onSwitch(Resourceble slideMenuItem, ScreenShotable screenShotable, int position) { 166 | switch (slideMenuItem.getName()) { 167 | case ContentFragment.CLOSE: 168 | return screenShotable; 169 | default: 170 | return replaceFragment(screenShotable, position); 171 | } 172 | } 173 | 174 | @Override 175 | public void disableHomeButton() { 176 | getSupportActionBar().setHomeButtonEnabled(false); 177 | 178 | } 179 | 180 | @Override 181 | public void enableHomeButton() { 182 | getSupportActionBar().setHomeButtonEnabled(true); 183 | drawerLayout.closeDrawers(); 184 | 185 | } 186 | 187 | @Override 188 | public void addViewToContainer(View view) { 189 | linearLayout.addView(view); 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /app/src/main/java/yalantis/com/sidemenu/sample/fragment/ContentFragment.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu.sample.fragment; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Canvas; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.support.v4.app.Fragment; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.ImageView; 12 | 13 | import yalantis.com.sidemenu.interfaces.ScreenShotable; 14 | import yalantis.com.sidemenu.sample.R; 15 | 16 | /** 17 | * Created by Konstantin on 22.12.2014. 18 | */ 19 | public class ContentFragment extends Fragment implements ScreenShotable { 20 | public static final String CLOSE = "Close"; 21 | public static final String BUILDING = "Building"; 22 | public static final String BOOK = "Book"; 23 | public static final String PAINT = "Paint"; 24 | public static final String CASE = "Case"; 25 | public static final String SHOP = "Shop"; 26 | public static final String PARTY = "Party"; 27 | public static final String MOVIE = "Movie"; 28 | 29 | private View containerView; 30 | protected ImageView mImageView; 31 | protected int res; 32 | private Bitmap bitmap; 33 | 34 | public static ContentFragment newInstance(int resId) { 35 | ContentFragment contentFragment = new ContentFragment(); 36 | Bundle bundle = new Bundle(); 37 | bundle.putInt(Integer.class.getName(), resId); 38 | contentFragment.setArguments(bundle); 39 | return contentFragment; 40 | } 41 | 42 | 43 | @Override 44 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 45 | super.onViewCreated(view, savedInstanceState); 46 | this.containerView = view.findViewById(R.id.container); 47 | } 48 | 49 | @Override 50 | public void onCreate(Bundle savedInstanceState) { 51 | super.onCreate(savedInstanceState); 52 | res = getArguments().getInt(Integer.class.getName()); 53 | } 54 | 55 | @Override 56 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 57 | Bundle savedInstanceState) { 58 | View rootView = inflater.inflate(R.layout.fragment_main, container, false); 59 | mImageView = (ImageView) rootView.findViewById(R.id.image_content); 60 | mImageView.setClickable(true); 61 | mImageView.setFocusable(true); 62 | mImageView.setImageResource(res); 63 | return rootView; 64 | } 65 | 66 | @Override 67 | public void takeScreenShot() { 68 | Thread thread = new Thread() { 69 | @Override 70 | public void run() { 71 | Bitmap bitmap = Bitmap.createBitmap(containerView.getWidth(), 72 | containerView.getHeight(), Bitmap.Config.ARGB_8888); 73 | Canvas canvas = new Canvas(bitmap); 74 | containerView.draw(canvas); 75 | ContentFragment.this.bitmap = bitmap; 76 | } 77 | }; 78 | 79 | thread.start(); 80 | 81 | } 82 | 83 | @Override 84 | public Bitmap getBitmap() { 85 | return bitmap; 86 | } 87 | } 88 | 89 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/content_films.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/content_films.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/content_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/content_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icn_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/icn_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icn_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/icn_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icn_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/icn_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icn_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/icn_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icn_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/icn_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icn_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/icn_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icn_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/icn_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-hdpi/icn_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/content_films.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/content_films.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/content_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/content_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icn_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/icn_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icn_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/icn_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icn_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/icn_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icn_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/icn_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icn_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/icn_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icn_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/icn_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icn_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/icn_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/icn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-mdpi/icn_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/content_films.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/content_films.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/content_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/content_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icn_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/icn_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icn_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/icn_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icn_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/icn_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icn_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/icn_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icn_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/icn_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icn_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/icn_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icn_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/icn_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xhdpi/icn_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/content_films.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/content_films.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/content_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/content_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icn_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/icn_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icn_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/icn_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icn_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/icn_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icn_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/icn_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icn_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/icn_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icn_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/icn_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icn_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/icn_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxhdpi/icn_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/content_films.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/content_films.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/content_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/content_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icn_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/icn_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icn_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/icn_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icn_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/icn_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icn_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/icn_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icn_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/icn_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icn_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/icn_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icn_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/icn_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/icn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/app/src/main/res/drawable-xxxhdpi/icn_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/menu_item_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 18 | 19 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 80dp 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Side Menu 5 | Settings 6 | Open 7 | Close 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/badge.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 | google() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.3.0' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | def isReleaseBuild() { 17 | return version.contains("SNAPSHOT") == false 18 | } 19 | 20 | allprojects { 21 | version = VERSION_NAME 22 | group = GROUP 23 | repositories { 24 | jcenter() 25 | google() 26 | } 27 | } 28 | apply plugin: 'android-reporting' -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=1.0 2 | VERSION_CODE=1 3 | GROUP=com.yalantis 4 | 5 | POM_DESCRIPTION=Side menu with some categories to choose. Made in Yalantis. 6 | POM_URL=https://github.com/Yalantis/Side-Menu.Android 7 | POM_SCM_URL=https://github.com/Yalantis/Side-Menu.Android 8 | POM_SCM_CONNECTION=scm:git@github.com:yalantis/Side-Menu.Android.git 9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:yalantis/Side-Menu.Android.git 10 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 12 | POM_LICENCE_DIST=repo 13 | POM_DEVELOPER_ID=yalantis 14 | POM_DEVELOPER_NAME=Yalantis 15 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jan 31 15:40:02 EET 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /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 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /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 | /build 2 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | 4 | android { 5 | compileSdkVersion 28 6 | buildToolsVersion "28.0.3" 7 | 8 | defaultConfig { 9 | minSdkVersion 15 10 | targetSdkVersion 28 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 | dependencies { 22 | implementation 'com.android.support:appcompat-v7:28.0.0' 23 | } 24 | 25 | task androidJavadocs(type: Javadoc) { 26 | source = android.sourceSets.main.java.sourceFiles 27 | } 28 | 29 | task androidJavadocsJar(type: Jar) { 30 | classifier = 'javadoc' 31 | //basename = artifact_id 32 | from androidJavadocs.destinationDir 33 | } 34 | 35 | task androidSourcesJar(type: Jar) { 36 | classifier = 'sources' 37 | //basename = artifact_id 38 | from android.sourceSets.main.java.sourceFiles 39 | } 40 | 41 | artifacts { 42 | //archives packageReleaseJar 43 | archives androidSourcesJar 44 | archives androidJavadocsJar 45 | } -------------------------------------------------------------------------------- /library/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Side Menu 2 | POM_ARTIFACT_ID=sidemenu 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /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 D:\soft\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/yalantis/com/sidemenu/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu; 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 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /library/src/main/java/yalantis/com/sidemenu/animation/FlipAnimation.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu.animation; 2 | 3 | import android.graphics.Camera; 4 | import android.graphics.Matrix; 5 | import android.view.animation.Animation; 6 | import android.view.animation.Transformation; 7 | 8 | /** 9 | * Created by Konstantin on 22.12.2014. 10 | */ 11 | public class FlipAnimation extends Animation { 12 | private final float mFromDegrees; 13 | private final float mToDegrees; 14 | private final float mCenterX; 15 | private final float mCenterY; 16 | private Camera mCamera; 17 | 18 | public FlipAnimation(float fromDegrees, float toDegrees, 19 | float centerX, float centerY) { 20 | mFromDegrees = fromDegrees; 21 | mToDegrees = toDegrees; 22 | mCenterX = centerX; 23 | mCenterY = centerY; 24 | } 25 | 26 | @Override 27 | public void initialize(int width, int height, int parentWidth, int parentHeight) { 28 | super.initialize(width, height, parentWidth, parentHeight); 29 | mCamera = new Camera(); 30 | } 31 | 32 | @Override 33 | protected void applyTransformation(float interpolatedTime, Transformation t) { 34 | final float fromDegrees = mFromDegrees; 35 | float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime); 36 | 37 | final float centerX = mCenterX; 38 | final float centerY = mCenterY; 39 | final Camera camera = mCamera; 40 | 41 | final Matrix matrix = t.getMatrix(); 42 | 43 | camera.save(); 44 | 45 | camera.rotateY(degrees); 46 | 47 | camera.getMatrix(matrix); 48 | camera.restore(); 49 | 50 | matrix.preTranslate(-centerX, -centerY); 51 | matrix.postTranslate(centerX, centerY); 52 | 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /library/src/main/java/yalantis/com/sidemenu/interfaces/Resourceble.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu.interfaces; 2 | 3 | /** 4 | * Created by Konstantin on 12.01.2015. 5 | */ 6 | public interface Resourceble { 7 | public int getImageRes(); 8 | 9 | public String getName(); 10 | } 11 | -------------------------------------------------------------------------------- /library/src/main/java/yalantis/com/sidemenu/interfaces/ScreenShotable.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu.interfaces; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | /** 6 | * Created by Konstantin on 12.01.2015. 7 | */ 8 | public interface ScreenShotable { 9 | public void takeScreenShot(); 10 | 11 | public Bitmap getBitmap(); 12 | } 13 | -------------------------------------------------------------------------------- /library/src/main/java/yalantis/com/sidemenu/model/SlideMenuItem.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu.model; 2 | 3 | import yalantis.com.sidemenu.interfaces.Resourceble; 4 | 5 | /** 6 | * Created by Konstantin on 23.12.2014. 7 | */ 8 | public class SlideMenuItem implements Resourceble { 9 | private String name; 10 | private int imageRes; 11 | 12 | public SlideMenuItem(String name, int imageRes) { 13 | this.name = name; 14 | this.imageRes = imageRes; 15 | } 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public int getImageRes() { 26 | return imageRes; 27 | } 28 | 29 | public void setImageRes(int imageRes) { 30 | this.imageRes = imageRes; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /library/src/main/java/yalantis/com/sidemenu/util/ViewAnimator.java: -------------------------------------------------------------------------------- 1 | package yalantis.com.sidemenu.util; 2 | 3 | import android.os.Handler; 4 | import android.support.v4.widget.DrawerLayout; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.view.animation.AccelerateInterpolator; 8 | import android.view.animation.Animation; 9 | import android.widget.ImageView; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import yalantis.com.sidemenu.R; 15 | import yalantis.com.sidemenu.animation.FlipAnimation; 16 | import yalantis.com.sidemenu.interfaces.Resourceble; 17 | import yalantis.com.sidemenu.interfaces.ScreenShotable; 18 | 19 | /** 20 | * Created by Konstantin on 12.01.2015. 21 | */ 22 | public class ViewAnimator { 23 | private final int ANIMATION_DURATION = 175; 24 | public static final int CIRCULAR_REVEAL_ANIMATION_DURATION = 500; 25 | 26 | private AppCompatActivity appCompatActivity; 27 | 28 | private List list; 29 | 30 | private List viewList = new ArrayList<>(); 31 | private ScreenShotable screenShotable; 32 | private DrawerLayout drawerLayout; 33 | private ViewAnimatorListener animatorListener; 34 | 35 | 36 | public ViewAnimator(AppCompatActivity activity, 37 | List items, 38 | ScreenShotable screenShotable, 39 | final DrawerLayout drawerLayout, 40 | ViewAnimatorListener animatorListener) { 41 | this.appCompatActivity = activity; 42 | 43 | this.list = items; 44 | this.screenShotable = screenShotable; 45 | this.drawerLayout = drawerLayout; 46 | this.animatorListener = animatorListener; 47 | } 48 | 49 | 50 | public void showMenuContent() { 51 | setViewsClickable(false); 52 | viewList.clear(); 53 | double size = list.size(); 54 | for (int i = 0; i < size; i++) { 55 | View viewMenu = appCompatActivity.getLayoutInflater().inflate(R.layout.menu_list_item, null); 56 | 57 | final int finalI = i; 58 | viewMenu.setOnClickListener(new View.OnClickListener() { 59 | @Override 60 | public void onClick(View v) { 61 | int[] location = {0, 0}; 62 | v.getLocationOnScreen(location); 63 | switchItem(list.get(finalI), location[1] + v.getHeight() / 2); 64 | } 65 | }); 66 | ((ImageView) viewMenu.findViewById(R.id.menu_item_image)).setImageResource(list.get(i).getImageRes()); 67 | viewMenu.setVisibility(View.GONE); 68 | viewMenu.setEnabled(false); 69 | viewList.add(viewMenu); 70 | animatorListener.addViewToContainer(viewMenu); 71 | final double position = i; 72 | final double delay = 3 * ANIMATION_DURATION * (position / size); 73 | new Handler().postDelayed(new Runnable() { 74 | public void run() { 75 | if (position < viewList.size()) { 76 | animateView((int) position); 77 | } 78 | if (position == viewList.size() - 1) { 79 | screenShotable.takeScreenShot(); 80 | setViewsClickable(true); 81 | } 82 | } 83 | }, (long) delay); 84 | } 85 | 86 | } 87 | 88 | private void hideMenuContent() { 89 | setViewsClickable(false); 90 | double size = list.size(); 91 | for (int i = list.size(); i >= 0; i--) { 92 | final double position = i; 93 | final double delay = 3 * ANIMATION_DURATION * (position / size); 94 | new Handler().postDelayed(new Runnable() { 95 | public void run() { 96 | if (position < viewList.size()) { 97 | animateHideView((int) position); 98 | } 99 | } 100 | }, (long) delay); 101 | } 102 | 103 | } 104 | 105 | private void setViewsClickable(boolean clickable) { 106 | animatorListener.disableHomeButton(); 107 | for (View view : viewList) { 108 | view.setEnabled(clickable); 109 | } 110 | } 111 | 112 | private void animateView(int position) { 113 | final View view = viewList.get(position); 114 | view.setVisibility(View.VISIBLE); 115 | FlipAnimation rotation = 116 | new FlipAnimation(90, 0, 0.0f, view.getHeight() / 2.0f); 117 | rotation.setDuration(ANIMATION_DURATION); 118 | rotation.setFillAfter(true); 119 | rotation.setInterpolator(new AccelerateInterpolator()); 120 | rotation.setAnimationListener(new Animation.AnimationListener() { 121 | @Override 122 | public void onAnimationStart(Animation animation) { 123 | 124 | } 125 | 126 | @Override 127 | public void onAnimationEnd(Animation animation) { 128 | view.clearAnimation(); 129 | } 130 | 131 | @Override 132 | public void onAnimationRepeat(Animation animation) { 133 | 134 | } 135 | }); 136 | 137 | view.startAnimation(rotation); 138 | } 139 | 140 | private void animateHideView(final int position) { 141 | final View view = viewList.get(position); 142 | FlipAnimation rotation = 143 | new FlipAnimation(0, 90, 0.0f, view.getHeight() / 2.0f); 144 | rotation.setDuration(ANIMATION_DURATION); 145 | rotation.setFillAfter(true); 146 | rotation.setInterpolator(new AccelerateInterpolator()); 147 | rotation.setAnimationListener(new Animation.AnimationListener() { 148 | @Override 149 | public void onAnimationStart(Animation animation) { 150 | 151 | } 152 | 153 | @Override 154 | public void onAnimationEnd(Animation animation) { 155 | view.clearAnimation(); 156 | view.setVisibility(View.INVISIBLE); 157 | if (position == viewList.size() - 1) { 158 | animatorListener.enableHomeButton(); 159 | drawerLayout.closeDrawers(); 160 | } 161 | } 162 | 163 | @Override 164 | public void onAnimationRepeat(Animation animation) { 165 | 166 | } 167 | }); 168 | 169 | view.startAnimation(rotation); 170 | } 171 | 172 | private void switchItem(Resourceble slideMenuItem, int topPosition) { 173 | this.screenShotable = animatorListener.onSwitch(slideMenuItem, screenShotable, topPosition); 174 | hideMenuContent(); 175 | } 176 | 177 | public interface ViewAnimatorListener { 178 | 179 | public ScreenShotable onSwitch(Resourceble slideMenuItem, ScreenShotable screenShotable, int position); 180 | 181 | public void disableHomeButton(); 182 | 183 | public void enableHomeButton(); 184 | 185 | public void addViewToContainer(View view); 186 | 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/item_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-hdpi/item_down.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/item_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-hdpi/item_up.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/item_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-mdpi/item_down.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/item_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-mdpi/item_up.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/item_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-xhdpi/item_down.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/item_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-xhdpi/item_up.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/item_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-xxhdpi/item_down.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/item_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-xxhdpi/item_up.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxxhdpi/item_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-xxxhdpi/item_down.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxxhdpi/item_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/library/src/main/res/drawable-xxxhdpi/item_up.png -------------------------------------------------------------------------------- /library/src/main/res/drawable/menu_item_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/res/layout/menu_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /library/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /library/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mavenpush.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven' 2 | apply plugin: 'signing' 3 | 4 | def sonatypeRepositoryUrl 5 | if (isReleaseBuild()) { 6 | println 'RELEASE BUILD' 7 | sonatypeRepositoryUrl = hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL 8 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 9 | } else { 10 | println 'DEBUG BUILD' 11 | sonatypeRepositoryUrl = hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL 12 | : "https://oss.sonatype.org/content/repositories/snapshots/" 13 | } 14 | 15 | def getRepositoryUsername() { 16 | return hasProperty('nexusUsername') ? nexusUsername : "" 17 | } 18 | 19 | def getRepositoryPassword() { 20 | return hasProperty('nexusPassword') ? nexusPassword : "" 21 | } 22 | 23 | afterEvaluate { project -> 24 | uploadArchives { 25 | repositories { 26 | mavenDeployer { 27 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 28 | 29 | pom.artifactId = POM_ARTIFACT_ID 30 | 31 | repository(url: sonatypeRepositoryUrl) { 32 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 33 | } 34 | 35 | pom.project { 36 | name POM_NAME 37 | packaging POM_PACKAGING 38 | description POM_DESCRIPTION 39 | url POM_URL 40 | 41 | scm { 42 | url POM_SCM_URL 43 | connection POM_SCM_CONNECTION 44 | developerConnection POM_SCM_DEV_CONNECTION 45 | } 46 | 47 | licenses { 48 | license { 49 | name POM_LICENCE_NAME 50 | url POM_LICENCE_URL 51 | distribution POM_LICENCE_DIST 52 | } 53 | } 54 | 55 | developers { 56 | developer { 57 | id POM_DEVELOPER_ID 58 | name POM_DEVELOPER_NAME 59 | } 60 | } 61 | } 62 | } 63 | } 64 | } 65 | 66 | signing { 67 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 68 | sign configurations.archives 69 | } 70 | 71 | task androidJavadocs(type: Javadoc) { 72 | source = android.sourceSets.main.java.sourceFiles 73 | } 74 | 75 | task androidJavadocsJar(type: Jar) { 76 | classifier = 'javadoc' 77 | //basename = artifact_id 78 | from androidJavadocs.destinationDir 79 | } 80 | 81 | task androidSourcesJar(type: Jar) { 82 | classifier = 'sources' 83 | //basename = artifact_id 84 | from android.sourceSets.main.java.sourceFiles 85 | } 86 | 87 | artifacts { 88 | //archives packageReleaseJar 89 | archives androidSourcesJar 90 | archives androidJavadocsJar 91 | } 92 | } -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/touchasky/Side-Menu.Android/b83ed828a0c792d3f6ef08d4529e075c646a4e7c/screenshot.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app',':library' 2 | --------------------------------------------------------------------------------