don't allow fast scrolling until data is available

fixes #4666
closes #4693
// FREEBIE
This commit is contained in:
Jake McGinty 2015-11-23 10:46:01 -08:00 committed by Moxie Marlinspike
parent 473e470883
commit d58f4d1232
2 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,7 @@
android:id="@+id/fast_scroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:visibility="gone"
android:layout_gravity="right"/>
</FrameLayout>

View File

@ -101,7 +101,6 @@ public class ContactSelectionListFragment extends Fragment
swipeRefresh = ViewUtil.findById(view, R.id.swipe_refresh);
fastScroller = ViewUtil.findById(view, R.id.fast_scroller);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
fastScroller.setRecyclerView(recyclerView);
swipeRefresh.setEnabled(getActivity().getIntent().getBooleanExtra(REFRESHABLE, true) &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN);
@ -163,11 +162,16 @@ public class ContactSelectionListFragment extends Fragment
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
((CursorRecyclerViewAdapter) recyclerView.getAdapter()).changeCursor(data);
emptyText.setText(R.string.contact_selection_group_activity__no_contacts);
if (recyclerView.getAdapter().getItemCount() > 20) {
fastScroller.setVisibility(View.VISIBLE);
fastScroller.setRecyclerView(recyclerView);
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
((CursorRecyclerViewAdapter) recyclerView.getAdapter()).changeCursor(null);
fastScroller.setVisibility(View.GONE);
}
private class ListClickListener implements ContactSelectionListAdapter.ItemClickListener {