Check the presence of the context

This commit is contained in:
CappielloAntonio 2021-12-22 16:47:50 +01:00
parent b60c5448b2
commit c1c1c3acfa
3 changed files with 17 additions and 4 deletions

View file

@ -163,6 +163,7 @@ public class MainActivity extends BaseActivity {
break;
case BottomSheetBehavior.STATE_COLLAPSED:
if (playerBottomSheetFragment != null) {
playerBottomSheetFragment.scrollOnTop();
playerBottomSheetFragment.goBackToFirstPage();
}
case BottomSheetBehavior.STATE_SETTLING:
@ -172,6 +173,7 @@ public class MainActivity extends BaseActivity {
break;
case BottomSheetBehavior.STATE_EXPANDED:
if (playerBottomSheetFragment != null) {
playerBottomSheetFragment.scrollOnTop();
setBottomSheetDraggableState(playerBottomSheetFragment.isViewPagerInFirstPage());
}
case BottomSheetBehavior.STATE_DRAGGING:

View file

@ -6,6 +6,7 @@ import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
@ -26,11 +27,16 @@ public class PlayerCoverFragment extends Fragment {
View view = bind.getRoot();
playerBottomSheetViewModel = new ViewModelProvider(requireActivity()).get(PlayerBottomSheetViewModel.class);
init();
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
init();
}
@Override
public void onDestroyView() {
super.onDestroyView();

View file

@ -29,11 +29,16 @@ public class PlayerLyricsFragment extends Fragment {
View view = bind.getRoot();
playerBottomSheetViewModel = new ViewModelProvider(requireActivity()).get(PlayerBottomSheetViewModel.class);
initLyrics();
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initLyrics();
}
@Override
public void onDestroyView() {
super.onDestroyView();