[Android] Ensure content is not hidden on activities switch

Geoffrey Métais git at videolan.org
Tue Nov 15 10:07:41 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 15 10:06:52 2016 +0100| [26e3bd5d2cf44776c7458ae8b49593d4c35df770] | committer: Geoffrey Métais

Ensure content is not hidden on activities switch

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 4dd49a6..34eed20 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -153,6 +153,13 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
     }
 
     @Override
+    protected void onResume() {
+        super.onResume();
+        if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED)
+            liftContentOverPlayer();
+    }
+
+    @Override
     protected void onStop() {
         super.onStop();
         unregisterReceiver(storageReceiver);
@@ -234,12 +241,16 @@ 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);
+            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.



More information about the Android mailing list