[Android] Check fragment is resumed before restoring video

Geoffrey Métais git at videolan.org
Mon Feb 29 12:01:26 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 29 11:59:26 2016 +0100| [2a29ce372062857e43d19c28956bd57c651716dc] | committer: Geoffrey Métais

Check fragment is resumed before restoring video

> https://code.videolan.org/videolan/vlc-android/commit/2a29ce372062857e43d19c28956bd57c651716dc
---

 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 0a8474c..64b856b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -260,11 +260,6 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
     }
 
     @Override
-    public void onResume() {
-        super.onResume();
-    }
-
-    @Override
     public void onPause() {
         super.onPause();
         getView().cancelLongPress();
@@ -306,7 +301,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
 
         if (mService.hasMedia() && !mService.isVideoPlaying()) {
             SharedPreferences mSettings= PreferenceManager.getDefaultSharedPreferences(getActivity());
-            if (mSettings.getBoolean(PreferencesActivity.VIDEO_RESTORE, false)){
+            if (isResumed() && mSettings.getBoolean(PreferencesActivity.VIDEO_RESTORE, false)){
                 Util.commitPreferences(mSettings.edit().putBoolean(PreferencesActivity.VIDEO_RESTORE, false));
                 mService.switchToVideo();
                 return;



More information about the Android mailing list