|
@ -1,7 +1,21 @@ |
|
|
package device; |
|
|
package device; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
public class RadioPlayer implements Device { |
|
|
public class RadioPlayer implements Device { |
|
|
|
|
|
|
|
|
|
|
|
public RadioPlayer() { |
|
|
|
|
|
super(); |
|
|
|
|
|
Playlist.add("Radio YouFM"); |
|
|
|
|
|
Playlist.add("Radio Teddy"); |
|
|
|
|
|
Playlist.add("Radio MegaHits"); |
|
|
|
|
|
playTrack=Playlist.get(0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ArrayList<String> Playlist=new ArrayList<String>(); |
|
|
|
|
|
int Lautstaerke = 0; |
|
|
|
|
|
String playTrack=""; |
|
|
|
|
|
|
|
|
public void setLautstaerke(int lautstaerke) { |
|
|
public void setLautstaerke(int lautstaerke) { |
|
|
Lautstaerke = lautstaerke; |
|
|
Lautstaerke = lautstaerke; |
|
|
} |
|
|
} |
|
@ -10,7 +24,7 @@ public class RadioPlayer implements Device { |
|
|
return Lautstaerke; |
|
|
return Lautstaerke; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int Lautstaerke = 0; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void louder() { |
|
|
public void louder() { |
|
|
if(Lautstaerke < 100) { |
|
|
if(Lautstaerke < 100) { |
|
@ -35,12 +49,17 @@ public class RadioPlayer implements Device { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void next() { |
|
|
public void next() { |
|
|
|
|
|
|
|
|
|
|
|
int currentIndex=Playlist.indexOf(playTrack); |
|
|
|
|
|
int nextIndex=(currentIndex+1)%Playlist.size(); |
|
|
|
|
|
playTrack=Playlist.get(nextIndex); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void prev() { |
|
|
public void prev() { |
|
|
|
|
|
|
|
|
|
|
|
int currentIndex=Playlist.indexOf(playTrack); |
|
|
|
|
|
int nextIndex=Playlist.size()-1; |
|
|
|
|
|
if(currentIndex!=0){nextIndex=(currentIndex-1);} |
|
|
|
|
|
playTrack=Playlist.get(nextIndex); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|