make the view more post view button scroll to the last viewed post

refactor-toolbar
Floens 8 years ago
parent 7391303d35
commit d36f263db2
  1. 9
      Clover/app/src/main/java/org/floens/chan/core/presenter/ThreadPresenter.java
  2. 2
      Clover/app/src/main/java/org/floens/chan/ui/layout/ThreadLayout.java

@ -319,6 +319,15 @@ public class ThreadPresenter implements ChanLoader.ChanLoaderCallback, PostAdapt
showPosts(); showPosts();
} }
public void onNewPostsViewClicked() {
Post post = findPostById(loadable.lastViewed);
if (post != null) {
scrollToPost(post, true);
} else {
scrollTo(-1, true);
}
}
public void scrollTo(int displayPosition, boolean smooth) { public void scrollTo(int displayPosition, boolean smooth) {
threadPresenterCallback.scrollTo(displayPosition, smooth); threadPresenterCallback.scrollTo(displayPosition, smooth);
} }

@ -454,7 +454,7 @@ public class ThreadLayout extends CoordinatorLayout implements ThreadPresenter.T
@Override @Override
public void onClick(View v) { public void onClick(View v) {
newPostsNotification = null; newPostsNotification = null;
presenter.scrollTo(-1, true); presenter.onNewPostsViewClicked();
} }
}).show(); }).show();
fixSnackbarText(getContext(), newPostsNotification); fixSnackbarText(getContext(), newPostsNotification);

Loading…
Cancel
Save