aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java17
-rw-r--r--src/github/daneren2005/dsub/service/DLNAController.java13
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java5
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java2
-rw-r--r--src/github/daneren2005/dsub/service/RESTMusicService.java9
5 files changed, 34 insertions, 12 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 515a6cd4..08ccac33 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -719,7 +719,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
// Show header if not album list type and not root and not artist
// For Subsonic 5.1+ display a header for artists with getArtistInfo data if it exists
View header = null;
- if(albumListType == null && !"root".equals(id) && (!artist || artistInfo != null) && entryAdapter == null) {
+ if(albumListType == null && !"root".equals(id) && (!artist || artistInfo != null)) {
header = createHeader();
// Only add header to entry list if we aren't going recreate album grid as root anyways
if(header != null && entryList != null && (!addAlbumHeader || entries.size() > 0)) {
@@ -729,7 +729,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
// Needs to be added here, GB crashes if you to try to remove the header view before adapter is set
- if(addAlbumHeader && entryAdapter == null) {
+ if(addAlbumHeader) {
if(entries.size() > 0 || playlistId != null || podcastId != null) {
entryList.addHeaderView(albumList);
} else {
@@ -1428,11 +1428,18 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
if(artistView.getMaxLines() == minLines) {
// Use LeadingMarginSpan2 to try to make text flow around image
Display display = context.getWindowManager().getDefaultDisplay();
- View coverArtView = header.findViewById(R.id.select_album_art);
+ ImageView coverArtView = (ImageView) header.findViewById(R.id.select_album_art);
coverArtView.measure(display.getWidth(), display.getHeight());
+
+ int height, width;
ViewGroup.MarginLayoutParams vlp = (ViewGroup.MarginLayoutParams) coverArtView.getLayoutParams();
- int height = coverArtView.getMeasuredHeight() + coverArtView.getPaddingBottom();
- int width = coverArtView.getWidth() + coverArtView.getPaddingRight();
+ if(coverArtView.getDrawable() != null) {
+ height = coverArtView.getMeasuredHeight() + coverArtView.getPaddingBottom();
+ width = coverArtView.getWidth() + coverArtView.getPaddingRight();
+ } else {
+ height = coverArtView.getHeight();
+ width = coverArtView.getWidth() + coverArtView.getPaddingRight();
+ }
float textLineHeight = artistView.getPaint().getTextSize();
int lines = (int) Math.ceil(height / textLineHeight);
diff --git a/src/github/daneren2005/dsub/service/DLNAController.java b/src/github/daneren2005/dsub/service/DLNAController.java
index 701034de..5daf0910 100644
--- a/src/github/daneren2005/dsub/service/DLNAController.java
+++ b/src/github/daneren2005/dsub/service/DLNAController.java
@@ -72,6 +72,7 @@ import github.daneren2005.serverproxy.WebProxy;
public class DLNAController extends RemoteController {
private static final String TAG = DLNAController.class.getSimpleName();
+ private static final long SEARCH_UPDATE_INTERVAL_SECONDS = 10L * 60L * 1000L;
private static final long STATUS_UPDATE_INTERVAL_SECONDS = 3000L;
DLNADevice device;
@@ -88,6 +89,17 @@ public class DLNAController extends RemoteController {
String currentPlayingURI;
boolean running = true;
boolean hasDuration = false;
+ Runnable searchDLNA = new Runnable() {
+ @Override
+ public void run() {
+ if(controlPoint == null || !running) {
+ return;
+ }
+
+ controlPoint.search();
+ downloadService.postDelayed(searchDLNA, SEARCH_UPDATE_INTERVAL_SECONDS);
+ }
+ };
public DLNAController(DownloadService downloadService, ControlPoint controlPoint, DLNADevice device) {
this.downloadService = downloadService;
@@ -121,6 +133,7 @@ public class DLNAController extends RemoteController {
}
startSong(downloadService.getCurrentPlaying(), playing, seconds);
+ downloadService.postDelayed(searchDLNA, SEARCH_UPDATE_INTERVAL_SECONDS);
}
@Override
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index 24c710dd..562d621c 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -981,6 +981,9 @@ public class DownloadService extends Service {
next(false);
}
public synchronized void next(boolean forceCutoff) {
+ next(forceCutoff, false);
+ }
+ public synchronized void next(boolean forceCutoff, boolean forceStart) {
// If only one song, just skip within song
if(size() == 1) {
seekTo(getPlayerPosition() + FAST_FORWARD);
@@ -1015,7 +1018,7 @@ public class DownloadService extends Service {
nextPlayingIndex++;
}
if (index != -1 && nextPlayingIndex < size()) {
- play(nextPlayingIndex, playerState != PAUSED && playerState != STOPPED && playerState != IDLE);
+ play(nextPlayingIndex, playerState != PAUSED && playerState != STOPPED && playerState != IDLE || forceStart);
}
}
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index fa0e66af..278c7e4f 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -334,7 +334,7 @@ public class DownloadServiceLifecycleSupport {
lastPressTime = System.currentTimeMillis();
downloadService.togglePlayPause();
} else {
- downloadService.next();
+ downloadService.next(false, true);
}
break;
case RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS:
diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java
index 307afc9a..40a2f849 100644
--- a/src/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/src/github/daneren2005/dsub/service/RESTMusicService.java
@@ -700,7 +700,7 @@ public class RESTMusicService implements MusicService {
// If content type is XML, an error occured. Get it.
String contentType = Util.getContentType(entity);
- if (contentType != null && contentType.startsWith("text/xml")) {
+ if (contentType != null && (contentType.startsWith("text/xml") || contentType.startsWith("text/html"))) {
new ErrorParser(context, getInstance(context)).parse(new InputStreamReader(in, Constants.UTF_8));
return null; // Never reached.
}
@@ -778,7 +778,7 @@ public class RESTMusicService implements MusicService {
// If content type is XML, an error occurred. Get it.
String contentType = Util.getContentType(response.getEntity());
- if (contentType != null && contentType.startsWith("text/xml")) {
+ if (contentType != null && (contentType.startsWith("text/xml") || contentType.startsWith("text/html"))) {
InputStream in = response.getEntity().getContent();
Header contentEncoding = response.getEntity().getContentEncoding();
if (contentEncoding != null && contentEncoding.getValue().equalsIgnoreCase("gzip")) {
@@ -1438,8 +1438,7 @@ public class RESTMusicService implements MusicService {
// If content type is XML, an error occurred. Get it.
String contentType = Util.getContentType(entity);
- if (contentType != null && contentType.startsWith("text/xml"))
- {
+ if (contentType != null && (contentType.startsWith("text/xml") || contentType.startsWith("text/html"))) {
new ErrorParser(context, getInstance(context)).parse(new InputStreamReader(in, Constants.UTF_8));
return null; // Never reached.
}
@@ -1499,7 +1498,7 @@ public class RESTMusicService implements MusicService {
// If content type is XML, an error occurred. Get it.
String contentType = Util.getContentType(entity);
- if (contentType != null && contentType.startsWith("text/xml")) {
+ if (contentType != null && (contentType.startsWith("text/xml") || contentType.startsWith("text/html"))) {
new ErrorParser(context, getInstance(context)).parse(new InputStreamReader(in, Constants.UTF_8));
return null; // Never reached.
}