scroll last comment into view
This commit is contained in:
parent
8b064d77b8
commit
df5e35e315
5 changed files with 59 additions and 9 deletions
|
|
@ -74,6 +74,7 @@ import org.schabi.newpipe.error.UserAction;
|
|||
import org.schabi.newpipe.extractor.Image;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
|
||||
import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.stream.AudioStream;
|
||||
|
|
@ -1012,6 +1013,14 @@ public final class VideoDetailFragment
|
|||
updateTabLayoutVisibility();
|
||||
}
|
||||
|
||||
public void scrollToComment(final CommentsInfoItem comment) {
|
||||
final Fragment fragment = pageAdapter.getItem(
|
||||
pageAdapter.getItemPositionByTitle(COMMENTS_TAB_TAG));
|
||||
if (fragment instanceof CommentsFragment) {
|
||||
((CommentsFragment) fragment).scrollToComment(comment);
|
||||
}
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Play Utils
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
|
|
|||
|
|
@ -159,4 +159,10 @@ public final class CommentRepliesFragment
|
|||
return ItemViewMode.LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the comment to which the replies are shown
|
||||
*/
|
||||
public CommentsInfoItem getCommentsInfoItem() {
|
||||
return commentsInfoItem;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,4 +110,8 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfoItem, Com
|
|||
protected ItemViewMode getItemViewMode() {
|
||||
return ItemViewMode.LIST;
|
||||
}
|
||||
|
||||
public void scrollToComment(final CommentsInfoItem comment) {
|
||||
itemsList.scrollToPosition(infoListAdapter.getItemsList().indexOf(comment));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue