mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-06-06 10:33:05 +03:00
Fix a number of warnings
This commit is contained in:
parent
e8fe006b1a
commit
e0eb2aaf61
@ -63,10 +63,10 @@ public class NowPlayingFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
playButton = (ImageView) view.findViewById(R.id.now_playing_control_play);
|
playButton = view.findViewById(R.id.now_playing_control_play);
|
||||||
nowPlayingAlbumArtImage = (ImageView) view.findViewById(R.id.now_playing_image);
|
nowPlayingAlbumArtImage = view.findViewById(R.id.now_playing_image);
|
||||||
nowPlayingTrack = (TextView) view.findViewById(R.id.now_playing_trackname);
|
nowPlayingTrack = view.findViewById(R.id.now_playing_trackname);
|
||||||
nowPlayingArtist = (TextView) view.findViewById(R.id.now_playing_artist);
|
nowPlayingArtist = view.findViewById(R.id.now_playing_artist);
|
||||||
|
|
||||||
nowPlayingEventListener = new NowPlayingEventListener() {
|
nowPlayingEventListener = new NowPlayingEventListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -74,7 +74,7 @@ public class NowPlayingFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onHideNowPlaying() { }
|
public void onHideNowPlaying() { }
|
||||||
@Override
|
@Override
|
||||||
public void onShowNowPlaying() { Update(); }
|
public void onShowNowPlaying() { update(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
nowPlayingEventDistributor.getValue().subscribe(nowPlayingEventListener);
|
nowPlayingEventDistributor.getValue().subscribe(nowPlayingEventListener);
|
||||||
@ -83,7 +83,7 @@ public class NowPlayingFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,7 +92,7 @@ public class NowPlayingFragment extends Fragment {
|
|||||||
nowPlayingEventDistributor.getValue().unsubscribe(nowPlayingEventListener);
|
nowPlayingEventDistributor.getValue().unsubscribe(nowPlayingEventListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update() {
|
private void update() {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PlayerState playerState = mediaPlayerControllerLazy.getValue().getPlayerState();
|
PlayerState playerState = mediaPlayerControllerLazy.getValue().getPlayerState();
|
||||||
@ -112,45 +112,28 @@ public class NowPlayingFragment extends Fragment {
|
|||||||
nowPlayingTrack.setText(title);
|
nowPlayingTrack.setText(title);
|
||||||
nowPlayingArtist.setText(artist);
|
nowPlayingArtist.setText(artist);
|
||||||
|
|
||||||
nowPlayingAlbumArtImage.setOnClickListener(new View.OnClickListener() {
|
nowPlayingAlbumArtImage.setOnClickListener(v -> {
|
||||||
@Override
|
Bundle bundle = new Bundle();
|
||||||
public void onClick(View v) {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
|
|
||||||
if (Util.getShouldUseId3Tags(getContext())) {
|
if (Util.getShouldUseId3Tags(getContext())) {
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, true);
|
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, true);
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, song.getAlbumId());
|
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, song.getAlbumId());
|
||||||
} else {
|
} else {
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false);
|
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false);
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, song.getParent());
|
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, song.getParent());
|
||||||
}
|
|
||||||
|
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, song.getAlbum());
|
|
||||||
Navigation.findNavController(getView()).navigate(R.id.selectAlbumFragment, bundle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, song.getAlbum());
|
||||||
|
Navigation.findNavController(getView()).navigate(R.id.selectAlbumFragment, bundle);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getView().setOnTouchListener(new View.OnTouchListener() {
|
getView().setOnTouchListener((v, event) -> handleOnTouch(event));
|
||||||
@Override
|
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
|
||||||
return handleOnTouch(event);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// This empty onClickListener is necessary for the onTouchListener to work
|
// This empty onClickListener is necessary for the onTouchListener to work
|
||||||
getView().setOnClickListener(new View.OnClickListener() {
|
getView().setOnClickListener(v -> {});
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
playButton.setOnClickListener(new View.OnClickListener() {
|
playButton.setOnClickListener(v -> mediaPlayerControllerLazy.getValue().togglePlayPause());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mediaPlayerControllerLazy.getValue().togglePlayPause();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
catch (Exception x) {
|
catch (Exception x) {
|
||||||
Timber.w(x, "Failed to get notification cover art");
|
Timber.w(x, "Failed to get notification cover art");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user