changed comments fragment loading animation

This commit is contained in:
Ritvik Saraf 2018-09-23 15:22:45 +05:30
parent 7047b62442
commit 66c753f3a3
2 changed files with 6 additions and 2 deletions

View File

@ -70,7 +70,7 @@ import static org.schabi.newpipe.util.AnimationUtils.animateView;
public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> { public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
private CompositeDisposable disposables = new CompositeDisposable(); private CompositeDisposable disposables = new CompositeDisposable();
private boolean initialLoad = true;
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
// Views // Views
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@ -152,6 +152,10 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
@Override @Override
public void handleResult(@NonNull CommentsInfo result) { public void handleResult(@NonNull CommentsInfo result) {
super.handleResult(result); super.handleResult(result);
if(initialLoad){
itemsList.smoothScrollToPosition(infoListAdapter.getItemCount());
initialLoad = false;
}
if (!result.getErrors().isEmpty()) { if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_COMMENTS, NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0); showSnackBarError(result.getErrors(), UserAction.REQUESTED_COMMENTS, NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);

View File

@ -338,7 +338,7 @@ public class NavigationHelper {
String url, String url,
String name) { String name) {
if (name == null) 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)) .replace(R.id.fragment_holder, CommentsFragment.getInstance(serviceId, url, name))
.addToBackStack(null) .addToBackStack(null)
.commit(); .commit();