use of com.simplecity.amp_library.ui.views.PlayPauseView in project Shuttle by timusus.
the class PlayerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_player, container, false);
isLandscape = ShuttleUtils.isLandscape();
unbinder = ButterKnife.bind(this, rootView);
toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());
toolbar.inflateMenu(R.menu.menu_now_playing);
setupCastMenu(toolbar.getMenu());
MenuItem favoriteMenuItem = toolbar.getMenu().findItem(R.id.favorite);
FavoriteActionBarView menuActionView = (FavoriteActionBarView) favoriteMenuItem.getActionView();
menuActionView.setOnClickListener(v -> onMenuItemClick(favoriteMenuItem));
toolbar.setOnMenuItemClickListener(this);
if (playPauseView != null) {
playPauseView.setOnClickListener(v -> {
playPauseView.toggle();
playPauseView.postDelayed(() -> presenter.togglePlayback(), 200);
});
}
if (repeatButton != null) {
repeatButton.setOnClickListener(v -> presenter.toggleRepeat());
}
if (shuffleButton != null) {
shuffleButton.setOnClickListener(v -> presenter.toggleShuffle());
}
if (nextButton != null) {
nextButton.setOnClickListener(v -> presenter.skip());
nextButton.setRepeatListener((v, duration, repeatCount) -> presenter.scanForward(repeatCount, duration));
}
if (prevButton != null) {
prevButton.setOnClickListener(v -> presenter.prev(true));
prevButton.setRepeatListener((v, duration, repeatCount) -> presenter.scanBackward(repeatCount, duration));
}
if (seekBar != null) {
seekBar.setMax(1000);
}
if (savedInstanceState == null) {
getChildFragmentManager().beginTransaction().add(R.id.main_container, QueuePagerFragment.newInstance(), "QueuePagerFragment").commit();
}
return rootView;
}
Aggregations