cymcsg / UltimateRecyclerView

A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.
Apache License 2.0
7.22k stars 1.43k forks source link

Method .setRefreshing(true) is not working when init UltimateRecyclerView #192

Closed DenisMondon closed 9 years ago

DenisMondon commented 9 years ago

Hi,

When the UltimateRecyclerView is initialized in onCreateView, I write this:

mListView = (UltimateRecyclerView) view.findViewById(R.id.fragment_list_view_pageable_list);
mListView.setRefreshing(true);
AsyncTask.execute...

But the SwipeRefreshLayout is not displayed. How can I show it during the asynctask?

Thanks. Denis

kientux commented 9 years ago

This is a bug of Android SwipeRefreshLayout. UltimateRecyclerView only call setRefreshing(boolean) method of SwipeRefreshLayout.

If you need to show indicator initially, you must use this:

ultimateRecyclerView.post(new Runnable() {
    @Override
    public void run() {
        ultimateRecyclerView.setRefreshing(true);
    }
});
DenisMondon commented 9 years ago

Thank you! It works perfectly!