Skip to content

Commit

Permalink
Merge pull request #137 from tobexyz/feat/issue117
Browse files Browse the repository at this point in the history
issue #117 fixed update trackinfo in music activity after resuming
  • Loading branch information
tobexyz authored Dec 21, 2024
2 parents 6737d67 + 2d7564d commit f364329
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions yaacc/src/main/java/de/yaacc/player/MusicPlayerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,37 +113,37 @@ protected void initialize() {
btnExit.setActivated(true);
}
btnPrev.setOnClickListener(v -> {
Player player1 = getPlayer();
if (player1 != null) {
player1.previous();
Player ply = getPlayer();
if (ply != null) {
ply.previous();
}

});
btnNext.setOnClickListener(v -> {
Player player12 = getPlayer();
if (player12 != null) {
player12.next();
Player ply = getPlayer();
if (ply != null) {
ply.next();
}

});
btnPlay.setOnClickListener(v -> {
Player player13 = getPlayer();
if (player13 != null) {
player13.play();
Player ply = getPlayer();
if (ply != null) {
ply.play();
}

});
btnPause.setOnClickListener(v -> {
Player player14 = getPlayer();
if (player14 != null) {
player14.pause();
Player ply = getPlayer();
if (ply != null) {
ply.pause();
}

});
btnStop.setOnClickListener(v -> {
Player player15 = getPlayer();
if (player15 != null) {
player15.stop();
Player ply = getPlayer();
if (ply != null) {
ply.stop();
}

});
Expand Down Expand Up @@ -199,6 +199,7 @@ protected void onRestart() {
this.bindService(new Intent(this, PlayerService.class),
this, Context.BIND_AUTO_CREATE);
updateTime = true;
setTrackInfo();
}

@Override
Expand All @@ -207,6 +208,7 @@ protected void onResume() {
this.bindService(new Intent(this, PlayerService.class),
this, Context.BIND_AUTO_CREATE);
updateTime = true;
setTrackInfo();
}

@Override
Expand All @@ -230,7 +232,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

private Player getPlayer() {
return playerService.getFirstCurrentPlayerOfType(LocalBackgoundMusicPlayer.class);
return playerService == null ? null : playerService.getFirstCurrentPlayerOfType(LocalBackgoundMusicPlayer.class);
}

@Override
Expand Down

0 comments on commit f364329

Please sign in to comment.