[Android] Restore video played in background

Geoffrey Métais git at videolan.org
Wed Jul 8 18:50:33 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jul  8 18:33:10 2015 +0200| [cc4e70c1a755d506319800000e43ae8cf18f636a] | committer: Geoffrey Métais

Restore video played in background

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=cc4e70c1a755d506319800000e43ae8cf18f636a
---

 .../vlc/gui/tv/audioplayer/AudioPlayerActivity.java         |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
index 9b32674..c9fb674 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
@@ -31,12 +31,16 @@ import org.videolan.vlc.PlaybackService;
 import org.videolan.vlc.R;
 import org.videolan.vlc.gui.DividerItemDecoration;
 import org.videolan.vlc.gui.PlaybackServiceActivity;
+import org.videolan.vlc.gui.PreferencesActivity;
 import org.videolan.vlc.gui.audio.AudioUtil;
 import org.videolan.vlc.gui.audio.MediaComparators;
 import org.videolan.vlc.util.AndroidDevices;
+import org.videolan.vlc.util.Util;
 
+import android.content.SharedPreferences;
 import android.graphics.Bitmap;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.InputDevice;
@@ -135,6 +139,13 @@ public class AudioPlayerActivity extends PlaybackServiceActivity implements Play
             return;
         mPlayPauseButton.setImageResource(mService.isPlaying() ? R.drawable.ic_pause : R.drawable.ic_play);
         if (mService.hasMedia()) {
+            SharedPreferences mSettings= PreferenceManager.getDefaultSharedPreferences(this);
+            if (mSettings.getBoolean(PreferencesActivity.VIDEO_RESTORE, false)){
+                Util.commitPreferences(mSettings.edit().putBoolean(PreferencesActivity.VIDEO_RESTORE, false));
+                mService.switchToVideo();
+                finish();
+                return;
+            }
             mTitleTv.setText(mService.getTitle());
             mArtistTv.setText(mService.getArtist());
             mProgressBar.setMax((int) mService.getLength());



More information about the Android mailing list