[Android] TV: Fix browser behavior

Geoffrey Métais git at videolan.org
Tue Aug 8 17:40:18 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Aug  8 17:39:37 2017 +0200| [5c04fc565063b95e9104c6ef735aaa2d31b06ddd] | committer: Geoffrey Métais

TV: Fix browser behavior

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

 vlc-android/res/layout/secondary.xml                     |  3 +--
 .../src/org/videolan/vlc/gui/SecondaryActivity.java      | 16 +++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/vlc-android/res/layout/secondary.xml b/vlc-android/res/layout/secondary.xml
index 8ef856d92..5f20aa6a7 100644
--- a/vlc-android/res/layout/secondary.xml
+++ b/vlc-android/res/layout/secondary.xml
@@ -14,8 +14,7 @@
         <FrameLayout
             android:id="@+id/fragment_placeholder"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            vlc:layout_behavior="@string/appbar_scrolling_view_behavior" />
+            android:layout_height="match_parent" />
 
         <android.support.v7.widget.ViewStubCompat
             android:id="@+id/scan_viewstub"
diff --git a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
index d53e76b47..6cc8b3856 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
@@ -25,9 +25,12 @@ package org.videolan.vlc.gui;
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.support.design.widget.AppBarLayout;
+import android.support.design.widget.CoordinatorLayout;
 import android.support.design.widget.Snackbar;
 import android.support.v4.app.Fragment;
 import android.view.MenuItem;
+import android.view.View;
 
 import org.videolan.medialibrary.Medialibrary;
 import org.videolan.vlc.MediaParsingService;
@@ -59,6 +62,16 @@ public class SecondaryActivity extends ContentActivity {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.secondary);
 
+        if (VLCApplication.showTvUi()) {
+            TvUtil.applyOverscanMargin(this);
+        } else {
+            final View fph = findViewById(R.id.fragment_placeholder);
+            final CoordinatorLayout.LayoutParams params =
+                    (CoordinatorLayout.LayoutParams) fph.getLayoutParams();
+            params.setBehavior(new AppBarLayout.ScrollingViewBehavior());
+            fph.requestLayout();
+        }
+
         initAudioPlayerContainerActivity();
         getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 
@@ -75,9 +88,6 @@ public class SecondaryActivity extends ContentActivity {
             if (VLCApplication.showTvUi() && STORAGE_BROWSER.equals(fragmentId))
                 Snackbar.make(getWindow().getDecorView(), R.string.tv_settings_hint, Snackbar.LENGTH_LONG).show();
         }
-
-        if (VLCApplication.showTvUi())
-            TvUtil.applyOverscanMargin(this);
     }
 
     @Override



More information about the Android mailing list