From b663880741c2450f7f7d850fe36644f978ca82fb Mon Sep 17 00:00:00 2001 From: hyunsu15 <48500411+hyunsu15@users.noreply.github.com> Date: Fri, 23 Dec 2022 05:14:41 +0900 Subject: [PATCH] refactor: apply return oriented programming convention (#248) Co-authored-by: oSumAtrIX --- .../videoplayer/DownloadButton.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/videoplayer/DownloadButton.java b/app/src/main/java/app/revanced/integrations/videoplayer/DownloadButton.java index 35f5bc97..86f70ec1 100644 --- a/app/src/main/java/app/revanced/integrations/videoplayer/DownloadButton.java +++ b/app/src/main/java/app/revanced/integrations/videoplayer/DownloadButton.java @@ -109,16 +109,19 @@ public class DownloadButton { isShowing = z; ImageView imageView = _button.get(); - if (_constraintLayout != null && imageView != null) { - if (z && isDownloadButtonEnabled) { - LogHelper.printDebug(() -> "Fading in"); - imageView.setVisibility(View.VISIBLE); - imageView.startAnimation(fadeIn); - } else if (imageView.getVisibility() == View.VISIBLE) { - LogHelper.printDebug(() -> "Fading out"); - imageView.startAnimation(fadeOut); - imageView.setVisibility(View.GONE); - } + + if (_constraintLayout == null || imageView == null) + return; + + if (z && isDownloadButtonEnabled) { + LogHelper.printDebug(() -> "Fading in"); + imageView.setVisibility(View.VISIBLE); + imageView.startAnimation(fadeIn); + } + else if (imageView.getVisibility() == View.VISIBLE) { + LogHelper.printDebug(() -> "Fading out"); + imageView.startAnimation(fadeOut); + imageView.setVisibility(View.GONE); } }