[Android] Retry failed thumbnails on app upgrade
Geoffrey Métais
git at videolan.org
Mon Feb 13 17:36:28 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 13 17:35:07 2017 +0100| [c9c56c4b312dd7982c9b7ac41dac29a23df96e7a] | committer: Geoffrey Métais
Retry failed thumbnails on app upgrade
> https://code.videolan.org/videolan/vlc-android/commit/c9c56c4b312dd7982c9b7ac41dac29a23df96e7a
---
vlc-android/src/org/videolan/vlc/MediaParsingService.java | 6 ++++--
vlc-android/src/org/videolan/vlc/StartActivity.java | 7 +++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.java b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
index a85aa84..772fbc9 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.java
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
@@ -77,7 +77,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
mLastNotificationTime = System.currentTimeMillis();
switch (intent.getAction()) {
case ACTION_INIT:
- setupMedialibrary();
+ setupMedialibrary(intent.getBooleanExtra(StartActivity.EXTRA_UPGRADE, false));
break;
case ACTION_RELOAD:
reload();
@@ -99,7 +99,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
mMedialibrary.reload();
}
- private void setupMedialibrary() {
+ private void setupMedialibrary(final boolean upgrade) {
mMedialibrary.addDeviceDiscoveryCb(MediaParsingService.this);
if (mMedialibrary.isInitiated())
mMedialibrary.resumeBackgroundOperations();
@@ -126,6 +126,8 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
for (String externalStorage : AndroidDevices.getExternalStorageDirectories())
if (!TextUtils.equals(externalStorage, AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY))
mMedialibrary.discover(externalStorage);
+ } else if (upgrade) {
+ mMedialibrary.forceParserRetry();
}
}
}
diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index 2720f75..1a64499 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -69,8 +69,11 @@ public class StartActivity extends Activity {
else
MediaUtils.openMediaNoUi(intent.getData());
} else {
- if (Permissions.canReadStorage())
- startService(new Intent(MediaParsingService.ACTION_INIT, null, this, MediaParsingService.class));
+ if (Permissions.canReadStorage()) {
+ Intent serviceInent = new Intent(MediaParsingService.ACTION_INIT, null, this, MediaParsingService.class);
+ serviceInent.putExtra(EXTRA_UPGRADE, upgrade);
+ startService(serviceInent);
+ }
if (intent != null && TextUtils.equals(intent.getAction(), AudioPlayerContainerActivity.ACTION_SHOW_PLAYER))
startActivity(new Intent(this, showTvUi() ? AudioPlayerActivity.class : MainActivity.class));
else {
More information about the Android
mailing list