Merge pull request #188 from MitchellWT/master

Added check for slide value
This commit is contained in:
dkanada 2021-10-05 20:58:54 +09:00 committed by GitHub
commit 03a3c9a1f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -292,7 +292,8 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
@Override
public void onPanelSlide(View view, float slide) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// the isInfinite and isNan check fixes a bug where the app crashes due to an invalid slide value
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !Float.isInfinite(slide) && !Float.isNaN(slide)) {
float density = getResources().getDisplayMetrics().density;
binding.playingQueueCard.setCardElevation((6 * slide + 2) * density);
playbackControlsFragment.binding.playerPlayPauseFab.setElevation((2 * Math.max(0, (1 - (slide * 16))) + 2) * density);