From d87e488c236ed576675f25c3d27d815cab0e31f7 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Sat, 29 Feb 2020 22:13:07 +0300 Subject: [PATCH] Fix for a ripple effect on a button --- .../java/org/schabi/newpipe/player/VideoPlayerImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java index 4aa10fe9a..d026ff8cf 100644 --- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java +++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java @@ -320,7 +320,7 @@ public class VideoPlayerImpl extends VideoPlayer moreOptionsButton.setVisibility(View.VISIBLE); getTopControlsRoot().setOrientation(LinearLayout.VERTICAL); primaryControls.getLayoutParams().width = LinearLayout.LayoutParams.MATCH_PARENT; - secondaryControls.setVisibility(View.GONE); + secondaryControls.setVisibility(View.INVISIBLE); moreOptionsButton.setImageDrawable(service.getResources().getDrawable( R.drawable.ic_expand_more_white_24dp)); shareButton.setVisibility(View.VISIBLE); @@ -715,7 +715,12 @@ public class VideoPlayerImpl extends VideoPlayer animateRotation(moreOptionsButton, DEFAULT_CONTROLS_DURATION, isMoreControlsVisible ? 0 : 180); animateView(secondaryControls, SLIDE_AND_ALPHA, !isMoreControlsVisible, - DEFAULT_CONTROLS_DURATION); + DEFAULT_CONTROLS_DURATION, 0, + () -> { + // Fix for a ripple effect on background drawable. When view returns from GONE state it takes more + // milliseconds than returning from INVISIBLE state. And the delay makes ripple background end to fast + if (isMoreControlsVisible) secondaryControls.setVisibility(View.INVISIBLE); + }); showControls(DEFAULT_CONTROLS_DURATION); }