rename isBuffering method and fix some analyzer warnings

This commit is contained in:
dkanada 2021-03-09 01:29:39 +09:00
commit eb6fdc649d
7 changed files with 13 additions and 13 deletions

View file

@ -90,7 +90,7 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
@Override
public void onUpdateProgressViews(int progress, int total) {
binding.progressBar.setIndeterminate(MusicPlayerRemote.isBuffering());
binding.progressBar.setIndeterminate(MusicPlayerRemote.isLoading());
binding.progressBar.setMax(total);
binding.progressBar.setProgress(progress);
}

View file

@ -85,7 +85,7 @@ public class PlayerAlbumCoverFragment extends AbsMusicServiceFragment implements
}
private void updatePlayingQueue() {
binding.playerAlbumCoverViewPager.setAdapter(new AlbumCoverPagerAdapter(getFragmentManager(), MusicPlayerRemote.getPlayingQueue()));
binding.playerAlbumCoverViewPager.setAdapter(new AlbumCoverPagerAdapter(getParentFragmentManager(), MusicPlayerRemote.getPlayingQueue()));
binding.playerAlbumCoverViewPager.setCurrentItem(MusicPlayerRemote.getPosition());
onPageSelected(MusicPlayerRemote.getPosition());
}

View file

@ -418,7 +418,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
MusicPlayerRemote.removeFromQueue(MusicPlayerRemote.getPosition());
return true;
case R.id.action_share:
SongShareDialog.create(getSong()).show(fragment.getFragmentManager(), "SONG_SHARE_DIALOG");
SongShareDialog.create(getSong()).show(fragment.getParentFragmentManager(), "SONG_SHARE_DIALOG");
return true;
}

View file

@ -233,7 +233,7 @@ public class CardPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
@Override
public void onUpdateProgressViews(int progress, int total) {
binding.playerBufferingIndicator.setVisibility(MusicPlayerRemote.isBuffering() ? View.VISIBLE : View.GONE);
binding.playerBufferingIndicator.setVisibility(MusicPlayerRemote.isLoading() ? View.VISIBLE : View.GONE);
binding.playerProgressSlider.setMax(total);
binding.playerProgressSlider.setProgress(progress);

View file

@ -190,7 +190,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
private void setUpPlayerToolbar() {
binding.playerToolbar.inflateMenu(R.menu.menu_player);
binding.playerToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp);
binding.playerToolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());
binding.playerToolbar.setNavigationOnClickListener(v -> requireActivity().onBackPressed());
binding.playerToolbar.setOnMenuItemClickListener(this);
}
@ -221,8 +221,8 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
private void updateIsFavorite() {
boolean favorite = MusicPlayerRemote.getCurrentSong().favorite;
int res = favorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
int color = ToolbarContentTintHelper.toolbarContentColor(getActivity(), Color.TRANSPARENT);
Drawable drawable = ImageUtil.getTintedVectorDrawable(getActivity(), res, color);
int color = ToolbarContentTintHelper.toolbarContentColor(requireActivity(), Color.TRANSPARENT);
Drawable drawable = ImageUtil.getTintedVectorDrawable(requireActivity(), res, color);
binding.playerToolbar.getMenu().findItem(R.id.action_toggle_favorite)
.setIcon(drawable)
.setTitle(favorite ? getString(R.string.action_remove_from_favorites) : getString(R.string.action_add_to_favorites));
@ -343,7 +343,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(backgroundAnimator, statusBarAnimator);
if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
if (!ATHUtil.isWindowBackgroundDark(fragment.requireActivity())) {
int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
Animator subHeaderAnimator = ViewUtil.createTextColorTransition(binding.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
@ -356,8 +356,8 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
@Override
public void animateColorChange(int newColor) {
if (ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
binding.playerQueueSubHeader.setTextColor(ThemeStore.textColorSecondary(fragment.getActivity()));
if (ATHUtil.isWindowBackgroundDark(fragment.requireActivity())) {
binding.playerQueueSubHeader.setTextColor(ThemeStore.textColorSecondary(fragment.requireActivity()));
}
}
}
@ -405,7 +405,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
MusicPlayerRemote.removeFromQueue(MusicPlayerRemote.getPosition());
return true;
case R.id.action_share:
SongShareDialog.create(getSong()).show(fragment.getFragmentManager(), "SONG_SHARE_DIALOG");
SongShareDialog.create(getSong()).show(fragment.getParentFragmentManager(), "SONG_SHARE_DIALOG");
return true;
}

View file

@ -288,7 +288,7 @@ public class FlatPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
@Override
public void onUpdateProgressViews(int progress, int total) {
binding.playerBufferingIndicator.setVisibility(MusicPlayerRemote.isBuffering() ? View.VISIBLE : View.GONE);
binding.playerBufferingIndicator.setVisibility(MusicPlayerRemote.isLoading() ? View.VISIBLE : View.GONE);
binding.playerProgressSlider.setMax(total);
binding.playerProgressSlider.setProgress(progress);

View file

@ -136,7 +136,7 @@ public class MusicPlayerRemote {
return musicService != null && musicService.isPlaying();
}
public static boolean isBuffering() {
public static boolean isLoading() {
return musicService != null && musicService.isLoading();
}