Aspsine / IRecyclerView

IRecyclerView is a custom RecyclerView that supports pull-to-refresh, pull-to-loadmore, customize refresh header and loadmore footer, add header views and footer views.
729 stars 146 forks source link

setLoadMoreEnabled(false) doesn't hide the footer loading view #21

Closed jayrambhia closed 8 years ago

jayrambhia commented 8 years ago

As mentioned in the title, setLoadMoreEnabled(fasle) doesn't hide the already existing footer loader.

<com.aspsine.irecyclerview.IRecyclerView
    android:id="@+id/recyclerview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:loadMoreEnabled="true"
    app:loadMoreFooterLayout="@layout/loader_search_item_layout"
    app:refreshEnabled="true"
    app:refreshHeaderLayout="@layout/irecyclerview_header_item_layout"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

This works fine with the header and footer. But let's say I don't have any new data and don't want the user to see load more footer, so I try to hide it by setLoadMoreEnabled(false) but this just works with the listener. I don't get any more events but the view is still there. I tried setLoadMoreFooterView(null) but that also gave me an error.

Even in this scenario, it shows footer loading view,

<com.aspsine.irecyclerview.IRecyclerView
    android:id="@+id/recyclerview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:loadMoreEnabled="false"
    app:loadMoreFooterLayout="@layout/loader_search_item_layout"
    app:refreshEnabled="true"
    app:refreshHeaderLayout="@layout/irecyclerview_header_item_layout"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
Aspsine commented 8 years ago

Sorry for misleading apis.

LoadMoreFooterView loadMoreFooterView = (LoadMoreFooterView) iRecyclerView.getLoadMoreFooterView();
// if you are using LoadMoreFooterView in the app module
loadMoreFooterView.setStatus(LoadMoreFooterView.Status.GONE)

// if you are using a custom load more footer view
// loadMoreFooterView.setVisibility(View.GONE);

Please checkout the demo code here:

https://github.com/Aspsine/IRecyclerView/blob/master/app/src/main/java/com/aspsine/irecyclerview/demo/ui/activity/MainActivity.java

and here:

https://github.com/Aspsine/IRecyclerView/blob/master/app/src/main/java/com/aspsine/irecyclerview/demo/ui/widget/footer/LoadMoreFooterView.java

jayrambhia commented 8 years ago

Thanks.