Improvementes in full screen video: tap on video shows and hides controls; full scree...
authorDavid A. Velasco <dvelasco@solidgear.es>
Thu, 21 Mar 2013 14:49:10 +0000 (15:49 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Thu, 21 Mar 2013 14:49:10 +0000 (15:49 +0100)
src/com/owncloud/android/media/MediaService.java
src/com/owncloud/android/ui/preview/PreviewVideoActivity.java

index f8e70fe..379b404 100644 (file)
@@ -73,7 +73,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
     public static final int OC_MEDIA_ERROR = 0;
 
     /** Time To keep the control panel visible when the user does not use it */
-    public static final int MEDIA_CONTROL_SHORT_LIFE = 5000;
+    public static final int MEDIA_CONTROL_SHORT_LIFE = 4000;
     
     /** Time To keep the control panel visible when the user does not use it */
     public static final int MEDIA_CONTROL_PERMANENT = 0;
index 0b12920..38eb634 100644 (file)
@@ -88,11 +88,19 @@ public class PreviewVideoActivity extends Activity implements OnCompletionListen
         
         setContentView(R.layout.video_layout);
     
-        Bundle extras = getIntent().getExtras();
-        mFile = extras.getParcelable(EXTRA_FILE);
-        mAccount = extras.getParcelable(EXTRA_ACCOUNT);
-        mSavedPlaybackPosition = extras.getInt(EXTRA_START_POSITION);
-        mAutoplay = extras.getBoolean(EXTRA_AUTOPLAY);
+        if (savedInstanceState == null) {
+            Bundle extras = getIntent().getExtras();
+            mFile = extras.getParcelable(EXTRA_FILE);
+            mAccount = extras.getParcelable(EXTRA_ACCOUNT);
+            mSavedPlaybackPosition = extras.getInt(EXTRA_START_POSITION);
+            mAutoplay = extras.getBoolean(EXTRA_AUTOPLAY);
+            
+        } else {
+            mFile = savedInstanceState.getParcelable(EXTRA_FILE);
+            mAccount = savedInstanceState.getParcelable(EXTRA_ACCOUNT);
+            mSavedPlaybackPosition = savedInstanceState.getInt(EXTRA_START_POSITION);
+            mAutoplay = savedInstanceState.getBoolean(EXTRA_AUTOPLAY);
+        }
           
         mVideoPlayer = (VideoView) findViewById(R.id.videoPlayer);
 
@@ -129,8 +137,22 @@ public class PreviewVideoActivity extends Activity implements OnCompletionListen
     }    
     
     
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putParcelable(PreviewVideoActivity.EXTRA_FILE, mFile);
+        outState.putParcelable(PreviewVideoActivity.EXTRA_ACCOUNT, mAccount);
+        outState.putInt(PreviewVideoActivity.EXTRA_START_POSITION, mVideoPlayer.getCurrentPosition());
+        outState.putBoolean(PreviewVideoActivity.EXTRA_AUTOPLAY , mVideoPlayer.isPlaying());
+    }
+
+    
     @Override
     public void onBackPressed() {
+        Log.e(TAG, "onBackPressed");
         Intent i = new Intent();
         i.putExtra(EXTRA_AUTOPLAY, mVideoPlayer.isPlaying());
         i.putExtra(EXTRA_START_POSITION, mVideoPlayer.getCurrentPosition());
@@ -208,12 +230,17 @@ public class PreviewVideoActivity extends Activity implements OnCompletionListen
      */
     @Override
     public boolean onTouchEvent (MotionEvent ev){ 
-        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
-            mMediaController.show(MediaService.MEDIA_CONTROL_SHORT_LIFE);
+        /*if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+            if (mMediaController.isShowing()) {
+                mMediaController.hide();
+            } else {
+                mMediaController.show(MediaService.MEDIA_CONTROL_SHORT_LIFE);
+            }
             return true;        
         } else {
             return false;
-        }
+        }*/
+        return false;
     }