Browse Source

Changes in the Structure if device.usbPlayer , USB_Stick.java was added and changes in the UsbPlayer.java

feature-pr-USB-otherTests
sahar 3 years ago
parent
commit
85e3d47217
  1. 41
      src/main/java/device/usbPlayer/USB_Stick.java
  2. 17
      src/main/java/device/usbPlayer/UsbPlayer.java

41
src/main/java/device/usbPlayer/USB_Stick.java

@ -0,0 +1,41 @@
package device.usbPlayer;
import java.util.ArrayList;
public class USB_Stick {
public ArrayList<ArrayList<String>> albums = new ArrayList<>();
USB_Stick() {
ArrayList<String> a1 = new ArrayList<String>();
a1.add("Musik 01.mp3");
a1.add("Musik 02.mp3");
a1.add("Musik 03.mp3");
albums.add(0,a1);
ArrayList<String> a2 = new ArrayList<String>();
a2.add("File 01.txt");
a2.add("File 01.txt");
a2.add("File 01.txt");
albums.add(1,a2);
ArrayList<String> a3 = new ArrayList<String>();
a3.add("Photo 01.gif");
a3.add("Photo 02.gif");
a3.add("Photo 03.gif");
albums.add(2,a3);
ArrayList<String> a4 = new ArrayList<String>();
a4.add("Music 01.mp3");
a4.add("Music 02.mp3");
a4.add("Music 03.mp3");
albums.add(3,a4);
}
public ArrayList<String> getAlbum(){
return albums.get(0);
}
}

17
src/main/java/device/usbPlayer/UsbPlayer.java

@ -6,13 +6,14 @@ import java.util.ArrayList;
public class UsbPlayer implements Device {
private ArrayList<String> Playlist = new ArrayList<String>();
private String playTrack = "";
private Boolean isConnected;
private Boolean isDefect;
int Lautstaerke = 0;
public USB_Stick USBDrive = new USB_Stick();
//*********setters und getters********
public ArrayList<String> getPlaylist() {
return Playlist;
}
@ -44,8 +45,8 @@ public class UsbPlayer implements Device {
public void setPlayTrack(String playTrack) {
if (this.findSong(playTrack) != -1) {
this.playTrack = playTrack;}
else System.out.println("The Song does not exist in the Albume");
this.playTrack = playTrack;
} else System.out.println("The Song does not exist in the Albume");
}
@ -64,12 +65,15 @@ public class UsbPlayer implements Device {
super();
isDefect = false;
isConnected = true;
Playlist.add("Musik 01.mp3");
/*Playlist.add("Musik 01.mp3");
Playlist.add("Musik 02.mp3");
Playlist.add("Musik 03.mp3");
playTrack = Playlist.get(0);*/
Playlist = USBDrive.getAlbum();
playTrack = Playlist.get(0);
}
//**********search method*************
public boolean isAllAudio() {
@ -87,6 +91,8 @@ public class UsbPlayer implements Device {
}
return flag;
}
//**********search method*************
@Override
public void quieter() {
@ -212,8 +218,7 @@ public class UsbPlayer implements Device {
if (findSong(songName) != -1) {
playTrack = getPlaylist().get(findSong(songName));//songName;
return true;
}
else
} else
//playTrack = songName;
return false;
}

Loading…
Cancel
Save