Simplified some code and added some comments

This commit is contained in:
litetex 2021-11-05 19:07:56 +01:00
parent b0a10f0542
commit a23f941ac8

View file

@ -99,6 +99,8 @@ public class PlayerGestureListener
+ player.getPlayerType() + "], portion = [" + portion + "]"); + player.getPlayerType() + "], portion = [" + portion + "]");
} }
if (playerType == MainPlayer.PlayerType.VIDEO) { if (playerType == MainPlayer.PlayerType.VIDEO) {
// -- Brightness and Volume control --
final boolean isBrightnessGestureEnabled = final boolean isBrightnessGestureEnabled =
PlayerHelper.isBrightnessGestureEnabled(service); PlayerHelper.isBrightnessGestureEnabled(service);
final boolean isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(service); final boolean isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(service);
@ -117,15 +119,14 @@ public class PlayerGestureListener
} }
} else /* MainPlayer.PlayerType.POPUP */ { } else /* MainPlayer.PlayerType.POPUP */ {
// -- Determine if the ClosingOverlayView (red X) has to be shown or hidden --
final View closingOverlayView = player.getClosingOverlayView(); final View closingOverlayView = player.getClosingOverlayView();
if (player.isInsideClosingRadius(movingEvent)) { final boolean showClosingOverlayView = player.isInsideClosingRadius(movingEvent);
if (closingOverlayView.getVisibility() == View.GONE) { // Check if an view is in expected state and if not animate it into the correct state
animate(closingOverlayView, true, 200); final int expectedVisibility = showClosingOverlayView ? View.VISIBLE : View.GONE;
} if (closingOverlayView.getVisibility() != expectedVisibility) {
} else { animate(closingOverlayView, showClosingOverlayView, 200);
if (closingOverlayView.getVisibility() == View.VISIBLE) {
animate(closingOverlayView, false, 200);
}
} }
} }
} }