public void startNewSong() { try { // PreLogUtil.put(Memory.getInfo(), this, CommonStrings.getInstance().PROCESS); ResourceUtil.getInstance().getContext().stopService(this.currentIntent); this.currentSongSound = (Sound) BasicArrayListUtil.getInstance().getRandom(this.songList); long duration = this.currentSongSound.getDuration(); // 18000; // this.currentSongSound.getPlayer().getDuration(); PreLogUtil.put( new StringBuilder() .append(PLAY) .append(this.currentSongSound.getResource()) .append(FOR) .append(duration) .toString(), this, CommonStrings.getInstance().PROCESS); this.timeDelayHelper.setDelay((int) duration); this.currentIntent.putExtra( MusicStrings.getInstance().SONG_EXTRA, ResourceUtil.getInstance().getResourceId(this.currentSongSound.getResource()).intValue()); ResourceUtil.getInstance().getContext().startService(this.currentIntent); } catch (Exception e) { String resource = StringUtil.getInstance().EMPTY_STRING; if (currentSongSound != null) { resource = currentSongSound.getResource(); } PreLogUtil.put( CommonStrings.getInstance().EXCEPTION_LABEL + resource, this, CommonStrings.getInstance().PROCESS, e); } }
public MusicManager(Class musicServiceClass, BasicArrayList songList) { currentIntent = new Intent(ResourceUtil.getInstance().getContext(), musicServiceClass); this.songList = songList; }
public void stop() throws Exception { ResourceUtil.getInstance().getContext().stopService(this.currentIntent); }