jfeinstein10 / SlidingMenu

An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!
Apache License 2.0
11.07k stars 5.03k forks source link

Issue with Smooth Sliding #529

Open edwingsm opened 11 years ago

edwingsm commented 11 years ago

I use this library in my app . I will explain my scenario . My slide menu contains 10 items . For some menu items I call web services inside onStart() of fragments loaded on the click of menu items But it will provide a jerky effect on closing animation of slide menu . If there is no web service call it works fine and smooth .

Also on menu item click i clear the back stack of fragment manger .

I see this issue with only the fragments using web services .Can you tell me what was wrong with my implementation

doridori commented 11 years ago

its most likely because your web service call are a) on the main thread or b) starting up worker threads in an enviroment that can only really have one thread executing at a time so the ui thread does not have as much processor time as it needs to remain smooth - if its B just delay you web service call until the draw has animated shut :)

edwingsm commented 11 years ago

Well i calling my web service in a separate thread other than ui thread . I will try to go with your second suggestion

doridori commented 11 years ago

yes - i am in fact doing the exact same thing today - will let you know how i get on

doridori commented 11 years ago

from the official sliding drawer docs

"DrawerLayout.DrawerListener can be used to monitor the state and motion of drawer views. Avoid performing expensive operations such as layout during animation as it can cause stuttering; try to perform expensive operations during the STATE_IDLE state. DrawerLayout.SimpleDrawerListener offers default/no-op implementations of each callback method."

http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html

doridori commented 11 years ago

yeah half second delay works wonders :)