From cea706d14a0a9c7d6e2fb7664a3e55d552cb9721 Mon Sep 17 00:00:00 2001 From: Coffeemakr Date: Tue, 27 Jun 2017 12:44:20 +0200 Subject: [PATCH] Synchronize initRealtedVideoStreams* --- .../fragments/detail/VideoDetailFragment.java | 17 ++++++----------- .../org/schabi/newpipe/util/AnimationUtils.java | 4 ++-- 2 files changed, 8 insertions(+), 13 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 3a5320156..04860a650 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 @@ -768,7 +768,7 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor if (peek.getInfo() != null) { final StreamInfo streamInfo = peek.getInfo(); - uiHandler.post(new Runnable() { + getActivity().runOnUiThread(new Runnable() { @Override public void run() { selectAndHandleInfo(streamInfo); @@ -932,16 +932,11 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor animateView(spinnerToolbar, true, 500); setupActionBarHandler(info); initThumbnailViews(info); - uiHandler.post(new Runnable() { - @Override - public void run() { - initRelatedVideos(info); - if (wasRelatedStreamsExpanded) { - toggleExpandRelatedVideos(currentStreamInfo); - wasRelatedStreamsExpanded = false; - } - } - }); + initRelatedVideos(info); + if (wasRelatedStreamsExpanded) { + toggleExpandRelatedVideos(currentStreamInfo); + wasRelatedStreamsExpanded = false; + } setTitleToUrl(info.webpage_url, info.title); setStreamInfoToUrl(info.webpage_url, info); diff --git a/app/src/main/java/org/schabi/newpipe/util/AnimationUtils.java b/app/src/main/java/org/schabi/newpipe/util/AnimationUtils.java index 7fb64213a..c37eaa560 100644 --- a/app/src/main/java/org/schabi/newpipe/util/AnimationUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/AnimationUtils.java @@ -55,14 +55,14 @@ public class AnimationUtils { view.animate().setListener(null).cancel(); view.setVisibility(View.VISIBLE); view.setAlpha(1f); - if (execOnEnd != null) view.post(execOnEnd); + if (execOnEnd != null) execOnEnd.run(); return; } else if ((view.getVisibility() == View.GONE || view.getVisibility() == View.INVISIBLE) && !enterOrExit) { if (DEBUG) Log.d(TAG, "animateView() view was already gone > view = [" + view + "]"); view.animate().setListener(null).cancel(); view.setVisibility(View.GONE); view.setAlpha(0f); - if (execOnEnd != null) view.post(execOnEnd); + if (execOnEnd != null) execOnEnd.run(); return; }