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

dinamicly disable IndexScroller #4

Open
vujadin23 opened this issue Jan 17, 2013 · 7 comments
Open

dinamicly disable IndexScroller #4

vujadin23 opened this issue Jan 17, 2013 · 7 comments

Comments

@vujadin23
Copy link

I change adapter of listview, and a don't need IndexScroller on each.
How to disable or hide IndexScroller.

i've tired to setFastScrollEnabled, but only get NullPointerException

@nahba
Copy link

nahba commented Aug 4, 2013

Hi,

You can make method like this:

public void hideMyScroller() {
if (mScroller != null) {
mScroller.hide();
}
}

public void showMyScroller() {
if (mScroller != null) {
mScroller.show();
}
}

Ref Link: https://github.com/Abhan/ScrollableSideIndexer

Thanks.

@Foivos-Stamopoulos
Copy link

Hi @nahba ,
I tried this and it just hides the Alphabet, but when you scroll the listview, the Alphabet appears again. Is there another solution so that the Alphabet will not appear at all?

Thanks

@woozzu
Copy link
Owner

woozzu commented Sep 16, 2015

@lcsd Do you use the latest version? In that version, IndexScroller is only displayed when it is not null. When you call setFastScrollEnabled(false), IndexScroller becomes null. I'm sorry that I have no environment for Android development now. So, first check the version of your code.

@Foivos-Stamopoulos
Copy link

@woozzu Exactly, when you you call setFastScrollEnabled(false), IndexScroller becomes null. And then when you scroll the list, onInterceptTouchEvent(..) is invoked which calls mScroller.contains(ev.getX(), ev.getY()) where the mScroller is NULL, and the app crashes. Same thing happens in onTouchEvent(..).
So i think that in these functions mScroller value should be checked if is !=NULL, and then it seems to play ok.

Moreover when i call setFastScrollEnabled(true) to show again the Indexers, the object mIndexbarRect is NULL, so the app crashes again. Do you have something in mind about this?

Thank you in advance!

@woozzu
Copy link
Owner

woozzu commented Sep 25, 2015

@icsd It seems that you already know what to change in the code. Could you submit a pull request? When it comes to mIndexbarRect, onSizeChanged() of IndexScroller must be called when ListView creates a new IndexScroller.

@Foivos-Stamopoulos
Copy link

I don't have a complete overview of the whole project, otherwise I would do a pull request. About mIndexarRect, onSizeChanged() is not called from the System (if I call setFastScrollEnabled(true) to show again the Indexers), so i don't know what arguments to pass if I invoke it manually.

@woozzu
Copy link
Owner

woozzu commented Oct 1, 2015

@icsd w, h are the current width and height of listview, respectively. And you can ignore oldw and oldh.

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

4 participants