├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yalantis │ │ └── guillotine │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── fonts │ │ └── canaro_extra_bold.otf │ ├── java │ └── com │ │ └── yalantis │ │ └── guillotine │ │ └── sample │ │ ├── App.java │ │ ├── activity │ │ └── MainActivity.java │ │ └── widget │ │ └── CanaroTextView.java │ └── res │ ├── drawable-hdpi │ ├── content_1.png │ ├── content_2.png │ ├── ic_activity.png │ ├── ic_activity_active.png │ ├── ic_feed.png │ ├── ic_menu.png │ ├── ic_menu_90.png │ ├── ic_profile.png │ └── ic_settings.png │ ├── drawable-mdpi │ ├── content_1.png │ ├── content_2.png │ ├── ic_activity.png │ ├── ic_activity_active.png │ ├── ic_feed.png │ ├── ic_menu.png │ ├── ic_menu_90.png │ ├── ic_profile.png │ └── ic_settings.png │ ├── drawable-xhdpi │ ├── content_1.png │ ├── content_2.png │ ├── ic_activity.png │ ├── ic_activity_active.png │ ├── ic_feed.png │ ├── ic_menu.png │ ├── ic_menu_90.png │ ├── ic_profile.png │ └── ic_settings.png │ ├── drawable-xxhdpi │ ├── content_1.png │ ├── content_2.png │ ├── ic_activity.png │ ├── ic_activity_active.png │ ├── ic_feed.png │ ├── ic_menu.png │ ├── ic_menu_90.png │ ├── ic_profile.png │ └── ic_settings.png │ ├── layout │ ├── activity.xml │ └── guillotine.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ └── values │ ├── color.xml │ ├── dimens.xml │ ├── strings.xml │ ├── styles.xml │ └── themes.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── guillotine.apk ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yalantis │ │ └── guillotine │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── yalantis │ │ └── guillotine │ │ ├── animation │ │ └── GuillotineAnimation.java │ │ ├── interfaces │ │ └── GuillotineListener.java │ │ └── util │ │ ├── ActionBarInterpolator.java │ │ └── GuillotineInterpolator.java │ └── res │ └── values │ └── strings.xml ├── made-in-yalantis.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # svn 2 | *.svn* 3 | 4 | # files for the dex VM 5 | *.dex 6 | 7 | # Java class files 8 | *.class 9 | 10 | # generated GUI files 11 | */R.java 12 | 13 | # generated folder 14 | bin 15 | gen 16 | 17 | # local 18 | local.properties 19 | 20 | proguard_logs/ 21 | 22 | # log files 23 | log*.txt 24 | 25 | # archives 26 | *.gz 27 | *.tar 28 | *.zip 29 | 30 | # eclipse 31 | *.metadata 32 | *.settings 33 | *.prefs 34 | 35 | #idea 36 | *.idea 37 | *.iml 38 | out/ 39 | 40 | build/ 41 | .gradle/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Guillotine animation 2 | 3 | Neat library, that provides a simple way to implement guillotine-styled animation 4 | 5 | [![Yalantis](https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/master/made-in-yalantis.png)](https://yalantis.com/?utm_source=github) 6 | 7 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-GuillotineMenu-green.svg?style=flat)](https://android-arsenal.com/details/1/1995) 8 | 9 | [![Android Gems](http://www.android-gems.com/badge/Yalantis/GuillotineMenu-Android.svg?branch=master)](http://www.android-gems.com/lib/Yalantis/GuillotineMenu-Android) 10 | 11 | Check this [project on Dribbble] (https://dribbble.com/shots/2018249-Guillotine-Menu) 12 | 13 | Also, read how it was done in [our blog] (https://yalantis.com/blog/how-we-developed-the-guillotine-menu-animation-for-android/?utm_source=github) 14 | 15 | Guillotine animation gif 16 | 17 | 18 | # Usage 19 | 20 | *For a working implementation, have a look at the app module* 21 | 22 | 1. Add JitPack repository in your root build.gradle at the end of repositories: 23 | 24 | ~~~ 25 | allprojects { 26 | repositories { 27 | ... 28 | maven { url "https://jitpack.io" } 29 | } 30 | } 31 | 32 | ~~~ 33 | 34 | 2. Add the dependency to your app build.gradle 35 | 36 | ~~~ 37 | dependencies { 38 | compile 'com.github.Yalantis:GuillotineMenu-Android:1.2' 39 | } 40 | ~~~ 41 | 42 | 3. You need to create a layout for the navigation menu (`guillotine.xml` in sample app), which will later open and close guillotine-style. The only tricky part here is that the navigation layout should be on top of any other content and will disappear after closing animation ends. That is why content layout (`activity.xml` in sample app) should also have hamburger icon at the same coordinates as navigation menu has. 43 | 44 | 4. After that all you need to do is to build animation by passing navigation layout object, navigation and content layout hamburger objects to `GuillotineAnimation.GuillotineBuilder` in your `onCreate` method 45 | 46 | ```java 47 | new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger) 48 | .setActionBarViewForAnimation(toolbar) 49 | .build(); 50 | ``` 51 | Here `setActionBarViewForAnimation` method enables bounce effect of Toolbar at the end of the guillotine closing animation. 52 | 53 | # Misc 54 | 55 | Builder allows you to customize start delay, duration, interpolation and you can set listener if you want to do staff at the moment when menu has been opened or closed. 56 | 57 | # Compatibility 58 | 59 | * Android 4.0.3 Ice Cream Sandwich (API level 15) 60 | 61 | # Changelog 62 | 63 | ### Version: 1.0 64 | 65 | * Initial Build 66 | 67 | ### Version: 1.2 68 | 69 | * Moved to using Toolbar instead of ActionBar 70 | * Updated Gradle versions 71 | * Fixed bugs 72 | 73 | #### Let us know! 74 | 75 | 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. 76 | 77 | 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! 78 | 79 | ## License 80 | 81 | Copyright 2017, Yalantis 82 | 83 | Licensed under the Apache License, Version 2.0 (the "License"); 84 | you may not use this file except in compliance with the License. 85 | You may obtain a copy of the License at 86 | 87 | http://www.apache.org/licenses/LICENSE-2.0 88 | 89 | Unless required by applicable law or agreed to in writing, software 90 | distributed under the License is distributed on an "AS IS" BASIS, 91 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 92 | See the License for the specific language governing permissions and 93 | limitations under the License. 94 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 7 | } 8 | } 9 | 10 | apply plugin: 'com.android.application' 11 | apply plugin: 'com.neenbedankt.android-apt' 12 | 13 | android { 14 | compileSdkVersion 24 15 | buildToolsVersion "23.0.3" 16 | 17 | defaultConfig { 18 | applicationId "com.yalantis.guillotine.sample" 19 | minSdkVersion 15 20 | targetSdkVersion 24 21 | versionCode 3 22 | versionName "1.2" 23 | } 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | } 31 | 32 | dependencies { 33 | compile project(':library') 34 | compile fileTree(dir: 'libs', include: ['*.jar']) 35 | compile 'com.android.support:appcompat-v7:24.2.1' 36 | compile 'com.jakewharton:butterknife:8.0.1' 37 | apt 'com.jakewharton:butterknife-compiler:8.0.1' 38 | } -------------------------------------------------------------------------------- /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 /home/cleanok/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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/yalantis/guillotine/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine; 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 | 3 | 4 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/assets/fonts/canaro_extra_bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/assets/fonts/canaro_extra_bold.otf -------------------------------------------------------------------------------- /app/src/main/java/com/yalantis/guillotine/sample/App.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine.sample; 2 | 3 | import android.app.Application; 4 | import android.graphics.Typeface; 5 | 6 | /** 7 | * Created by Dmytro Denysenko on 5/6/15. 8 | */ 9 | public class App extends Application { 10 | private static final String CANARO_EXTRA_BOLD_PATH = "fonts/canaro_extra_bold.otf"; 11 | public static Typeface canaroExtraBold; 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | initTypeface(); 17 | } 18 | 19 | private void initTypeface() { 20 | canaroExtraBold = Typeface.createFromAsset(getAssets(), CANARO_EXTRA_BOLD_PATH); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/yalantis/guillotine/sample/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine.sample.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.widget.FrameLayout; 9 | 10 | import com.yalantis.guillotine.animation.GuillotineAnimation; 11 | import com.yalantis.guillotine.sample.R; 12 | 13 | import butterknife.ButterKnife; 14 | import butterknife.BindView; 15 | 16 | /** 17 | * Created by Dmytro Denysenko on 5/4/15. 18 | */ 19 | public class MainActivity extends AppCompatActivity { 20 | private static final long RIPPLE_DURATION = 250; 21 | 22 | 23 | @BindView(R.id.toolbar) 24 | Toolbar toolbar; 25 | @BindView(R.id.root) 26 | FrameLayout root; 27 | @BindView(R.id.content_hamburger) 28 | View contentHamburger; 29 | 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity); 34 | ButterKnife.bind(this); 35 | 36 | 37 | if (toolbar != null) { 38 | setSupportActionBar(toolbar); 39 | getSupportActionBar().setTitle(null); 40 | } 41 | 42 | View guillotineMenu = LayoutInflater.from(this).inflate(R.layout.guillotine, null); 43 | root.addView(guillotineMenu); 44 | 45 | new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger) 46 | .setStartDelay(RIPPLE_DURATION) 47 | .setActionBarViewForAnimation(toolbar) 48 | .setClosedOnStart(true) 49 | .build(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/yalantis/guillotine/sample/widget/CanaroTextView.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine.sample.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.TextView; 6 | 7 | import com.yalantis.guillotine.sample.App; 8 | 9 | /** 10 | * Created by Dmytro Denysenko on 5/6/15. 11 | */ 12 | public class CanaroTextView extends TextView { 13 | public CanaroTextView(Context context) { 14 | this(context, null); 15 | } 16 | 17 | public CanaroTextView(Context context, AttributeSet attrs) { 18 | this(context, attrs, 0); 19 | } 20 | 21 | public CanaroTextView(Context context, AttributeSet attrs, int defStyleAttr) { 22 | super(context, attrs, defStyleAttr); 23 | setTypeface(App.canaroExtraBold); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/content_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/content_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/content_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/content_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/ic_activity.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_activity_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/ic_activity_active.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_feed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/ic_feed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu_90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/ic_menu_90.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/ic_profile.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-hdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/content_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/content_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/content_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/content_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/ic_activity.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_activity_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/ic_activity_active.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_feed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/ic_feed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_menu_90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/ic_menu_90.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/ic_profile.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-mdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/content_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/content_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/content_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/content_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/ic_activity.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_activity_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/ic_activity_active.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_feed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/ic_feed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_menu_90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/ic_menu_90.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/ic_profile.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/content_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/content_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/content_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/content_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/ic_activity.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_activity_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/ic_activity_active.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_feed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/ic_feed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_menu_90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/ic_menu_90.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/ic_profile.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/drawable-xxhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 15 | 16 | 20 | 21 | 25 | 26 | 30 | 31 | 37 | 38 | 39 | 43 | 44 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/guillotine.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 17 | 18 | 19 | 23 | 24 | 27 | 28 | 31 | 32 | 33 | 36 | 37 | 40 | 41 | 44 | 45 | 46 | 49 | 50 | 53 | 54 | 57 | 58 | 59 | 62 | 63 | 66 | 67 | 70 | 71 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #444153 4 | #383547 5 | #30d1d5 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24dp 5 | 48dp 6 | 100dp 7 | 40dp 8 | 9 | 20sp 10 | 35dp 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Guillotine 3 | PROFILE 4 | FEED 5 | ACTIVITY 6 | SETTINGS 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 20 | 21 | 29 | 30 | 33 | 34 | 41 | 42 | 48 | 49 | 54 | 55 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | -------------------------------------------------------------------------------- /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:2.2.1' 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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 10 13:48:17 EEST 2016 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-2.14.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 | -------------------------------------------------------------------------------- /guillotine.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/guillotine.apk -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 24 10 | versionCode 3 11 | versionName "1.2" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | } 24 | -------------------------------------------------------------------------------- /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 /home/cleanok/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/com/yalantis/guillotine/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine; 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 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library/src/main/java/com/yalantis/guillotine/animation/GuillotineAnimation.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine.animation; 2 | 3 | import android.animation.Animator; 4 | import android.animation.ObjectAnimator; 5 | import android.animation.TimeInterpolator; 6 | import android.os.Build; 7 | import android.view.View; 8 | import android.view.ViewTreeObserver; 9 | 10 | import com.yalantis.guillotine.interfaces.GuillotineListener; 11 | import com.yalantis.guillotine.util.ActionBarInterpolator; 12 | import com.yalantis.guillotine.util.GuillotineInterpolator; 13 | 14 | /** 15 | * Created by Dmytro Denysenko on 5/6/15. 16 | */ 17 | public class GuillotineAnimation { 18 | private static final String ROTATION = "rotation"; 19 | private static final float GUILLOTINE_CLOSED_ANGLE = -90f; 20 | private static final float GUILLOTINE_OPENED_ANGLE = 0f; 21 | private static final int DEFAULT_DURATION = 625; 22 | private static final float ACTION_BAR_ROTATION_ANGLE = 3f; 23 | 24 | private final View mGuillotineView; 25 | private final long mDuration; 26 | private final ObjectAnimator mOpeningAnimation; 27 | private final ObjectAnimator mClosingAnimation; 28 | private final GuillotineListener mListener; 29 | private final boolean mIsRightToLeftLayout; 30 | private final TimeInterpolator mInterpolator; 31 | private final View mActionBarView; 32 | private final long mDelay; 33 | 34 | private boolean isOpening; 35 | private boolean isClosing; 36 | 37 | private GuillotineAnimation(GuillotineBuilder builder) { 38 | this.mActionBarView = builder.actionBarView; 39 | this.mListener = builder.guillotineListener; 40 | this.mGuillotineView = builder.guillotineView; 41 | this.mDuration = builder.duration > 0 ? builder.duration : DEFAULT_DURATION; 42 | this.mDelay = builder.startDelay; 43 | this.mIsRightToLeftLayout = builder.isRightToLeftLayout; 44 | this.mInterpolator = builder.interpolator == null ? new GuillotineInterpolator() : builder.interpolator; 45 | setUpOpeningView(builder.openingView); 46 | setUpClosingView(builder.closingView); 47 | this.mOpeningAnimation = buildOpeningAnimation(); 48 | this.mClosingAnimation = buildClosingAnimation(); 49 | if (builder.isClosedOnStart) { 50 | mGuillotineView.setRotation(GUILLOTINE_CLOSED_ANGLE); 51 | mGuillotineView.setVisibility(View.INVISIBLE); 52 | } 53 | //TODO handle right-to-left layouts 54 | //TODO handle landscape orientation 55 | } 56 | 57 | public void open() { 58 | if (!isOpening) { 59 | mOpeningAnimation.start(); 60 | } 61 | } 62 | 63 | public void close() { 64 | if (!isClosing) { 65 | mClosingAnimation.start(); 66 | } 67 | 68 | } 69 | 70 | private void setUpOpeningView(final View openingView) { 71 | if (mActionBarView != null) { 72 | mActionBarView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { 73 | @Override 74 | public void onGlobalLayout() { 75 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 76 | mActionBarView.getViewTreeObserver().removeOnGlobalLayoutListener(this); 77 | } else { 78 | mActionBarView.getViewTreeObserver().removeGlobalOnLayoutListener(this); 79 | } 80 | mActionBarView.setPivotX(calculatePivotX(openingView)); 81 | mActionBarView.setPivotY(calculatePivotY(openingView)); 82 | } 83 | }); 84 | } 85 | openingView.setOnClickListener(new View.OnClickListener() { 86 | @Override 87 | public void onClick(View v) { 88 | open(); 89 | } 90 | }); 91 | } 92 | 93 | private void setUpClosingView(final View closingView) { 94 | mGuillotineView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { 95 | @Override 96 | public void onGlobalLayout() { 97 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 98 | mGuillotineView.getViewTreeObserver().removeOnGlobalLayoutListener(this); 99 | } else { 100 | mGuillotineView.getViewTreeObserver().removeGlobalOnLayoutListener(this); 101 | } 102 | mGuillotineView.setPivotX(calculatePivotX(closingView)); 103 | mGuillotineView.setPivotY(calculatePivotY(closingView)); 104 | } 105 | }); 106 | 107 | closingView.setOnClickListener(new View.OnClickListener() { 108 | @Override 109 | public void onClick(View v) { 110 | close(); 111 | } 112 | }); 113 | } 114 | 115 | private ObjectAnimator buildOpeningAnimation() { 116 | ObjectAnimator rotationAnimator = initAnimator(ObjectAnimator.ofFloat(mGuillotineView, ROTATION, GUILLOTINE_CLOSED_ANGLE, GUILLOTINE_OPENED_ANGLE)); 117 | rotationAnimator.setInterpolator(mInterpolator); 118 | rotationAnimator.setDuration(mDuration); 119 | rotationAnimator.addListener(new Animator.AnimatorListener() { 120 | @Override 121 | public void onAnimationStart(Animator animation) { 122 | mGuillotineView.setVisibility(View.VISIBLE); 123 | isOpening = true; 124 | } 125 | 126 | @Override 127 | public void onAnimationEnd(Animator animation) { 128 | isOpening = false; 129 | if (mListener != null) { 130 | mListener.onGuillotineOpened(); 131 | } 132 | } 133 | 134 | @Override 135 | public void onAnimationCancel(Animator animation) { 136 | 137 | } 138 | 139 | @Override 140 | public void onAnimationRepeat(Animator animation) { 141 | 142 | } 143 | }); 144 | return rotationAnimator; 145 | } 146 | 147 | private ObjectAnimator buildClosingAnimation() { 148 | ObjectAnimator rotationAnimator = initAnimator(ObjectAnimator.ofFloat(mGuillotineView, ROTATION, GUILLOTINE_OPENED_ANGLE, GUILLOTINE_CLOSED_ANGLE)); 149 | rotationAnimator.setDuration((long) (mDuration * GuillotineInterpolator.ROTATION_TIME)); 150 | rotationAnimator.addListener(new Animator.AnimatorListener() { 151 | @Override 152 | public void onAnimationStart(Animator animation) { 153 | isClosing = true; 154 | mGuillotineView.setVisibility(View.VISIBLE); 155 | } 156 | 157 | @Override 158 | public void onAnimationEnd(Animator animation) { 159 | isClosing = false; 160 | mGuillotineView.setVisibility(View.GONE); 161 | startActionBarAnimation(); 162 | 163 | if (mListener != null) { 164 | mListener.onGuillotineClosed(); 165 | } 166 | } 167 | 168 | @Override 169 | public void onAnimationCancel(Animator animation) { 170 | 171 | } 172 | 173 | @Override 174 | public void onAnimationRepeat(Animator animation) { 175 | 176 | } 177 | }); 178 | return rotationAnimator; 179 | } 180 | 181 | private void startActionBarAnimation() { 182 | ObjectAnimator actionBarAnimation = ObjectAnimator.ofFloat(mActionBarView, ROTATION, GUILLOTINE_OPENED_ANGLE, ACTION_BAR_ROTATION_ANGLE); 183 | actionBarAnimation.setDuration((long) (mDuration * (GuillotineInterpolator.FIRST_BOUNCE_TIME + GuillotineInterpolator.SECOND_BOUNCE_TIME))); 184 | actionBarAnimation.setInterpolator(new ActionBarInterpolator()); 185 | actionBarAnimation.start(); 186 | } 187 | 188 | private ObjectAnimator initAnimator(ObjectAnimator animator) { 189 | animator.setStartDelay(mDelay); 190 | return animator; 191 | } 192 | 193 | private float calculatePivotY(View burger) { 194 | return burger.getTop() + burger.getHeight() / 2; 195 | } 196 | 197 | private float calculatePivotX(View burger) { 198 | return burger.getLeft() + burger.getWidth() / 2; 199 | } 200 | 201 | public static class GuillotineBuilder { 202 | private final View guillotineView; 203 | private final View openingView; 204 | private final View closingView; 205 | private View actionBarView; 206 | private GuillotineListener guillotineListener; 207 | private long duration; 208 | private long startDelay; 209 | private boolean isRightToLeftLayout; 210 | private TimeInterpolator interpolator; 211 | private boolean isClosedOnStart; 212 | 213 | public GuillotineBuilder(View guillotineView, View closingView, View openingView) { 214 | this.guillotineView = guillotineView; 215 | this.openingView = openingView; 216 | this.closingView = closingView; 217 | } 218 | 219 | public GuillotineBuilder setActionBarViewForAnimation(View view) { 220 | this.actionBarView = view; 221 | return this; 222 | } 223 | 224 | public GuillotineBuilder setGuillotineListener(GuillotineListener guillotineListener) { 225 | this.guillotineListener = guillotineListener; 226 | return this; 227 | } 228 | 229 | public GuillotineBuilder setDuration(long duration) { 230 | this.duration = duration; 231 | return this; 232 | } 233 | 234 | public GuillotineBuilder setStartDelay(long startDelay) { 235 | this.startDelay = startDelay; 236 | return this; 237 | } 238 | 239 | public GuillotineBuilder setRightToLeftLayout(boolean isRightToLeftLayout) { 240 | this.isRightToLeftLayout = isRightToLeftLayout; 241 | return this; 242 | } 243 | 244 | public GuillotineBuilder setInterpolator(TimeInterpolator interpolator) { 245 | this.interpolator = interpolator; 246 | return this; 247 | } 248 | 249 | public GuillotineBuilder setClosedOnStart(boolean isClosedOnStart) { 250 | this.isClosedOnStart = isClosedOnStart; 251 | return this; 252 | } 253 | 254 | public GuillotineAnimation build() { 255 | return new GuillotineAnimation(this); 256 | } 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /library/src/main/java/com/yalantis/guillotine/interfaces/GuillotineListener.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine.interfaces; 2 | 3 | /** 4 | * Created by Dmytro Denysenko on 5/6/15. 5 | */ 6 | public interface GuillotineListener { 7 | void onGuillotineOpened(); 8 | void onGuillotineClosed(); 9 | } 10 | -------------------------------------------------------------------------------- /library/src/main/java/com/yalantis/guillotine/util/ActionBarInterpolator.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine.util; 2 | 3 | import android.animation.TimeInterpolator; 4 | 5 | /** 6 | * Created by Dmytro Denysenko on 5/15/15. 7 | */ 8 | public class ActionBarInterpolator implements TimeInterpolator { 9 | 10 | private static final float FIRST_BOUNCE_PART = 0.375f; 11 | private static final float SECOND_BOUNCE_PART = 0.625f; 12 | 13 | @Override 14 | public float getInterpolation(float t) { 15 | if (t < FIRST_BOUNCE_PART) { 16 | return (-28.4444f) * t * t + 10.66667f * t; 17 | } else if (t < SECOND_BOUNCE_PART) { 18 | return (21.33312f) * t * t - 21.33312f * t + 4.999950f; 19 | } else { 20 | return (-9.481481f) * t * t + 15.40741f * t - 5.925926f; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /library/src/main/java/com/yalantis/guillotine/util/GuillotineInterpolator.java: -------------------------------------------------------------------------------- 1 | package com.yalantis.guillotine.util; 2 | 3 | import android.animation.TimeInterpolator; 4 | 5 | /** 6 | * Created by Dmytro Denysenko on 5/7/15. 7 | */ 8 | public class GuillotineInterpolator implements TimeInterpolator { 9 | 10 | public static final float ROTATION_TIME = 0.46667f; 11 | public static final float FIRST_BOUNCE_TIME = 0.26666f; 12 | public static final float SECOND_BOUNCE_TIME = 0.26667f; 13 | 14 | 15 | public GuillotineInterpolator() { 16 | } 17 | 18 | public float getInterpolation(float t) { 19 | if (t < ROTATION_TIME) return rotation(t); 20 | else if (t < ROTATION_TIME + FIRST_BOUNCE_TIME) return firstBounce(t); 21 | else return secondBounce(t); 22 | } 23 | 24 | private float rotation(float t) { 25 | return 4.592f * t * t; 26 | } 27 | 28 | private float firstBounce(float t) { 29 | return 2.5f * t * t - 3f * t + 1.85556f; 30 | } 31 | 32 | private float secondBounce(float t) { 33 | return 0.625f * t * t - 1.083f * t + 1.458f; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Guillotine 3 | 4 | -------------------------------------------------------------------------------- /made-in-yalantis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yalantis/GuillotineMenu-Android/da8cc2236f65c02e355c1932cc97fadc8226bf48/made-in-yalantis.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':library' 2 | --------------------------------------------------------------------------------