[Android] Prevent audio player to hide view content

Geoffrey Métais git at videolan.org
Tue Nov 8 13:47:11 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov  8 13:46:31 2016 +0100| [e003fb5c1621dfccd509c21ad0497d653c6bb64b] | committer: Geoffrey Métais

Prevent audio player to hide view content

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

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 52088d1..eb7aec0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -37,6 +37,7 @@ import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.design.widget.AppBarLayout;
 import android.support.design.widget.BottomSheetBehavior;
+import android.support.design.widget.CoordinatorLayout;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v7.app.ActionBar;
@@ -46,6 +47,7 @@ import android.support.v7.widget.Toolbar;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.FrameLayout;
 import android.widget.TextView;
 
 import org.videolan.medialibrary.Medialibrary;
@@ -85,6 +87,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
     private final PlaybackServiceActivity.Helper mHelper = new PlaybackServiceActivity.Helper(this, this);
     protected PlaybackService mService;
     protected BottomSheetBehavior mBottomSheetBehavior;
+    private FrameLayout mFragmentContainer;
 
     protected boolean mPreventRescan = false;
 
@@ -121,6 +124,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
     @Override
     protected void onPostCreate(@Nullable Bundle savedInstanceState) {
         super.onPostCreate(savedInstanceState);
+        mFragmentContainer = (FrameLayout) findViewById(R.id.fragment_placeholder);
     }
 
     @Override
@@ -229,6 +233,9 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
             mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
             mActionBar.collapseActionView();
             mAppBarLayout.setExpanded(false, true);
+            CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) mFragmentContainer.getLayoutParams();
+            lp.bottomMargin = mBottomSheetBehavior.getPeekHeight();
+            mFragmentContainer.setLayoutParams(lp);
         }
     }
 
@@ -260,6 +267,9 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
     public void hideAudioPlayer() {
         mBottomSheetBehavior.setHideable(true);
         mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
+        CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) mFragmentContainer.getLayoutParams();
+        lp.bottomMargin = 0;
+        mFragmentContainer.setLayoutParams(lp);
     }
 
     private final BroadcastReceiver messageReceiver = new BroadcastReceiver() {



More information about the Android mailing list