mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-08 15:58:56 +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) {
|
||||
|
@ -1,102 +1,102 @@
|
||||
/*
|
||||
This file is part of Subsonic.
|
||||
|
||||
Subsonic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Subsonic is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2009 (C) Sindre Mehus
|
||||
*/
|
||||
package net.sourceforge.subsonic.androidapp.util;
|
||||
|
||||
/**
|
||||
* @author Sindre Mehus
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class Constants {
|
||||
|
||||
// Character encoding used throughout.
|
||||
public static final String UTF_8 = "UTF-8";
|
||||
|
||||
// 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_CLIENT_ID = "android";
|
||||
|
||||
// Names for intent extras.
|
||||
public static final String INTENT_EXTRA_NAME_ID = "subsonic.id";
|
||||
public static final String INTENT_EXTRA_NAME_NAME = "subsonic.name";
|
||||
public static final String INTENT_EXTRA_NAME_ARTIST = "subsonic.artist";
|
||||
public static final String INTENT_EXTRA_NAME_TITLE = "subsonic.title";
|
||||
public static final String INTENT_EXTRA_NAME_AUTOPLAY = "subsonic.playall";
|
||||
public static final String INTENT_EXTRA_NAME_ERROR = "subsonic.error";
|
||||
public static final String INTENT_EXTRA_NAME_QUERY = "subsonic.query";
|
||||
public static final String INTENT_EXTRA_NAME_PLAYLIST_ID = "subsonic.playlist.id";
|
||||
public static final String INTENT_EXTRA_NAME_PLAYLIST_NAME = "subsonic.playlist.name";
|
||||
public static final String INTENT_EXTRA_NAME_ALBUM_LIST_TYPE = "subsonic.albumlisttype";
|
||||
public static final String INTENT_EXTRA_NAME_ALBUM_LIST_SIZE = "subsonic.albumlistsize";
|
||||
public static final String INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET = "subsonic.albumlistoffset";
|
||||
public static final String INTENT_EXTRA_NAME_SHUFFLE = "subsonic.shuffle";
|
||||
public static final String INTENT_EXTRA_NAME_REFRESH = "subsonic.refresh";
|
||||
public static final String INTENT_EXTRA_REQUEST_SEARCH = "subsonic.requestsearch";
|
||||
public static final String INTENT_EXTRA_NAME_EXIT = "subsonic.exit";
|
||||
public static final String INTENT_EXTRA_NAME_STARRED = "subsonic.starred";
|
||||
|
||||
// Notification IDs.
|
||||
public static final int NOTIFICATION_ID_PLAYING = 100;
|
||||
public static final int NOTIFICATION_ID_ERROR = 101;
|
||||
|
||||
// Preferences keys.
|
||||
public static final String PREFERENCES_KEY_SERVER_INSTANCE = "serverInstanceId";
|
||||
public static final String PREFERENCES_KEY_SERVER_NAME = "serverName";
|
||||
public static final String PREFERENCES_KEY_SERVER_URL = "serverUrl";
|
||||
public static final String PREFERENCES_KEY_MUSIC_FOLDER_ID = "musicFolderId";
|
||||
public static final String PREFERENCES_KEY_USERNAME = "username";
|
||||
public static final String PREFERENCES_KEY_PASSWORD = "password";
|
||||
public static final String PREFERENCES_KEY_INSTALL_TIME = "installTime";
|
||||
public static final String PREFERENCES_KEY_THEME = "theme";
|
||||
public static final String PREFERENCES_KEY_MAX_BITRATE_WIFI = "maxBitrateWifi";
|
||||
public static final String PREFERENCES_KEY_MAX_BITRATE_MOBILE = "maxBitrateMobile";
|
||||
public static final String PREFERENCES_KEY_CACHE_SIZE = "cacheSize";
|
||||
public static final String PREFERENCES_KEY_CACHE_LOCATION = "cacheLocation";
|
||||
public static final String PREFERENCES_KEY_PRELOAD_COUNT = "preloadCount";
|
||||
public static final String PREFERENCES_KEY_HIDE_MEDIA = "hideMedia";
|
||||
public static final String PREFERENCES_KEY_MEDIA_BUTTONS = "mediaButtons";
|
||||
public static final String PREFERENCES_KEY_SCREEN_LIT_ON_DOWNLOAD = "screenLitOnDownload";
|
||||
public static final String PREFERENCES_KEY_SCROBBLE = "scrobble";
|
||||
public static final String PREFERENCES_KEY_REPEAT_MODE = "repeatMode";
|
||||
public static final String PREFERENCES_KEY_WIFI_REQUIRED_FOR_DOWNLOAD = "wifiRequiredForDownload";
|
||||
public static final String PREFERENCES_KEY_BUFFER_LENGTH = "bufferLength";
|
||||
public static final String PREFERENCES_KEY_NETWORK_TIMEOUT = "networkTimeout";
|
||||
public static final String PREFERENCES_KEY_SHOW_NOTIFICATION = "showNotification";
|
||||
public static final String PREFERENCES_KEY_SHOW_LOCK_SCREEN_CONTROLS = "showLockScreen";
|
||||
public static final String PREFERENCES_KEY_MAX_ALBUMS = "maxAlbums";
|
||||
public static final String PREFERENCES_KEY_MAX_SONGS = "maxSongs";
|
||||
public static final String PREFERENCES_KEY_MAX_ARTISTS = "maxArtists";
|
||||
public static final String PREFERENCES_KEY_DEFAULT_ALBUMS = "defaultAlbums";
|
||||
public static final String PREFERENCES_KEY_DEFAULT_SONGS = "defaultSongs";
|
||||
public static final String PREFERENCES_KEY_DEFAULT_ARTISTS = "defaultArtists";
|
||||
|
||||
// Name of the preferences file.
|
||||
public static final String PREFERENCES_FILE_NAME = "net.sourceforge.subsonic.androidapp_preferences";
|
||||
|
||||
// Number of free trial days for non-licensed servers.
|
||||
public static final int FREE_TRIAL_DAYS = 30;
|
||||
|
||||
// URL for project donations.
|
||||
public static final String DONATION_URL = "http://subsonic.org/pages/android-donation.jsp";
|
||||
|
||||
public static final String ALBUM_ART_FILE = "folder.jpeg";
|
||||
|
||||
private Constants() {
|
||||
}
|
||||
}
|
||||
/*
|
||||
This file is part of Subsonic.
|
||||
|
||||
Subsonic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Subsonic is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2009 (C) Sindre Mehus
|
||||
*/
|
||||
package net.sourceforge.subsonic.androidapp.util;
|
||||
|
||||
/**
|
||||
* @author Sindre Mehus
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class Constants {
|
||||
|
||||
// Character encoding used throughout.
|
||||
public static final String UTF_8 = "UTF-8";
|
||||
|
||||
// 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.7.0";
|
||||
public static final String REST_CLIENT_ID = "android";
|
||||
|
||||
// Names for intent extras.
|
||||
public static final String INTENT_EXTRA_NAME_ID = "subsonic.id";
|
||||
public static final String INTENT_EXTRA_NAME_NAME = "subsonic.name";
|
||||
public static final String INTENT_EXTRA_NAME_ARTIST = "subsonic.artist";
|
||||
public static final String INTENT_EXTRA_NAME_TITLE = "subsonic.title";
|
||||
public static final String INTENT_EXTRA_NAME_AUTOPLAY = "subsonic.playall";
|
||||
public static final String INTENT_EXTRA_NAME_ERROR = "subsonic.error";
|
||||
public static final String INTENT_EXTRA_NAME_QUERY = "subsonic.query";
|
||||
public static final String INTENT_EXTRA_NAME_PLAYLIST_ID = "subsonic.playlist.id";
|
||||
public static final String INTENT_EXTRA_NAME_PLAYLIST_NAME = "subsonic.playlist.name";
|
||||
public static final String INTENT_EXTRA_NAME_ALBUM_LIST_TYPE = "subsonic.albumlisttype";
|
||||
public static final String INTENT_EXTRA_NAME_ALBUM_LIST_SIZE = "subsonic.albumlistsize";
|
||||
public static final String INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET = "subsonic.albumlistoffset";
|
||||
public static final String INTENT_EXTRA_NAME_SHUFFLE = "subsonic.shuffle";
|
||||
public static final String INTENT_EXTRA_NAME_REFRESH = "subsonic.refresh";
|
||||
public static final String INTENT_EXTRA_REQUEST_SEARCH = "subsonic.requestsearch";
|
||||
public static final String INTENT_EXTRA_NAME_EXIT = "subsonic.exit";
|
||||
public static final String INTENT_EXTRA_NAME_STARRED = "subsonic.starred";
|
||||
|
||||
// Notification IDs.
|
||||
public static final int NOTIFICATION_ID_PLAYING = 100;
|
||||
public static final int NOTIFICATION_ID_ERROR = 101;
|
||||
|
||||
// Preferences keys.
|
||||
public static final String PREFERENCES_KEY_SERVER_INSTANCE = "serverInstanceId";
|
||||
public static final String PREFERENCES_KEY_SERVER_NAME = "serverName";
|
||||
public static final String PREFERENCES_KEY_SERVER_URL = "serverUrl";
|
||||
public static final String PREFERENCES_KEY_MUSIC_FOLDER_ID = "musicFolderId";
|
||||
public static final String PREFERENCES_KEY_USERNAME = "username";
|
||||
public static final String PREFERENCES_KEY_PASSWORD = "password";
|
||||
public static final String PREFERENCES_KEY_INSTALL_TIME = "installTime";
|
||||
public static final String PREFERENCES_KEY_THEME = "theme";
|
||||
public static final String PREFERENCES_KEY_MAX_BITRATE_WIFI = "maxBitrateWifi";
|
||||
public static final String PREFERENCES_KEY_MAX_BITRATE_MOBILE = "maxBitrateMobile";
|
||||
public static final String PREFERENCES_KEY_CACHE_SIZE = "cacheSize";
|
||||
public static final String PREFERENCES_KEY_CACHE_LOCATION = "cacheLocation";
|
||||
public static final String PREFERENCES_KEY_PRELOAD_COUNT = "preloadCount";
|
||||
public static final String PREFERENCES_KEY_HIDE_MEDIA = "hideMedia";
|
||||
public static final String PREFERENCES_KEY_MEDIA_BUTTONS = "mediaButtons";
|
||||
public static final String PREFERENCES_KEY_SCREEN_LIT_ON_DOWNLOAD = "screenLitOnDownload";
|
||||
public static final String PREFERENCES_KEY_SCROBBLE = "scrobble";
|
||||
public static final String PREFERENCES_KEY_REPEAT_MODE = "repeatMode";
|
||||
public static final String PREFERENCES_KEY_WIFI_REQUIRED_FOR_DOWNLOAD = "wifiRequiredForDownload";
|
||||
public static final String PREFERENCES_KEY_BUFFER_LENGTH = "bufferLength";
|
||||
public static final String PREFERENCES_KEY_NETWORK_TIMEOUT = "networkTimeout";
|
||||
public static final String PREFERENCES_KEY_SHOW_NOTIFICATION = "showNotification";
|
||||
public static final String PREFERENCES_KEY_SHOW_LOCK_SCREEN_CONTROLS = "showLockScreen";
|
||||
public static final String PREFERENCES_KEY_MAX_ALBUMS = "maxAlbums";
|
||||
public static final String PREFERENCES_KEY_MAX_SONGS = "maxSongs";
|
||||
public static final String PREFERENCES_KEY_MAX_ARTISTS = "maxArtists";
|
||||
public static final String PREFERENCES_KEY_DEFAULT_ALBUMS = "defaultAlbums";
|
||||
public static final String PREFERENCES_KEY_DEFAULT_SONGS = "defaultSongs";
|
||||
public static final String PREFERENCES_KEY_DEFAULT_ARTISTS = "defaultArtists";
|
||||
|
||||
// Name of the preferences file.
|
||||
public static final String PREFERENCES_FILE_NAME = "net.sourceforge.subsonic.androidapp_preferences";
|
||||
|
||||
// Number of free trial days for non-licensed servers.
|
||||
public static final int FREE_TRIAL_DAYS = 30;
|
||||
|
||||
// URL for project donations.
|
||||
public static final String DONATION_URL = "http://subsonic.org/pages/android-donation.jsp";
|
||||
|
||||
public static final String ALBUM_ART_FILE = "folder.jpeg";
|
||||
|
||||
private Constants() {
|
||||
}
|
||||
}
|
||||
|
@ -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