[Android] Fix crash while mirroring

Geoffrey Métais git at videolan.org
Tue May 31 19:14:33 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 31 19:09:50 2016 +0200| [670b5e6e5e2f31dc5731bd6eaeada22a7430aeda] | committer: Geoffrey Métais

Fix crash while mirroring

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

 .../vlc/gui/video/VideoPlayerActivity.java         | 40 +++++++++++++++-------
 1 file changed, 27 insertions(+), 13 deletions(-)

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 39036e4..da037a9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1310,9 +1310,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     }
 
     private void initPlaybackSettingInfo() {
-        if (mPresentation == null)
+        if (mPresentation == null) {
             mVerticalBar.setVisibility(View.GONE);
-        mOverlayInfo.setVisibility(View.VISIBLE);
+            mOverlayInfo.setVisibility(View.VISIBLE);
+        } else
+            mInfo.setVisibility(View.VISIBLE);
         String text = "";
         if (mPlaybackSetting == DelayState.AUDIO) {
             text += getString(R.string.audio_delay)+"\n";
@@ -1339,7 +1341,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mPlaybackSettingPlus.setOnClickListener(null);
         mPlaybackSettingMinus.setVisibility(View.INVISIBLE);
         mPlaybackSettingPlus.setVisibility(View.INVISIBLE);
-        mOverlayInfo.setVisibility(View.INVISIBLE);
+        if (mPresentation == null)
+            mOverlayInfo.setVisibility(View.INVISIBLE);
+        else
+            mInfo.setVisibility(View.INVISIBLE);
         mInfo.setText("");
         mPlayPause.requestFocus();
     }
@@ -1444,18 +1449,24 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      * @param duration
      */
     private void showInfo(String text, int duration) {
-        if (mPresentation == null && mVerticalBar != null)
-            mVerticalBar.setVisibility(View.GONE);
-        mOverlayInfo.setVisibility(View.VISIBLE);
+        if (mPresentation == null) {
+            if (mVerticalBar != null)
+                mVerticalBar.setVisibility(View.GONE);
+            mOverlayInfo.setVisibility(View.VISIBLE);
+        } else
+            mInfo.setVisibility(View.VISIBLE);
         mInfo.setText(text);
         mHandler.removeMessages(FADE_OUT_INFO);
         mHandler.sendEmptyMessageDelayed(FADE_OUT_INFO, duration);
     }
 
     private void showInfo(int textid, int duration) {
-        if (mPresentation == null && mVerticalBar != null)
-            mVerticalBar.setVisibility(View.GONE);
-        mOverlayInfo.setVisibility(View.VISIBLE);
+        if (mPresentation == null) {
+            if (mVerticalBar != null)
+                mVerticalBar.setVisibility(View.GONE);
+            mOverlayInfo.setVisibility(View.VISIBLE);
+        } else
+            mInfo.setVisibility(View.VISIBLE);
         mInfo.setText(textid);
         mHandler.removeMessages(FADE_OUT_INFO);
         mHandler.sendEmptyMessageDelayed(FADE_OUT_INFO, duration);
@@ -1477,10 +1488,13 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     }
 
     private void fadeOutInfo() {
-        if (mOverlayInfo.getVisibility() == View.VISIBLE)
-            mOverlayInfo.startAnimation(AnimationUtils.loadAnimation(
-                    VideoPlayerActivity.this, android.R.anim.fade_out));
-        mOverlayInfo.setVisibility(View.INVISIBLE);
+        if (mPresentation == null) {
+            if (mOverlayInfo.getVisibility() == View.VISIBLE)
+                mOverlayInfo.startAnimation(AnimationUtils.loadAnimation(
+                        VideoPlayerActivity.this, android.R.anim.fade_out));
+        } else if (mInfo.getVisibility() == View.VISIBLE)
+                mInfo.startAnimation(AnimationUtils.loadAnimation(
+                        VideoPlayerActivity.this, android.R.anim.fade_out));
     }
 
     @Override



More information about the Android mailing list