|
@ -114,7 +114,7 @@ public class RadioPlayer implements Device { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void next() { |
|
|
public void next() { |
|
|
if (regionPlaylist.contains(playedStation)){ |
|
|
|
|
|
|
|
|
if (regionPlaylist.contains(playedStation)) { |
|
|
int currentIndex = regionPlaylist.indexOf(playedStation); |
|
|
int currentIndex = regionPlaylist.indexOf(playedStation); |
|
|
int nextIndex = (currentIndex + 1) % regionPlaylist.size(); |
|
|
int nextIndex = (currentIndex + 1) % regionPlaylist.size(); |
|
|
playedStation = regionPlaylist.get(nextIndex); |
|
|
playedStation = regionPlaylist.get(nextIndex); |
|
@ -183,7 +183,9 @@ public class RadioPlayer implements Device { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String saveStation() { |
|
|
public String saveStation() { |
|
|
|
|
|
if (savedPlaylist.contains(playedStation)) return "Station " + playedStation + " is already saved"; |
|
|
|
|
|
else |
|
|
savedPlaylist.add(playedStation); |
|
|
savedPlaylist.add(playedStation); |
|
|
return ""; |
|
|
|
|
|
|
|
|
return "Station " + playedStation + " is saved in your Station list"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |