[Android] Video Player : save focus object when hiding overlay

Alexandre Perraud git at videolan.org
Tue Dec 22 10:44:04 CET 2015


vlc-android | branch: 1.7.x | Alexandre Perraud <4leyx4ndre at gmail.com> | Fri Nov 27 17:38:21 2015 +0100| [b7543222fc76f93ecc8080a48525ee831e02be57] | committer: Geoffrey Métais

Video Player : save focus object when hiding overlay

(cherry picked from commit 64e520aa5a8f56c6a1bebd096c73d138e5af9851)
Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java        | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index db37b33..eb151fa 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -222,6 +222,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private ImageView mAdvOptions;
     private ImageView mDelayPlus;
     private ImageView mDelayMinus;
+    private View mObjectFocused;
     private boolean mEnableBrightnessGesture;
     private boolean mEnableCloneMode;
     private boolean mDisplayRemainingTime = false;
@@ -2378,6 +2379,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         if (mOverlayTimeout != OVERLAY_INFINITE)
             mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), mOverlayTimeout);
         updateOverlayPausePlay();
+        if (!(mObjectFocused == null)) {
+            if (mObjectFocused.isFocusable())
+                mObjectFocused.requestFocus();
+            mObjectFocused =  null;
+        }
     }
 
 
@@ -2389,6 +2395,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             mHandler.removeMessages(FADE_OUT);
             mHandler.removeMessages(SHOW_PROGRESS);
             Log.i(TAG, "remove View!");
+            mObjectFocused = getCurrentFocus();
             if (mOverlayTips != null) mOverlayTips.setVisibility(View.INVISIBLE);
             if (!fromUser && !mIsLocked) {
                 mOverlayProgress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));



More information about the Android mailing list