IndexableListView icon indicating copy to clipboard operation
IndexableListView copied to clipboard

dinamicly disable IndexScroller

Open vujadin23 opened this issue 12 years ago • 7 comments

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

vujadin23 avatar Jan 17 '13 12:01 vujadin23

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.

nahba avatar Aug 04 '13 15:08 nahba

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

Foivos-Stamopoulos avatar Sep 15 '15 15:09 Foivos-Stamopoulos

@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.

woozzu avatar Sep 16 '15 15:09 woozzu

@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!

Foivos-Stamopoulos avatar Sep 23 '15 14:09 Foivos-Stamopoulos

@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.

woozzu avatar Sep 25 '15 01:09 woozzu

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.

Foivos-Stamopoulos avatar Sep 30 '15 13:09 Foivos-Stamopoulos

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

woozzu avatar Oct 01 '15 06:10 woozzu