refactor some code to fix ide warnings
This commit is contained in:
parent
be3dd8dd7e
commit
376332bed9
5 changed files with 28 additions and 28 deletions
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implemen
|
|||
private Callbacks callbacks;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
try {
|
||||
callbacks = (Callbacks) context;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class PlayerAlbumCoverFragment extends AbsMusicServiceFragment implements
|
|||
callbacks.onToolbarToggled();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onSingleTapConfirmed(e);
|
||||
}
|
||||
});
|
||||
|
|
@ -122,8 +123,8 @@ public class PlayerAlbumCoverFragment extends AbsMusicServiceFragment implements
|
|||
binding.playerFavoriteIcon.setScaleX(0f);
|
||||
binding.playerFavoriteIcon.setScaleY(0f);
|
||||
binding.playerFavoriteIcon.setVisibility(View.VISIBLE);
|
||||
binding.playerFavoriteIcon.setPivotX(binding.playerFavoriteIcon.getWidth() / 2);
|
||||
binding.playerFavoriteIcon.setPivotY(binding.playerFavoriteIcon.getHeight() / 2);
|
||||
binding.playerFavoriteIcon.setPivotX(binding.playerFavoriteIcon.getWidth() / 2f);
|
||||
binding.playerFavoriteIcon.setPivotY(binding.playerFavoriteIcon.getHeight() / 2f);
|
||||
|
||||
binding.playerFavoriteIcon.animate()
|
||||
.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME / 2)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class CardPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setUpMusicControllers();
|
||||
updateProgressTextColor();
|
||||
|
|
@ -97,11 +97,11 @@ public class CardPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
|
||||
public void setDark(boolean dark) {
|
||||
if (dark) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(requireActivity(), true);
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(requireActivity(), true);
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(requireActivity(), false);
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(requireActivity(), false);
|
||||
}
|
||||
|
||||
updateRepeatState();
|
||||
|
|
@ -114,16 +114,14 @@ public class CardPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
final int fabColor = Color.WHITE;
|
||||
TintHelper.setTintAuto(binding.playerPlayPauseFab, fabColor, true);
|
||||
|
||||
playerFabPlayPauseDrawable = new PlayPauseDrawable(getActivity());
|
||||
playerFabPlayPauseDrawable = new PlayPauseDrawable(requireActivity());
|
||||
|
||||
binding.playerPlayPauseFab.setImageDrawable(playerFabPlayPauseDrawable); // Note: set the drawable AFTER TintHelper.setTintAuto() was called
|
||||
binding.playerPlayPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
|
||||
binding.playerPlayPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(requireContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
|
||||
binding.playerPlayPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
|
||||
binding.playerPlayPauseFab.post(() -> {
|
||||
if (binding.playerPlayPauseFab != null) {
|
||||
binding.playerPlayPauseFab.setPivotX(binding.playerPlayPauseFab.getWidth() / 2);
|
||||
binding.playerPlayPauseFab.setPivotY(binding.playerPlayPauseFab.getHeight() / 2);
|
||||
}
|
||||
binding.playerPlayPauseFab.setPivotX(binding.playerPlayPauseFab.getWidth() / 2f);
|
||||
binding.playerPlayPauseFab.setPivotY(binding.playerPlayPauseFab.getHeight() / 2f);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +148,7 @@ public class CardPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
}
|
||||
|
||||
private void updateProgressTextColor() {
|
||||
int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
|
||||
int color = MaterialValueHelper.getPrimaryTextColor(requireContext(), false);
|
||||
binding.playerSongTotalTime.setTextColor(color);
|
||||
binding.playerSongCurrentProgress.setTextColor(color);
|
||||
}
|
||||
|
|
@ -212,7 +210,7 @@ public class CardPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
}
|
||||
|
||||
private void setUpProgressSlider() {
|
||||
int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
|
||||
int color = MaterialValueHelper.getPrimaryTextColor(requireContext(), false);
|
||||
binding.playerProgressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
binding.playerProgressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);
|
||||
|
||||
|
|
|
|||
|
|
@ -105,11 +105,11 @@ public class FlatPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
|
||||
public void setDark(boolean dark) {
|
||||
if (dark) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(requireActivity(), true);
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(requireActivity(), true);
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(requireActivity(), false);
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(requireActivity(), false);
|
||||
}
|
||||
|
||||
updateRepeatState();
|
||||
|
|
@ -120,13 +120,13 @@ public class FlatPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
}
|
||||
|
||||
private void setUpPlayPauseButton() {
|
||||
playPauseDrawable = new PlayPauseDrawable(getActivity());
|
||||
playPauseDrawable = new PlayPauseDrawable(requireActivity());
|
||||
binding.playerPlayPauseButton.setImageDrawable(playPauseDrawable);
|
||||
updatePlayPauseColor();
|
||||
binding.playerPlayPauseButton.setOnClickListener(new PlayPauseButtonOnClickHandler());
|
||||
binding.playerPlayPauseButton.post(() -> {
|
||||
binding.playerPlayPauseButton.setPivotX(binding.playerPlayPauseButton.getWidth() / 2);
|
||||
binding.playerPlayPauseButton.setPivotY(binding.playerPlayPauseButton.getHeight() / 2);
|
||||
binding.playerPlayPauseButton.setPivotX(binding.playerPlayPauseButton.getWidth() / 2f);
|
||||
binding.playerPlayPauseButton.setPivotY(binding.playerPlayPauseButton.getHeight() / 2f);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ public class FlatPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
}
|
||||
|
||||
private void updateProgressTextColor() {
|
||||
int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
|
||||
int color = MaterialValueHelper.getPrimaryTextColor(requireContext(), false);
|
||||
binding.playerSongTotalTime.setTextColor(color);
|
||||
binding.playerSongCurrentProgress.setTextColor(color);
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ public class FlatPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
|||
}
|
||||
|
||||
private void setUpProgressSlider() {
|
||||
int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
|
||||
int color = MaterialValueHelper.getPrimaryTextColor(requireContext(), false);
|
||||
binding.playerProgressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
binding.playerProgressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import java.security.MessageDigest;
|
|||
public class BlurTransformation extends BitmapTransformation {
|
||||
public static final float DEFAULT_BLUR_RADIUS = 5f;
|
||||
|
||||
private Context context;
|
||||
private float blurRadius;
|
||||
private int sampling;
|
||||
private final Context context;
|
||||
private final float blurRadius;
|
||||
private final int sampling;
|
||||
|
||||
private BlurTransformation(Builder builder) {
|
||||
super();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue