From ceaacc771d45dce82408688d7c5aaf3ea962ef54 Mon Sep 17 00:00:00 2001 From: Ritvik Saraf <13ritvik@gmail.com> Date: Wed, 19 Dec 2018 10:58:59 +0530 Subject: [PATCH] removed jerky animations --- .../fragments/detail/VideoDetailFragment.java | 44 +++-------------- .../list/comments/CommentsFragment.java | 47 ------------------- 2 files changed, 6 insertions(+), 85 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 9a0c3b1b0..c8e8a387b 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 @@ -16,10 +16,8 @@ import android.support.annotation.Nullable; import android.support.design.widget.AppBarLayout; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; import android.support.v4.content.ContextCompat; import android.support.v4.view.ViewPager; -import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; @@ -767,11 +765,9 @@ public class VideoDetailFragment initTabs(); if (scrollToTop) appBarLayout.setExpanded(true, true); - animateView(contentRootLayoutHiding, - false, 0, 0, () -> { - handleResult(info); - showContentWithAnimation(120, 0, .01f); - }); + handleResult(info); + showContent(); + } protected void prepareAndLoadInfo() { @@ -794,8 +790,8 @@ public class VideoDetailFragment .subscribe((@NonNull StreamInfo result) -> { isLoading.set(false); currentInfo = result; - showContentWithAnimation(120, 0, 0); handleResult(result); + showContent(); }, (@NonNull Throwable throwable) -> { isLoading.set(false); onError(throwable); @@ -960,36 +956,8 @@ public class VideoDetailFragment thumbnailImageView.setMinimumHeight(height); } - private void showContentWithAnimation(long duration, - long delay, - @FloatRange(from = 0.0f, to = 1.0f) float translationPercent) { - int translationY = (int) (getResources().getDisplayMetrics().heightPixels * - (translationPercent > 0.0f ? translationPercent : .06f)); - - contentRootLayoutHiding.animate().setListener(null).cancel(); - contentRootLayoutHiding.setAlpha(0f); - contentRootLayoutHiding.setTranslationY(translationY); + private void showContent() { contentRootLayoutHiding.setVisibility(View.VISIBLE); - contentRootLayoutHiding.animate() - .alpha(1f) - .translationY(0) - .setStartDelay(delay) - .setDuration(duration) - .setInterpolator(new FastOutSlowInInterpolator()) - .start(); - - uploaderRootLayout.animate().setListener(null).cancel(); - uploaderRootLayout.setAlpha(0f); - uploaderRootLayout.setTranslationY(translationY); - uploaderRootLayout.setVisibility(View.VISIBLE); - uploaderRootLayout.animate() - .alpha(1f) - .translationY(0) - .setStartDelay((long) (duration * .5f) + delay) - .setDuration(duration) - .setInterpolator(new FastOutSlowInInterpolator()) - .start(); - } protected void setInitialData(int serviceId, String url, String name) { @@ -1024,7 +992,7 @@ public class VideoDetailFragment public void showLoading() { super.showLoading(); - animateView(contentRootLayoutHiding, false, 200); + 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/fragments/list/comments/CommentsFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentsFragment.java index 21d01be16..c930888f2 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentsFragment.java @@ -1,72 +1,25 @@ package org.schabi.newpipe.fragments.list.comments; -import android.app.Activity; import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.net.Uri; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.ActionBar; -import android.text.TextUtils; -import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; -import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; - -import com.jakewharton.rxbinding2.view.RxView; import org.schabi.newpipe.R; -import org.schabi.newpipe.database.subscription.SubscriptionEntity; -import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.channel.ChannelInfo; import org.schabi.newpipe.extractor.comments.CommentsInfo; -import org.schabi.newpipe.extractor.exceptions.ExtractionException; -import org.schabi.newpipe.extractor.stream.StreamInfoItem; -import org.schabi.newpipe.fragments.detail.VideoDetailFragment; import org.schabi.newpipe.fragments.list.BaseListInfoFragment; -import org.schabi.newpipe.info_list.InfoItemDialog; -import org.schabi.newpipe.local.dialog.PlaylistAppendDialog; -import org.schabi.newpipe.local.subscription.SubscriptionService; -import org.schabi.newpipe.player.playqueue.ChannelPlayQueue; -import org.schabi.newpipe.player.playqueue.PlayQueue; -import org.schabi.newpipe.player.playqueue.SinglePlayQueue; import org.schabi.newpipe.report.UserAction; -import org.schabi.newpipe.util.AnimationUtils; import org.schabi.newpipe.util.ExtractorHelper; -import org.schabi.newpipe.util.ImageDisplayConstants; -import org.schabi.newpipe.util.Localization; -import org.schabi.newpipe.util.NavigationHelper; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import io.reactivex.Observable; import io.reactivex.Single; -import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; -import io.reactivex.disposables.Disposable; -import io.reactivex.functions.Action; -import io.reactivex.functions.Consumer; -import io.reactivex.functions.Function; -import io.reactivex.schedulers.Schedulers; - -import static org.schabi.newpipe.util.AnimationUtils.animateBackgroundColor; -import static org.schabi.newpipe.util.AnimationUtils.animateTextColor; -import static org.schabi.newpipe.util.AnimationUtils.animateView; public class CommentsFragment extends BaseListInfoFragment {