Improve gallery list refresh

This commit is contained in:
seven332 committed 2015-05-10 16:12:48 +08:00
1 parent fc03b967b3
commit 0222dcd727
2 files changed
+17 -1

No files matched your search

@@ -287,7 +287,7 @@ public class GalleryListScene extends Scene implements SearchBar.Helper,
}
} else if (v == mRefreshFab) {
toggleFabLayout();
mGalleryListHelper.goToTopAndRefresh();
mGalleryListHelper.refreshWithSameSearch();
} else if (v == mGoToFab) {
toggleFabLayout();
// TODO do go to
@@ -405,6 +405,22 @@ public class ContentLayout extends FrameLayout {
doRefresh();
}
public void refreshWithSameSearch() {
if (mViewTransition.getShownViewIndex() == 0) {
// Go to top
mRecyclerView.stopScroll();
mLayoutManager.smoothScrollToPosition(mRecyclerView, null, 0);
// Show header refresh
mRefreshLayout.setFooterRefreshing(false);
mRefreshLayout.setHeaderRefreshing(true);
// Do refresh
doRefresh();
} else {
showProgressBar();
doRefresh();
}
}
/**
* Only work when data is loaded
*/