Coder Social home page Coder Social logo

shiburagi / drawer-behavior Goto Github PK

View Code? Open in Web Editor NEW
591.0 17.0 101.0 15.71 MB

Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.

Home Page: https://shiburagi.github.io/Drawer-Behavior/

License: MIT License

Java 2.97% Kotlin 97.03%
android android-library android-development android-application drawer drawer-layout drawerlayout drawer-navigation drawer-android drawernavigator

drawer-behavior's Introduction

drawer-behavior's People

Contributors

exazero avatar rayliverified avatar shiburagi 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

drawer-behavior's Issues

animation speed

is there any way to increase or decrease the drawer closing animation speed?

androidX compatibility issue

Hey Developer this Lib is awesome and working fine till Migration to Latest androidx(jetpack, replacement of android support library)...

Please update this Awesome Library and make Compatible with Latest androidX !!

excited to see this awesome Lib with Latest Androidx support..
Thank you !!

xml dont show preview

when added into my xml, show below error

java.lang.NullPointerException at com.infideap.drawerbehavior.AdvanceDrawerLayout.init(AdvanceDrawerLayout.java:75) at com.infideap.drawerbehavior.AdvanceDrawerLayout.<init>(AdvanceDrawerLayout.java:58) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:403) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:186) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:144) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:309) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:418) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:429) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:333) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:394) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:326) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:391) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:195) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:540) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$5(RenderTask.java:666) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

Screenshot from 2019-06-26 21-52-38

Not Support RTL

when the local of the device set to RTL like (Arabic) the activity still slides to right, while it should slide to left

Fatal Exception: java.lang.IllegalArgumentException: Cannot set 'scaleY' to Float.NaN

I got crash in some user which crashlytics said:

Fatal Exception: java.lang.IllegalArgumentException: Cannot set 'scaleY' to Float.NaN
       at android.view.View.sanitizeFloatPropertyValue(View.java:17723)
       at android.view.View.sanitizeFloatPropertyValue(View.java:17697)
       at android.view.View.setScaleY(View.java:17091)
       at androidx.core.view.ViewCompat.setScaleY(ViewCompat.java)
       at com.infideap.drawerbehavior.AdvanceDrawerLayout.updateSlideOffset(AdvanceDrawerLayout.java:361)
       at com.infideap.drawerbehavior.AdvanceDrawerLayout.access$updateSlideOffset(AdvanceDrawerLayout.java)
       at com.infideap.drawerbehavior.AdvanceDrawerLayout$init$1.onDrawerSlide(AdvanceDrawerLayout.java:12)
       at androidx.drawerlayout.widget.DrawerLayout.dispatchOnDrawerSlide(DrawerLayout.java:20)
       at androidx.drawerlayout.widget.DrawerLayout.setDrawerViewOffset(DrawerLayout.java:15)
       at androidx.drawerlayout.widget.DrawerLayout.onLayout(DrawerLayout.java:177)
       at android.view.View.layout(View.java:23266)
       at android.view.ViewGroup.layout(ViewGroup.java:6532)
       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
       at android.view.View.layout(View.java:23266)
       at android.view.ViewGroup.layout(ViewGroup.java:6532)
       at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
       at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
       at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
       at android.view.View.layout(View.java:23266)
       at android.view.ViewGroup.layout(ViewGroup.java:6532)
       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
       at android.view.View.layout(View.java:23266)
       at android.view.ViewGroup.layout(ViewGroup.java:6532)
       at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
       at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
       at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
       at android.view.View.layout(View.java:23266)
       at android.view.ViewGroup.layout(ViewGroup.java:6532)
       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
       at com.android.internal.policy.DecorView.onLayout(DecorView.java:804)
       at android.view.View.layout(View.java:23266)
       at android.view.ViewGroup.layout(ViewGroup.java:6532)
       at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3708)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3166)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2135)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8624)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:975)
       at android.view.Choreographer.doCallbacks(Choreographer.java:799)
       at android.view.Choreographer.doFrame(Choreographer.java:734)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:960)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:236)
       at android.app.ActivityThread.main(ActivityThread.java:8057)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)

I use this dependency
implementation 'com.infideap.drawerbehavior:drawer-behavior:1.0.4'

and crash occurs
Screen Shot 2022-11-09 at 12 01 36

However i can't produce the crash, i don't know how this could happened. Please help

infideap layout not working

I tried implementing it, and performing all necessary tasks, its not working.
I'm getting the error, that it is failed to resolve this dependency.

I've included the maven part as well.
Please help regarding this

Bug in adding content view

Hi,

I think you need to add the following lines to your AdvanceDrawerLayout.

    @Override
    public void addView(View child, ViewGroup.LayoutParams params) {
        child.setLayoutParams(params);
        addView(child);
    }

Your code fails to intercept child views that are not added to layout by an include tag. Since other views have their width and height set, the other method gets called and you miss them.

Humbergs not Working

After migration to x the click event is not working properly please fix this issue

Left drawer closes when I click on it (not happening on right drawer)

This is the code:

<com.infideap.drawerbehavior.AdvanceDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                 xmlns:app="http://schemas.android.com/apk/res-auto"
                                                 xmlns:tools="http://schemas.android.com/tools"
                                                 android:id="@+id/drawer_layout"
                                                 android:layout_width="match_parent"
                                                 android:layout_height="match_parent"
                                                 android:fitsSystemWindows="false"
                                                 android:background="#ffffff">

    <android.support.design.widget.NavigationView
            android:id="@+id/left_drawer"
            android:background="#ffffff"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:fitsSystemWindows="false">

.....

  <android.support.design.widget.NavigationView
            android:id="@+id/righ_drawer"
            android:background="#ffffff"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="end"
            android:fitsSystemWindows="false">

....

</com.infideap.drawerbehavior.AdvanceDrawerLayout>

After I open the left drawer, whenever I click on it, the drawer will close ignoring any event that I'm trying to trigger. If I move the left drawer to the right (Gravity.END), the issue won't happen.
Why is this happening only on a NavigatioView moved to the left?

How to Close Drawer or check for it's current state ??

In Normal drawer Layout we can check for drawer's current state. and if it is already Opened then we can close it by calling drawerLayout.closeDrawer(Grav...) .
so How to achieve method for closing drawer ??
By the way your work is superb and really fantastic !!

Not Working After Jcenter() deprecation

So , recently Jcenter() announced that they are closing down and the libraries will not work from february 2022 so , after i remove Jcenter() it says class not found exception.

Issue in Android veriosn 4.4.2

When just try to use isDrawerOpen(int Gravity) it works fine when I test it on android oreo but the app crashes on android version 4.4.2
Here's the crash :
java.lang.IllegalArgumentException: View android.widget.FrameLayout{a5fc4610 V.E..... ........ 0,0-1440,2304} is not a drawer
at android.support.v4.widget.DrawerLayout.isDrawerOpen(DrawerLayout.java:1820)
at android.support.v4.widget.DrawerLayout.isDrawerOpen(DrawerLayout.java:1838)

Class cast exception

java.lang.ClassCastException: com.google.android.material.appbar.AppBarLayout cannot be cast to com.google.android.material.navigation.NavigationView

Facing above issue while following your code

java.lang.ClassCastException: androidx.drawerlayout.widget.DrawerLayout cannot be cast to com.infideap.drawerbehavior.AdvanceDrawerLayout

java.lang.ClassCastException: androidx.drawerlayout.widget.DrawerLayout cannot be cast to com.infideap.drawerbehavior.AdvanceDrawerLayout

java.lang.ClassCastException: androidx.drawerlayout.widget.DrawerLayout cannot be cast to com.infideap.drawerbehavior.AdvanceDrawerLayout
at com.bareum_sw.tubeplayer.MainActivity.setupDrawer(MainActivity.java:128)
at com.bareum_sw.tubeplayer.MainActivity.onCreate(MainActivity.java:118)
at android.app.Activity.performCreate(Activity.java:7340)
at android.app.Activity.performCreate(Activity.java:7331)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1275)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3123)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3286)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1974)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7180)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

home view dosent show

thanks for your library.
i use it. everything is ok.
but in s9+ i have an bug. i cant see home view when drawer is open. first picture is from s9+ and second is from j7 pro
9afc961d-76d1-4856-be1f-dbd638afbc85
cc1b3f48-2228-49a3-ae01-6999a52cc2ad

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.