[Android] Hide FAB on audio player expansion
Geoffrey Métais
git at videolan.org
Thu Feb 16 11:57:02 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 16 11:55:26 2017 +0100| [5220a43ee29f6e359826702eccfa097d4c740316] | committer: Geoffrey Métais
Hide FAB on audio player expansion
> https://code.videolan.org/videolan/vlc-android/commit/5220a43ee29f6e359826702eccfa097d4c740316
---
vlc-android/src/org/videolan/vlc/gui/InfoActivity.java | 10 ++++++++++
vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java | 7 +++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/InfoActivity.java b/vlc-android/src/org/videolan/vlc/gui/InfoActivity.java
index 63cfb10..b03dcfd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/InfoActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/InfoActivity.java
@@ -10,6 +10,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
+import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.text.TextUtils;
@@ -121,6 +122,15 @@ public class InfoActivity extends AudioPlayerContainerActivity implements View.O
finish();
}
+ @Override
+ protected void onPlayerStateChanged(View bottomSheet, int newState) {
+ int visibility = mBinding.fab.getVisibility();
+ if (visibility == View.VISIBLE && newState != BottomSheetBehavior.STATE_COLLAPSED && newState != BottomSheetBehavior.STATE_HIDDEN)
+ mBinding.fab.setVisibility(View.INVISIBLE);
+ else if (visibility == View.INVISIBLE && (newState == BottomSheetBehavior.STATE_COLLAPSED || newState == BottomSheetBehavior.STATE_HIDDEN))
+ mBinding.fab.show();
+ }
+
private class CheckFileTask extends AsyncTask<Void, Void, File> {
private void checkSubtitles(File itemFile) {
diff --git a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
index fcdb667..484c047 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
@@ -195,8 +195,11 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
@Override
protected void onPlayerStateChanged(View bottomSheet, int newState) {
- if (newState == BottomSheetBehavior.STATE_EXPANDED)
- mAppBarLayout.setExpanded(false, true);
+ int visibility = mBinding.fab.getVisibility();
+ if (visibility == View.VISIBLE && newState != BottomSheetBehavior.STATE_COLLAPSED && newState != BottomSheetBehavior.STATE_HIDDEN)
+ mBinding.fab.setVisibility(View.INVISIBLE);
+ else if (visibility == View.INVISIBLE && (newState == BottomSheetBehavior.STATE_COLLAPSED || newState == BottomSheetBehavior.STATE_HIDDEN))
+ mBinding.fab.show();
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
More information about the Android
mailing list