[Android] Refresh views on Media Library rescan
Geoffrey Métais
git at videolan.org
Tue May 31 18:26:58 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 31 11:27:17 2016 +0200| [b120cfbc932ea86d6e326845c9ebd8bcbb97d0a8] | committer: Geoffrey Métais
Refresh views on Media Library rescan
> https://code.videolan.org/videolan/vlc-android/commit/b120cfbc932ea86d6e326845c9ebd8bcbb97d0a8
---
vlc-android/src/org/videolan/vlc/gui/MainActivity.java | 7 +++++--
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 5 +++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index b9ecbb0..7c08863 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -689,9 +689,12 @@ public class MainActivity extends AudioPlayerContainerActivity implements Filter
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == ACTIVITY_RESULT_PREFERENCES) {
- if (resultCode == PreferencesActivity.RESULT_RESCAN)
+ if (resultCode == PreferencesActivity.RESULT_RESCAN) {
+ for (Fragment fragment : getSupportFragmentManager().getFragments())
+ if (fragment instanceof MediaBrowserFragment)
+ ((MediaBrowserFragment) fragment).clear();
mMediaLibrary.scanMediaItems(true);
- else if (resultCode == PreferencesActivity.RESULT_RESTART) {
+ } else if (resultCode == PreferencesActivity.RESULT_RESTART) {
Intent intent = new Intent(MainActivity.this, StartActivity.class);
finish();
startActivity(intent);
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 49d7af9..a42c387 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -245,9 +245,10 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == ACTIVITY_RESULT_PREFERENCES) {
- if (resultCode == PreferencesActivity.RESULT_RESCAN)
+ if (resultCode == PreferencesActivity.RESULT_RESCAN) {
MediaLibrary.getInstance().scanMediaItems(true);
- else if (resultCode == PreferencesActivity.RESULT_RESTART) {
+ update();
+ } else if (resultCode == PreferencesActivity.RESULT_RESTART) {
Intent intent = getIntent();
intent.setClass(this, StartActivity.class);
finish();
More information about the Android
mailing list