-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSpootifyMenu.java
More file actions
51 lines (38 loc) · 1.55 KB
/
Copy pathSpootifyMenu.java
File metadata and controls
51 lines (38 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.util.HashMap;
import java.util.Map;
public class SpootifyMenu {
private Map<String, SpootifyPlaylist> playlists;
public Map<String, SpootifyPlaylist> getPlaylists(){
return playlists;
}
public SpootifyMenu(){
playlists = new HashMap<String, SpootifyPlaylist>();
addPlaylist("library");
}
public void addPlaylist(String playlistTitle){
if(!playlistExists(playlistTitle))
playlists.put(playlistTitle, new SpootifyPlaylist(playlistTitle));
}
public SpootifyPlaylist getPlaylist(String playlistTitle){
return playlists.get(playlistTitle);
}
public void removePlaylist(String playlistTitle){
playlists.remove(playlistTitle);
}
public boolean playlistExists(String playlistTitle){
return playlists.containsKey(playlistTitle);
}
public void addContent(String playlistTitle, SpootifyContent content){
getPlaylist(playlistTitle).addContent(content);
}
public void removeContent(String playlistTitle, SpootifyContent content){
getPlaylist(playlistTitle).removeContent(content);
}
public String getContentDescription(SpootifyContent content){
String contentClass = "";
if(content.getClass() == SpootifyMusic.class) contentClass = "Música";
if(content.getClass() == SpootifyPodcast.class) contentClass = "Podcast";
if(content.getClass() == SpootifyAudiobook.class) contentClass = "Audiobook";
return String.format("%s - %s", contentClass, content.toString());
}
}