[Android] Fix the scrolling behavior whith audioplayer shown

Geoffrey Métais git at videolan.org
Thu Dec 8 11:15:53 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec  8 11:14:04 2016 +0100| [d347cc155e6d13e9f3f6fb7e6cfb02171970e64b] | committer: Geoffrey Métais

Fix the scrolling behavior whith audioplayer shown

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

 .../videolan/vlc/gui/AudioPlayerContainerActivity.java    | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 0eebbe8..54b0d3a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -37,7 +37,6 @@ 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;
@@ -158,7 +157,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
     protected void onResume() {
         super.onResume();
         if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED)
-            liftContentOverPlayer();
+            mFragmentContainer.setPadding(0, 0, 0, mBottomSheetBehavior.getPeekHeight());
     }
 
     @Override
@@ -244,16 +243,9 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
             mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
             mActionBar.collapseActionView();
             mAppBarLayout.setExpanded(false, true);
-            liftContentOverPlayer();
         }
     }
 
-    private void liftContentOverPlayer() {
-        CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) mFragmentContainer.getLayoutParams();
-        lp.bottomMargin = mBottomSheetBehavior.getPeekHeight();
-        mFragmentContainer.setLayoutParams(lp);
-    }
-
     /**
      * Slide down the audio player.
      * @return true on success else false.
@@ -282,9 +274,6 @@ 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() {
@@ -322,6 +311,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
                     mAudioPlayer.setHeaderVisibilities(false, false, true, true, true, false);
                     mAudioPlayer.setUserVisibleHint(false);
                     removeTipViewIfDisplayed();
+                    mFragmentContainer.setPadding(0, 0, 0, mBottomSheetBehavior.getPeekHeight());
                     break;
                 case BottomSheetBehavior.STATE_EXPANDED:
                     mBottomSheetBehavior.setHideable(false);
@@ -331,6 +321,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
                     break;
                 case BottomSheetBehavior.STATE_HIDDEN:
                     removeTipViewIfDisplayed();
+                    mFragmentContainer.setPadding(0, 0, 0, 0);
                     break;
             }
         }



More information about the Android mailing list