use of com.simplecity.amp_library.ui.views.FavoriteActionBarView in project Shuttle by timusus.
the class PlayerFragment method favoriteChanged.
@Override
public void favoriteChanged(boolean isFavorite) {
FavoriteActionBarView favoriteActionBarView = (FavoriteActionBarView) toolbar.getMenu().findItem(R.id.favorite).getActionView();
favoriteActionBarView.setIsFavorite(isFavorite);
}
use of com.simplecity.amp_library.ui.views.FavoriteActionBarView 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;
}
use of com.simplecity.amp_library.ui.views.FavoriteActionBarView in project Shuttle by timusus.
the class PlayerFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
isLandscape = ShuttleUtils.isLandscape(getContext());
unbinder = ButterKnife.bind(this, view);
toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());
toolbar.inflateMenu(R.menu.menu_now_playing);
if (CastManager.isCastAvailable(getContext(), settingsManager)) {
MenuItem menuItem = CastButtonFactory.setUpMediaRouteButton(getContext(), toolbar.getMenu(), R.id.media_route_menu_item);
menuItem.setVisible(true);
}
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(() -> {
presenter.togglePlayback();
return Unit.INSTANCE;
}));
}
if (repeatButton != null) {
repeatButton.setOnClickListener(v -> presenter.toggleRepeat());
repeatButton.setTag(":aesthetic_ignore");
}
if (shuffleButton != null) {
shuffleButton.setOnClickListener(v -> presenter.toggleShuffle());
shuffleButton.setTag(":aesthetic_ignore");
}
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(false));
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();
}
getAestheticColorSetDisposable().take(1).subscribe(this::invalidateColors, error -> {
// Nothing to do
});
presenter.bindView(this);
}
use of com.simplecity.amp_library.ui.views.FavoriteActionBarView in project Shuttle by timusus.
the class PlayerFragment method favoriteChanged.
@Override
public void favoriteChanged(boolean isFavorite) {
FavoriteActionBarView favoriteActionBarView = (FavoriteActionBarView) toolbar.getMenu().findItem(R.id.favorite).getActionView();
favoriteActionBarView.setIsFavorite(isFavorite);
}
Aggregations