From 5aced46345c4e283123236885eb47259e3fc2fea Mon Sep 17 00:00:00 2001 From: yausername <13ritvik@gmail.com> Date: Wed, 7 Aug 2019 15:30:47 +0530 Subject: [PATCH] remove controls animation/flicker --- .../newpipe/fragments/detail/VideoDetailFragment.java | 10 +++++++--- .../java/org/schabi/newpipe/util/ExtractorHelper.java | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 5202c4b2a..9d8481251 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -75,7 +75,6 @@ import org.schabi.newpipe.player.playqueue.PlayQueue; import org.schabi.newpipe.player.playqueue.SinglePlayQueue; import org.schabi.newpipe.report.ErrorActivity; import org.schabi.newpipe.report.UserAction; -import org.schabi.newpipe.util.AnimationUtils; import org.schabi.newpipe.util.Constants; import org.schabi.newpipe.util.ExtractorHelper; import org.schabi.newpipe.util.ImageDisplayConstants; @@ -963,7 +962,7 @@ public class VideoDetailFragment } private void showContent() { - AnimationUtils.slideUp(contentRootLayoutHiding,120, 96, 0.06f); + contentRootLayoutHiding.setVisibility(View.VISIBLE); } protected void setInitialData(int serviceId, String url, String name) { @@ -996,9 +995,14 @@ public class VideoDetailFragment @Override public void showLoading() { + super.showLoading(); - contentRootLayoutHiding.setVisibility(View.INVISIBLE); + //if data is already cached, transition from VISIBLE -> INVISIBLE -> VISIBLE is not required + if(!ExtractorHelper.isCached(serviceId, url, InfoItem.InfoType.STREAM)){ + contentRootLayoutHiding.setVisibility(View.INVISIBLE); + } + animateView(spinnerToolbar, false, 200); animateView(thumbnailPlayButton, false, 50); animateView(detailDurationView, false, 100); diff --git a/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java b/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java index b70e5fdef..c4471942e 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/ExtractorHelper.java @@ -228,6 +228,10 @@ public final class ExtractorHelper { }); } + public static boolean isCached(final int serviceId, final String url, InfoItem.InfoType infoType) { + return null != loadFromCache(serviceId, url, infoType).blockingGet(); + } + /** * A simple and general error handler that show a Toast for known exceptions, and for others, opens the report error activity with the (optional) error message. */