Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issues due to ToolbarLayout #13

Open
Maradox opened this issue Feb 27, 2016 · 7 comments
Open

Performance issues due to ToolbarLayout #13

Maradox opened this issue Feb 27, 2016 · 7 comments

Comments

@Maradox
Copy link

Maradox commented Feb 27, 2016

Today I discovered performance issues regarding the library (bad scrolling-performance in lists, ripple highlighting freezes etc).

Without the FABToolbar the issues are gone. I digged deeper and discovered that if I remove only the toolbarLayout from my View-Hierarchy it works as well.

Thus I guess it has to do with toolbarLayout.getViewTreeObserver().addOnGlobalLayoutListener which is never removed.

@fafaldo-zz
Copy link
Owner

Hmm, that ViewTreeObserver was introduced to listen to toolbar's height changes so I can't just remove it. But I suppose it really is called too frequently. Can you try importing the lib as module and moving that piece of code inside
toolbarLayout.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { if(top != oldTop || bottom != oldBottom) { <listener code here...> } } }

If that solves your performance issues I will apply that as a new solution in the code.

@Maradox
Copy link
Author

Maradox commented Feb 28, 2016

It works.
But note that in the case onLayout is called multiple times, several OnLayoutChangeListener are registered and never unregistered.

@fafaldo-zz
Copy link
Owner

Initialization process is done only once:
if(!isInit) { return; }
So the listener should be registered only once ;)

@Maradox
Copy link
Author

Maradox commented Feb 28, 2016

Oh sorry, overlooked that one.

@Maradox
Copy link
Author

Maradox commented Mar 5, 2016

Do you have an ETA when this fix will be deployed?

@fafaldo-zz
Copy link
Owner

I'm sorry, I am really busy at work recently. I will do it by 11.03 (Friday).

@Maradox
Copy link
Author

Maradox commented Mar 10, 2016

No problem. I added a pull-request for the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants