use of com.simplecityapps.recyclerview_fastscroll.interfaces.OnFastScrollStateChangeListener in project Shuttle by timusus.
the class QueueFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_queue, container, false);
header = rootView.findViewById(R.id.header);
if (ShuttleUtils.isLandscape() || ShuttleUtils.isTablet()) {
header.setVisibility(View.GONE);
} else {
header.setVisibility(View.VISIBLE);
}
lineTwo = (TextView) rootView.findViewById(R.id.line2);
recyclerView = (ScrollBlockingRecyclerView) rootView.findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setRecyclerListener(this);
recyclerView.setAdapter(songAdapter);
recyclerView.setStateChangeListener(new OnFastScrollStateChangeListener() {
@Override
public void onFastScrollStart() {
recyclerView.setBlockScroll(false);
}
@Override
public void onFastScrollStop() {
recyclerView.setBlockScroll(true);
}
});
itemTouchHelper = new ItemTouchHelper(new ItemTouchHelperCallback((fromPosition, toPosition) -> {
songAdapter.moveItem(fromPosition, toPosition);
}, (fromPosition, toPosition) -> {
MusicUtils.moveQueueItem(fromPosition, toPosition);
recyclerView.setBlockScroll(true);
}, () -> {
//We've finished our drag event. Allow the sliding up panel to intercept touch events
recyclerView.setBlockScroll(true);
}));
itemTouchHelper.attachToRecyclerView(recyclerView);
themeUIComponents();
updateTrackInfo();
return rootView;
}
Aggregations