Search in sources :

Example 1 with PlayPauseView

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;
}
Also used : MenuItem(android.view.MenuItem) FavoriteActionBarView(com.simplecity.amp_library.ui.views.FavoriteActionBarView) ImageView(android.widget.ImageView) FavoriteActionBarView(com.simplecity.amp_library.ui.views.FavoriteActionBarView) BindView(butterknife.BindView) View(android.view.View) PlayPauseView(com.simplecity.amp_library.ui.views.PlayPauseView) TextView(android.widget.TextView) SnowfallView(com.simplecity.amp_library.ui.views.SnowfallView) PlayerView(com.simplecity.amp_library.ui.views.PlayerView)

Aggregations

MenuItem (android.view.MenuItem)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 FavoriteActionBarView (com.simplecity.amp_library.ui.views.FavoriteActionBarView)1 PlayPauseView (com.simplecity.amp_library.ui.views.PlayPauseView)1 PlayerView (com.simplecity.amp_library.ui.views.PlayerView)1 SnowfallView (com.simplecity.amp_library.ui.views.SnowfallView)1