diff --git a/app/src/main/java/org/ntlab/amaryllis/client/voiceservice/PlayListManager.java b/app/src/main/java/org/ntlab/amaryllis/client/voiceservice/PlayListManager.java index b7fdd22..32bc7c9 100644 --- a/app/src/main/java/org/ntlab/amaryllis/client/voiceservice/PlayListManager.java +++ b/app/src/main/java/org/ntlab/amaryllis/client/voiceservice/PlayListManager.java @@ -1,18 +1,38 @@ package org.ntlab.amaryllis.client.voiceservice; -import android.location.Location; - import java.util.ArrayList; public class PlayListManager { - - public void addVoiceMemos(ArrayList voicememo, Location location){ + int index = 0; + ArrayList playlist = new ArrayList<>(); + ArrayList unplayedlist = new ArrayList<>(); + //範囲内にある全てのvoicememoのリストを作成 + public void addVoiceMemos(ArrayList voicememos){ + for(int i = 0;i < voicememos.size(); i++) { + boolean exist = false; + for(int j = 0;j < playlist.size(); j++){ + if(voicememos.get(i).getVid().equals(playlist.get(j).getVid())) + exist = true; + } + if(exist = false) + playlist.add(voicememos.get(i)); + } } - public void getPlayList(){ + //範囲内にある全てのvoicememoのリスト + public ArrayList getPlayList(){ + return playlist; } - - public void getUnplayed(){ + //まだ聞いていないvoicememoのリスト + public ArrayList getUnplayedList(){ + //毎回リストを返すのか? + unplayedlist.clear(); + for(int i = index; i < playlist.size(); i++){ + unplayedlist.add(playlist.get(i)); + } + return unplayedlist; } - + public void next(){ + index++; + } }