diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 7676dc5a..dcd9328a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,8 +2,8 @@ + a:versionCode="38" + a:versionName="1.2.0.11" > diff --git a/src/com/thejoshwa/ultrasonic/androidapp/activity/DownloadActivity.java b/src/com/thejoshwa/ultrasonic/androidapp/activity/DownloadActivity.java index 43ecd395..f837162b 100644 --- a/src/com/thejoshwa/ultrasonic/androidapp/activity/DownloadActivity.java +++ b/src/com/thejoshwa/ultrasonic/androidapp/activity/DownloadActivity.java @@ -370,7 +370,6 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi progressBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { - @Override public void onStopTrackingTouch(final SeekBar seekBar) { @@ -389,7 +388,6 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi onSliderProgressChanged(); } }.execute(); - } @Override @@ -677,7 +675,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi }; executorService = Executors.newSingleThreadScheduledExecutor(); - executorService.scheduleWithFixedDelay(runnable, 0L, 500L, TimeUnit.MILLISECONDS); + executorService.scheduleWithFixedDelay(runnable, 0L, 250L, TimeUnit.MILLISECONDS); if (downloadService != null && downloadService.getKeepScreenOn()) { @@ -864,11 +862,6 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi jukeboxOption.setEnabled(jukeboxAvailable); jukeboxOption.setVisible(jukeboxAvailable); - if (!jukeboxAvailable) - { - downloadService.setJukeboxEnabled(false); - } - if (downloadService.isJukeboxEnabled()) { jukeboxOption.setTitle(R.string.download_menu_jukebox_off); @@ -1140,18 +1133,20 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi private void onCurrentChanged() { - if (getDownloadService() == null) + DownloadService downloadService = getDownloadService(); + + if (downloadService == null) { return; } - currentPlaying = getDownloadService().getCurrentPlaying(); + currentPlaying = downloadService.getCurrentPlaying(); scrollToCurrent(); - long totalDuration = getDownloadService().getDownloadListDuration(); - long totalSongs = getDownloadService().getSongs().size(); - int currentSongIndex = getDownloadService().getCurrentPlayingIndex() + 1; + long totalDuration = downloadService.getDownloadListDuration(); + long totalSongs = downloadService.getSongs().size(); + int currentSongIndex = downloadService.getCurrentPlayingIndex() + 1; String duration = Util.formatTotalDuration(totalDuration); @@ -1183,7 +1178,9 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi private void onSliderProgressChanged() { - if (getDownloadService() == null || onProgressChangedTask != null) + DownloadService downloadService = getDownloadService(); + + if (downloadService == null || onProgressChangedTask != null) { return; } diff --git a/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java b/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java index ecddaacd..ebc1352e 100644 --- a/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java +++ b/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java @@ -1533,7 +1533,7 @@ public class DownloadServiceImpl extends Service implements DownloadService { if (percent == 100) { - mediaPlayer.setOnBufferingUpdateListener(null); + mp.setOnBufferingUpdateListener(null); } SeekBar progressBar = DownloadActivity.getProgressBar(); @@ -1705,7 +1705,15 @@ public class DownloadServiceImpl extends Service implements DownloadService { if (nextPlaying != null && nextPlayerState == PlayerState.PREPARED) { - playNext(); + if (!nextSetup) + { + playNext(); + } + else + { + nextSetup = false; + playNext(); + } } else { @@ -1720,7 +1728,7 @@ public class DownloadServiceImpl extends Service implements DownloadService if (downloadFile.isWorkDone()) { // Complete was called early even though file is fully buffered - Log.i(TAG, "Requesting restart from " + pos + " of " + duration); + Log.i(TAG, String.format("Requesting restart from %d of %d", pos, duration)); reset(); downloadFile.setPlaying(false); doPlay(downloadFile, pos, true); @@ -1728,7 +1736,7 @@ public class DownloadServiceImpl extends Service implements DownloadService } else { - Log.i(TAG, "Requesting restart from " + pos + " of " + duration); + Log.i(TAG, String.format("Requesting restart from %d of %d", pos, duration)); reset(); bufferTask = new BufferTask(downloadFile, pos); bufferTask.start(); @@ -2002,7 +2010,7 @@ public class DownloadServiceImpl extends Service implements DownloadService long byteCount = Math.max(100000, bitRate * 1024L / 8L * bufferLength); // Find out how large the file should grow before resuming playback. - Log.i(TAG, "Buffering from position " + position + " and bitrate " + bitRate); + Log.i(TAG, String.format("Buffering from position %d and bitrate %d", position, bitRate)); expectedFileSize = (position * bitRate / 8) + byteCount; } diff --git a/src/com/thejoshwa/ultrasonic/androidapp/view/SongListAdapter.java b/src/com/thejoshwa/ultrasonic/androidapp/view/SongListAdapter.java index df9ed87c..a8d9dcb5 100644 --- a/src/com/thejoshwa/ultrasonic/androidapp/view/SongListAdapter.java +++ b/src/com/thejoshwa/ultrasonic/androidapp/view/SongListAdapter.java @@ -5,6 +5,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import com.thejoshwa.ultrasonic.androidapp.domain.MusicDirectory; import com.thejoshwa.ultrasonic.androidapp.service.DownloadFile; import java.util.List; @@ -22,10 +23,30 @@ public class SongListAdapter extends ArrayAdapter @Override public View getView(final int position, final View convertView, final ViewGroup parent) { - final SongView view; - view = convertView != null && convertView instanceof SongView ? (SongView) convertView : new SongView(this.context); - final DownloadFile downloadFile = getItem(position); - view.setSong(downloadFile.getSong(), false); + DownloadFile downloadFile = getItem(position); + MusicDirectory.Entry entry = downloadFile.getSong(); + + SongView view; + + if (convertView != null && convertView instanceof SongView) + { + SongView currentView = (SongView) convertView; + if (currentView.getEntry().equals(entry)) + { + currentView.update(); + return currentView; + } + else + { + view = new SongView(this.context); + } + } + else + { + view = new SongView(this.context); + } + + view.setSong(entry, false); return view; } -} \ No newline at end of file +}