Commit 5220a43e authored by Geoffrey Métais's avatar Geoffrey Métais

Hide FAB on audio player expansion

parent 0957f280
......@@ -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) {
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment