use of com.simplecity.amp_library.utils.MusicUtils in project Shuttle by timusus.
the class QueueFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_queue, container, false);
unbinder = ButterKnife.bind(this, rootView);
toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());
toolbar.inflateMenu(R.menu.menu_queue);
SubMenu sub = toolbar.getMenu().addSubMenu(0, MusicUtils.Defs.ADD_TO_PLAYLIST, 1, R.string.save_as_playlist);
disposables.add(PlaylistUtils.createUpdatingPlaylistMenu(sub).subscribe());
toolbar.setOnMenuItemClickListener(toolbarListener);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setRecyclerListener(new RecyclerListener());
recyclerView.setAdapter(adapter);
itemTouchHelper = new ItemTouchHelper(new ItemTouchHelperCallback((fromPosition, toPosition) -> adapter.moveItem(fromPosition, toPosition), MusicUtils::moveQueueItem, () -> {
// Nothing to do
}));
itemTouchHelper.attachToRecyclerView(recyclerView);
disposables.add(Aesthetic.get(getContext()).colorPrimary().subscribe(color -> {
boolean isLight = Util.isColorLight(color);
lineOne.setTextColor(isLight ? Color.BLACK : Color.WHITE);
lineTwo.setTextColor(isLight ? Color.BLACK : Color.WHITE);
}));
// In landscape, we need to adjust the status bar's translation depending on the slide offset of the sheet
if (ShuttleUtils.isLandscape()) {
statusBarView.setTranslationY(ResourceUtils.toPixels(16));
disposables.add(multiSheetSlideEventRelay.getEvents().filter(multiSheetEvent -> multiSheetEvent.sheet == MultiSheetView.Sheet.SECOND).filter(multiSheetEvent -> multiSheetEvent.slideOffset >= 0).subscribe(multiSheetEvent -> {
statusBarView.setTranslationY((1 - multiSheetEvent.slideOffset) * ResourceUtils.toPixels(16));
}));
}
setupContextualToolbar();
queuePresenter = new QueuePresenter(requestManager, cabHelper);
return rootView;
}
Aggregations