timusus / RecyclerView-FastScroll

A simple FastScroller for Android's RecyclerView
Other
1.39k stars 183 forks source link

Popup not showing #32

Closed Frechetta closed 8 years ago

Frechetta commented 8 years ago

I have a simple RecyclerView extending FastScrollRecyclerView whose adapter is a RecyclerView.Adapter implementing FastScrollRecyclerView.SectionedAdapter. The FastScroll thumb shows and works just fine, but the popup does not show when scrolling.

This is my RecyclerView XML:

<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
        android:id="@+id/track_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:fastScrollPopupBgColor="@color/colorAccent"
        app:fastScrollPopupTextColor="@android:color/primary_text_dark"
        app:fastScrollThumbColor="@color/colorAccent"
        app:fastScrollPopupBackgroundSize="88dp"
        app:fastScrollPopupTextSize="56sp"/>

And this is my getSectionName() method:

@NonNull
@Override
public String getSectionName(int position)
{
    if (position > 0) position--; // the 0th position is not a track

    return Character.toString(tracks.get(position).getTitle().charAt(0));
}

I am using an itemDecoration that separates the items by 2dp.

Frechetta commented 8 years ago

Update: The popup shows on one of my RecyclerView/Adapter setups. I'm working on comparing them to see what's different.

Edit: It works today, I don't know what did it, possibly just a clean and rebuild.

janswist commented 8 years ago

Frechetta, did You found out what was going wrong? I have the same issue - no popup is showing and I have set all xml attrs as You have done.

Frechetta commented 8 years ago

@janswist I never found the culprit. It appeared to fix itself after a clean and rebuild.

janswist commented 8 years ago

@Frechetta I have done cleaning and rebuild and still no change. I have Lollipop 5.1 - just can't put a finger on it. Maybe @timusus could help here.

timusus commented 8 years ago

I would suggest you fork this repo, make whatever changes necessary to replicate the issue and then link me to it. That way I can see what you're doing differently and I'll have a chance at figuring it out.

timusus commented 8 years ago

@janswist have you implemented getSectionName?

janswist commented 8 years ago

@timusus Yes, that's the first thing I checked. I even hardcoded String on return to be certain, but I think the problem is with popup - it's just not showning.

janswist commented 8 years ago

@timusus I just now read Your previous reply. I will fork it and then I will write here about the results.

janswist commented 8 years ago

@timusus As for now I just found that I used RecyclerView in my fragment instead of FastScrollRecyclerView, but still no results. Here is the code that I use when invoking:

if(mAdapter == null){
            mAdapter = new ContactListAdapter((BaseActivity) getActivity(), result);
        } else {
            mAdapter.updateData(result);
        }
        SectionedRecyclerViewAdapter.Section[] dummy = new SectionedRecyclerViewAdapter.Section[sections.size()];
        mSectionedAdapter = new SectionedRecyclerViewAdapter(
                getActivity(),R.layout.section, R.id.section_text, mAdapter);
        mSectionedAdapter.setSections(sections.toArray(dummy));

        contactsList.setAdapter(mSectionedAdapter);

mAdapter extends RealmRecyclerViewAdapter from Realm.io and SectionedRecyclerViewAdapter is just an add-on and I don't think it should make trouble, hence it's bound to the adapter.

timusus commented 8 years ago

Create a sample project replicating the issue and I'll take a look. Otherwise I don't know what's going on. I don't have enough info to even guess.

janswist commented 8 years ago

@timusus I created sample repo and added You as a collaborator :)