[Android] No Renderer change in player before Android 17

Geoffrey Métais git at videolan.org
Fri Jan 26 15:16:49 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 25 15:30:20 2018 +0100| [afc6b8df9c040407c5c7db7b56adfd3f09643aa2] | committer: Geoffrey Métais

No Renderer change in player before Android 17

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

 vlc-android/res/layout/player_action_bar.xml                  |  9 ---------
 vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt  |  4 ++--
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java   | 11 ++++++-----
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/vlc-android/res/layout/player_action_bar.xml b/vlc-android/res/layout/player_action_bar.xml
index 6961d2056..36a62f514 100644
--- a/vlc-android/res/layout/player_action_bar.xml
+++ b/vlc-android/res/layout/player_action_bar.xml
@@ -17,15 +17,6 @@
         android:textColor="@color/white"
         android:textSize="15sp" />
 
-    <ImageView
-        android:id="@+id/video_renderer"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_vertical"
-        android:src="@drawable/ic_am_renderer_normal_w"
-        android:focusable="true"
-        android:visibility="gone"/>
-
     <TextView
         android:id="@+id/player_overlay_battery"
         android:layout_width="wrap_content"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt b/vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt
index f272765ac..c24bb0bc9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt
@@ -51,7 +51,7 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean) : Rende
     }
 
     init {
-        presentation = createPresentation(cloneMode)
+        presentation = if (AndroidUtil.isJellyBeanMR1OrLater) createPresentation(cloneMode) else null
         rendererItem = RendererDelegate.selectedRenderer
         displayType = getCurrentType()
         RendererDelegate.addPlayerListener(this)
@@ -69,7 +69,7 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean) : Rende
     }
 
     private fun updateDisplayType() {
-        if (getCurrentType() != displayType) activity.recreate()
+        if (getCurrentType() != displayType && activity is VideoPlayerActivity) activity.recreate()
     }
 
     private fun getCurrentType() = when {
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 713747fca..41a125571 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -954,8 +954,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     }
 
     private static void start(Context context, Uri uri, String title, boolean fromStart, int openedPosition) {
-        Intent intent = getIntent(context, uri, title, fromStart, openedPosition);
-
+        final Intent intent = getIntent(context, uri, title, fromStart, openedPosition);
         context.startActivity(intent);
     }
 
@@ -2828,9 +2827,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             mHudBinding.progressOverlay.setLayoutParams(layoutParams);
             mOverlayBackground = findViewById(R.id.player_overlay_background);
             mNavMenu = (ImageView) findViewById(R.id.player_overlay_navmenu);
-            mRendererBtn = (ImageView) findViewById(R.id.video_renderer);
-            onRenderersChanged(RendererDelegate.INSTANCE.getRenderers().isEmpty());
-            onRendererChanged(RendererDelegate.INSTANCE.getSelectedRenderer());
+            if (AndroidUtil.isJellyBeanMR1OrLater) {
+                mRendererBtn = (ImageView) findViewById(R.id.video_renderer);
+                onRenderersChanged(RendererDelegate.INSTANCE.getRenderers().isEmpty());
+                onRendererChanged(RendererDelegate.INSTANCE.getSelectedRenderer());
+            }
             if (mSeekButtons) initSeekButton();
             resetHudLayout();
             updateOverlayPausePlay();



More information about the Android mailing list