From b1a98f5f081cd02018f78783e1979d60a7468a02 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 8 Jan 2013 21:23:04 -0800 Subject: Change default video action: If file exists open it, otherwise open stream --- .../daneren2005/dsub/activity/SelectAlbumActivity.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'subsonic-android') diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java index 84f9a748..6362f039 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java @@ -77,7 +77,11 @@ public class SelectAlbumActivity extends SubsonicTabActivity { intent.putExtra(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle()); Util.startActivityWithoutTransition(SelectAlbumActivity.this, intent); } else if (entry.isVideo()) { - playExternalPlayer(entry); + if(entryExists(entry)) { + playExternalPlayer(entry); + } else { + streamExternalPlayer(entry); + } } } } @@ -542,6 +546,11 @@ public class SelectAlbumActivity extends SubsonicTabActivity { getDownloadService().delete(songs); } } + + private boolean entryExists(MusicDirectory.Entry entry) { + DownloadFile check = new DownloadFile(this, entry, false); + return check.isCompleteFileAvailable(); + } private void playWebView(MusicDirectory.Entry entry) { Intent intent = new Intent(Intent.ACTION_VIEW); @@ -550,8 +559,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity { startActivity(intent); } private void playExternalPlayer(MusicDirectory.Entry entry) { - DownloadFile check = new DownloadFile(this, entry, false); - if(!check.isCompleteFileAvailable()) { + if(!entryExists(entry)) { Util.toast(this, R.string.download_need_download); } else { Intent intent = new Intent(Intent.ACTION_VIEW); -- cgit v1.2.3