mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-09 00:08:43 +01:00
Force API level 1.7.0 or higher, tweak seeking
This commit is contained in:
parent
1404616b35
commit
d8418254ef
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
package="net.sourceforge.subsonic.androidapp"
|
||||
a:versionCode="58"
|
||||
a:versionName="3.9.9.17" a:installLocation="auto">
|
||||
a:versionCode="59"
|
||||
a:versionName="3.9.9.18" a:installLocation="auto">
|
||||
|
||||
<uses-permission a:name="android.permission.INTERNET"/>
|
||||
<uses-permission a:name="android.permission.READ_PHONE_STATE"/>
|
||||
|
@ -109,7 +109,6 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
|
||||
private VisualizerView visualizerView;
|
||||
private boolean visualizerAvailable;
|
||||
private boolean equalizerAvailable;
|
||||
|
||||
/**
|
||||
* Called when the activity is first created.
|
||||
*/
|
||||
@ -260,6 +259,8 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
getDownloadService().seekTo(getProgressBar().getProgress());
|
||||
onSliderProgressChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -268,10 +269,6 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (fromUser) {
|
||||
getDownloadService().seekTo(progress);
|
||||
onSliderProgressChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -826,8 +826,21 @@ public class DownloadServiceImpl extends Service implements DownloadService {
|
||||
final File file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteFile() : downloadFile.getPartialFile();
|
||||
downloadFile.updateModificationDate();
|
||||
mediaPlayer.setOnCompletionListener(null);
|
||||
mediaPlayer.setOnBufferingUpdateListener(null);
|
||||
mediaPlayer.reset();
|
||||
setPlayerState(IDLE);
|
||||
|
||||
mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
|
||||
@Override
|
||||
public void onBufferingUpdate(MediaPlayer mp, int percent) {
|
||||
SeekBar progressBar = DownloadActivity.getProgressBar();
|
||||
if (progressBar != null) {
|
||||
int secondaryProgress = (int) (((double)percent / (double)100) * progressBar.getMax());
|
||||
DownloadActivity.getProgressBar().setSecondaryProgress(secondaryProgress);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
|
||||
String url = file.getPath();
|
||||
@ -845,18 +858,6 @@ public class DownloadServiceImpl extends Service implements DownloadService {
|
||||
mediaPlayer.prepare();
|
||||
setPlayerState(PREPARED);
|
||||
|
||||
mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
|
||||
@Override
|
||||
public void onBufferingUpdate(MediaPlayer mp, int percent) {
|
||||
SeekBar progressBar = DownloadActivity.getProgressBar();
|
||||
if (progressBar != null) {
|
||||
int max = progressBar.getMax();
|
||||
int secondaryProgress = (int) (((double)percent / (double)100) * max);
|
||||
DownloadActivity.getProgressBar().setSecondaryProgress(secondaryProgress);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mediaPlayer) {
|
||||
|
@ -29,7 +29,7 @@ public final class Constants {
|
||||
|
||||
// REST protocol version and client ID.
|
||||
// Note: Keep it as low as possible to maintain compatibility with older servers.
|
||||
public static final String REST_PROTOCOL_VERSION = "1.8.0";
|
||||
public static final String REST_PROTOCOL_VERSION = "1.7.0";
|
||||
public static final String REST_CLIENT_ID = "android";
|
||||
|
||||
// Names for intent extras.
|
||||
|
@ -143,7 +143,7 @@ public class StreamProxy implements Runnable {
|
||||
Log.d(TAG, "Processing request");
|
||||
|
||||
try {
|
||||
localPath = URLDecoder.decode(request.getRequestLine().getUri(), "UTF-8");
|
||||
localPath = URLDecoder.decode(request.getRequestLine().getUri(), Constants.UTF_8);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, "Unsupported encoding", e);
|
||||
return false;
|
||||
@ -155,12 +155,6 @@ public class StreamProxy implements Runnable {
|
||||
return false;
|
||||
}
|
||||
|
||||
Header rangeHeader = request.getLastHeader("Range");
|
||||
|
||||
if (rangeHeader != null) {
|
||||
cbSkip = Integer.parseInt(rangeHeader.getValue());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -171,7 +165,11 @@ public class StreamProxy implements Runnable {
|
||||
// Create HTTP header
|
||||
String headers = "HTTP/1.0 200 OK\r\n";
|
||||
headers += "Content-Type: " + "application/octet-stream" + "\r\n";
|
||||
headers += "Content-Length: " + fileSize + "\r\n";
|
||||
|
||||
if (fileSize > 0) {
|
||||
headers += "Content-Length: " + fileSize + "\r\n";
|
||||
}
|
||||
|
||||
headers += "Connection: close\r\n";
|
||||
headers += "\r\n";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user