GithubHelp home page GithubHelp logo

yalantis / guillotinemenu-android Goto Github PK

View Code? Open in Web Editor NEW
2.7K 136.0 498.0 3.83 MB

Neat library, that provides a simple way to implement guillotine-styled animation

Home Page: https://yalantis.com/

Java 100.00%
android java animation menu transition

guillotinemenu-android's Introduction

Guillotine animation

Neat library, that provides a simple way to implement guillotine-styled animation

Yalantis

Android Arsenal

Android Gems

Check this [project on Dribbble] (https://dribbble.com/shots/2018249-Guillotine-Menu)

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)

Guillotine animation gif

Usage

For a working implementation, have a look at the app module

  1. Add JitPack repository in your root build.gradle at the end of repositories:

    allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }
    
    
  2. Add the dependency to your app build.gradle

    dependencies {
        compile 'com.github.Yalantis:GuillotineMenu-Android:1.2'
    }
    
  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.

  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

    new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
                .setActionBarViewForAnimation(toolbar)
                .build();

Here setActionBarViewForAnimation method enables bounce effect of Toolbar at the end of the guillotine closing animation.

Misc

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.

Compatibility

  • Android 4.0.3 Ice Cream Sandwich (API level 15)

Changelog

Version: 1.0

  • Initial Build

Version: 1.2

  • Moved to using Toolbar instead of ActionBar
  • Updated Gradle versions
  • Fixed bugs

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

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!

License

Copyright 2017, Yalantis

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

guillotinemenu-android's People

Contributors

dmytrodenysenko avatar edbaev avatar liaohuqiu avatar voltazor avatar warko-san avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

guillotinemenu-android's Issues

java.lang.ClassNotFoundException: Didn't find class

Hi, when I download the example of guillotineMenu and I use it in android studio all works fine, but when I make copy/paste of that code (including dependiencies) this happens:
image

and I try with code made by me but give me the same error. What I can do? :(

Provide generic Interpolator

First of all, nice library and great animation. However, I think the interpolators at the moment is created based on some pre-calculated constants. For example, in ActionBarInterpolator:

   private static final float FIRST_BOUNCE_PART = 0.375f;
   private static final float SECOND_BOUNCE_PART = 0.625f;
   @Override
   public float getInterpolation(float t) {
       if (t < FIRST_BOUNCE_PART) {
           return (-28.4444f) * t * t + 10.66667f * t;
       } else if (t < SECOND_BOUNCE_PART) {
           return (21.33312f) * t * t - 21.33312f * t + 4.999950f;
       } else {
           return (-9.481481f) * t * t + 15.40741f * t - 5.925926f;
       }
   }

The constants used in getInterpolation (e.g., -28.4444f) are pre-calculated based on the values of FIRST_BOUNCE_PART and SECOND_BOUNCE_PART. If either or both of these values are changed, the constant values need to be recalculated.

This limit users of this library from changing the value of FIRST_BOUNCE_PART and/or SECOND_BOUNCE_PART to whatever they want because if they change these values, they have to do their own math to work out formulas for the interpolators.

So I think it would be nicer to provide generic formulas for interpolators with perhaps FIRST_BOUNCE_PART and SECOND_BOUNCE_PART are variables to avoid users being worrying about the formulas themselves.

What do you think?

Right To Left Animation Problem!

I want to have menu button on right side, the problem is animation starts from bottom to top and doesn't seem correct.
problem solved when I changed "GUILLOTINE_CLOSED_ANGLE" value from -90.0F to 90.0F.

Menu crashed on 4.2.2

i used this menu in my application . this is so good and good looking in UI . But the problem occurs on 4.2.2 . when i tried to run app on 4.2.2 the menu crashed . if you have a solution to this problem kindly reply .

Issue in second bounce

Hi, Thanks for awesome library. I found one issue. After opening animation, little bit of behind layout is visible.You can see in sample example if you change background of root element in activity layout.

Please see attached image.red color is activity background color and slightly visible in right side.
device-2015-07-09-000443

I found solution of that issue. You can verify from your side.

Change in GuillotineInterpolator class:

private float secondBounce(float t) {
return 0.625f * t * t - 1.083f * t + 1.458f;
}

Error inflating class CanaroTextView

I'm trying to implement this menu in my code and set everything up the same way as the example code provided, but when inflating the menu in the MainActivity onCreate() method, the app stops.
The following message is displayed
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.CanaroTextView" on path: DexPathList[[zip file "/data/app/com.example.guillotinemenu.testapp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

But I can't understand where the program is trying to get the android.view.CanaroTextView class, since throughout my program I'm always specifying the CanaroTextView class in my own package

I still can click a button beneath guillotine menu

so I used this guillotine menu library in my project, but I have an issue
I have a recyclerview and when I click it, it will go to another activity...
so when I open guillotine menu, I can click my recyclerview which is beneath guillotine menu on empty space in guillotine menu

is there any solution on this?

Animation not smooth in RecycleView

I am inflating a layout for Guillotinemenu which contain a recycleview with gridlayout which contatin an image and text so when i click on menu button it open menu with not smooth animation...its stuck in between for few milliseconds and than open the menu..while in simple textview with drawble in your example work smoothly

How to close menu with BackButton?

Thanks for this library, i use this menu in my project. but now i have close this menu with BackButtonPress in android.
how can i this?

Attempt to invoke virtual method - addView

Hello,

I have copy this to my APP. But i have this error :
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.FrameLayout.addView(android.view.View)' on a null object reference at com.yalantis.guillotine.sample.activity.MainActivity.onCreate(MainActivity.java:43)

Do you know why i have this error ?

Thanks

Failed to resolve

hi , i have an issue loading this project on android studio
when i load this project my android studio shows this error :
Failed to resolve: com.jakewharton:butterknife:6.1.0
is it because my sdk is not upgraded?
what can i do to fix this error ?

Handle right-to-left layouts

First of all, this library is great :). When do you plan to implement handling right-to-left layouts functionality? It is just changing GUILLOTINE_CLOSED_ANGLE constant to positive value

Getting Error in the App Module

I'm getting an error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.ActionButton'. in res/values/styles.xml

Problem with open angel

There seems to be a problem with the Open angel of the menu.
I can see a bit from the main view from the right of the screen.
So its like over opened.

Issue 2 :

if i use setClosedOnStart() to true, the hamburger button animation doesn't work

GuillotineMenu doesn't display

I have a question and i implement a view where only was the toolbar with the GuillotineMenu animation. Works fine...but..i also put a recyclerView under this toolbar and the guillotine menu does not display in my view. I have make no changes so i don't know if there is any problem with other views (recyclerView) or something like that.

Hope someone can help me.
Thanks!

How do button work in menu

I have just implemented "GuillotineMenu-Android" in my android project. In my menu xml files I have some button which perform some actions, for that actions I have to write click listeners for that buttons.The java file which I am attaching with that xml is not working. How can I make it operational?

guillotine activity

Hi, I'm implementing your beautiful menu is a way that the guillotine layout will be full of interactions, and they don't seem to react at all, I've create a GuillotineActivity.java for it, and can't change simple things like the backgroundColor programmatically, how do I do it ?
Thanks

clone issue

I am faceing this issue in when i had updtae project gradle 2.2.1 to 3.1.3
Cannot choose between the following configurations of project :library:

  • debugApiElements
  • debugRuntimeElements
  • releaseApiElements
  • releaseRuntimeElements
    All of them match the consumer attributes:
  • Configuration 'debugApiElements':
    • Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
    • Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
    • Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
    • Found org.gradle.usage 'java-api' but wasn't required.
  • Configuration 'debugRuntimeElements':
    • Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
    • Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
    • Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
    • Found org.gradle.usage 'java-runtime' but wasn't required.
  • Configuration 'releaseApiElements':
    • Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
    • Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
    • Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
    • Found org.gradle.usage 'java-api' but wasn't required.
  • Configuration 'releaseRuntimeElements':
    • Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
    • Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
    • Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
    • Found org.gradle.usage 'java-runtime' but wasn't required.

Change Log

Please write change log for 1.2 version

Beautiful but not convenient.

I like it! It was beautiful. But I think it was not convenient cause I must click the menu icon.

I think it will be better that you rotate the drawer 90 degrees in clockwise direction and add sliding gesture like Navigating Drawer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.