Skip to content

Commit

Permalink
Remove uses of setBottomSheetCallback().
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Jul 25, 2022
1 parent dcb332e commit 81fb44c
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ public final class VideoDetailFragment
private Player player;
private final PlayerHolder playerHolder = PlayerHolder.getInstance();

private BottomSheetBehavior.BottomSheetCallback bottomSheetCallback;

/*//////////////////////////////////////////////////////////////////////////
// Service management
//////////////////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -386,7 +388,7 @@ public void onDestroy() {
disposables.clear();
positionSubscriber = null;
currentWorker = null;
bottomSheetBehavior.setBottomSheetCallback(null);
bottomSheetBehavior.removeBottomSheetCallback(bottomSheetCallback);

if (activity.isFinishing()) {
playQueue = null;
Expand Down Expand Up @@ -2289,7 +2291,7 @@ private void setupBottomPlayer() {
}
}

bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
bottomSheetCallback = new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull final View bottomSheet, final int newState) {
bottomSheetState = newState;
Expand Down Expand Up @@ -2343,20 +2345,24 @@ && isPlayerAvailable()
}
if (isPlayerAvailable()) {
player.UIs().get(MainPlayerUi.class).ifPresent(ui -> {
if (ui.isControlsVisible()) {
ui.hideControls(0, 0);
}
if (ui.isControlsVisible()) {
ui.hideControls(0, 0);
}
});
}
break;
case BottomSheetBehavior.STATE_HALF_EXPANDED:
break;
}
}

@Override
public void onSlide(@NonNull final View bottomSheet, final float slideOffset) {
setOverlayLook(binding.appBarLayout, behavior, slideOffset);
}
});
};

bottomSheetBehavior.addBottomSheetCallback(bottomSheetCallback);

// User opened a new page and the player will hide itself
activity.getSupportFragmentManager().addOnBackStackChangedListener(() -> {
Expand Down

0 comments on commit 81fb44c

Please sign in to comment.