[Android] Ensure correct visibility of content & audio player

Geoffrey Métais git at videolan.org
Wed Dec 14 12:34:00 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 14 12:33:39 2016 +0100| [570770f400cd96c14b2eb178d8c7f09480c71c2f] | committer: Geoffrey Métais

Ensure correct visibility of content & audio player

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

 .../org/videolan/vlc/gui/AudioPlayerContainerActivity.java  | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 54b0d3a..bcaa488 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -119,6 +119,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
         mAudioPLayerContainer = (FrameLayout) findViewById(R.id.audio_player_container);
         mBottomSheetBehavior = BottomSheetBehavior.from(mAudioPLayerContainer);
         mBottomSheetBehavior.setHideable(true);
+        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
         mBottomSheetBehavior.setPeekHeight(getResources().getDimensionPixelSize(R.dimen.player_peek_height));
         mBottomSheetBehavior.setBottomSheetCallback(mAudioPlayerBottomSheetCallback);
     }
@@ -164,9 +165,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
     protected void onStop() {
         super.onStop();
         unregisterReceiver(storageReceiver);
-        try {
-            unregisterReceiver(messageReceiver);
-        } catch (IllegalArgumentException e) {}
+        unregisterReceiver(messageReceiver);
         mHelper.onStop();
     }
 
@@ -238,11 +237,13 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
      * Show the audio player.
      */
     public void showAudioPlayer() {
-        mAudioPLayerContainer.setVisibility(View.VISIBLE);
+        if (mAudioPLayerContainer.getVisibility() == View.GONE) {
+            mAudioPLayerContainer.setVisibility(View.VISIBLE);
+            mFragmentContainer.setPadding(0, 0, 0, mBottomSheetBehavior.getPeekHeight());
+        }
         if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) {
             mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
             mActionBar.collapseActionView();
-            mAppBarLayout.setExpanded(false, true);
         }
     }
 
@@ -332,7 +333,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
 
     private static class StorageHandler extends WeakHandler<AudioPlayerContainerActivity> {
 
-        public StorageHandler(AudioPlayerContainerActivity owner) {
+        StorageHandler(AudioPlayerContainerActivity owner) {
             super(owner);
         }
 



More information about the Android mailing list