From 66c753f3a3845346249b4ef5a92e891b01ffd094 Mon Sep 17 00:00:00 2001 From: Ritvik Saraf <13ritvik@gmail.com> Date: Sun, 23 Sep 2018 15:22:45 +0530 Subject: [PATCH] changed comments fragment loading animation --- .../newpipe/fragments/list/comments/CommentsFragment.java | 6 +++++- .../main/java/org/schabi/newpipe/util/NavigationHelper.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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 78787107a..3e9cfe44c 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 @@ -70,7 +70,7 @@ import static org.schabi.newpipe.util.AnimationUtils.animateView; public class CommentsFragment extends BaseListInfoFragment { private CompositeDisposable disposables = new CompositeDisposable(); - + private boolean initialLoad = true; /*////////////////////////////////////////////////////////////////////////// // Views //////////////////////////////////////////////////////////////////////////*/ @@ -152,6 +152,10 @@ public class CommentsFragment extends BaseListInfoFragment { @Override public void handleResult(@NonNull CommentsInfo result) { super.handleResult(result); + if(initialLoad){ + itemsList.smoothScrollToPosition(infoListAdapter.getItemCount()); + initialLoad = false; + } if (!result.getErrors().isEmpty()) { showSnackBarError(result.getErrors(), UserAction.REQUESTED_COMMENTS, NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0); diff --git a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java index 27cf7bf71..77bcec10b 100644 --- a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java @@ -338,7 +338,7 @@ public class NavigationHelper { String url, String name) { if (name == null) name = ""; - defaultTransaction(fragmentManager) + fragmentManager.beginTransaction().setCustomAnimations(R.anim.switch_service_in, R.anim.switch_service_out) .replace(R.id.fragment_holder, CommentsFragment.getInstance(serviceId, url, name)) .addToBackStack(null) .commit();