added commentsInfo in streamInfo
This commit is contained in:
parent
08127e5806
commit
219922cd82
2 changed files with 12 additions and 12 deletions
|
@ -55,7 +55,7 @@ dependencies {
|
||||||
exclude module: 'support-annotations'
|
exclude module: 'support-annotations'
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation 'com.github.yausername:NewPipeExtractor:5242bda'
|
implementation 'com.github.yausername:NewPipeExtractor:4794e16'
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:2.8.9'
|
testImplementation 'org.mockito:mockito-core:2.8.9'
|
||||||
|
|
|
@ -54,6 +54,7 @@ import org.schabi.newpipe.ReCaptchaActivity;
|
||||||
import org.schabi.newpipe.download.DownloadDialog;
|
import org.schabi.newpipe.download.DownloadDialog;
|
||||||
import org.schabi.newpipe.extractor.InfoItem;
|
import org.schabi.newpipe.extractor.InfoItem;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.comments.CommentsInfo;
|
||||||
import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
|
import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
|
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
@ -252,7 +253,7 @@ public class VideoDetailFragment
|
||||||
if ((updateFlags & RELATED_STREAMS_UPDATE_FLAG) != 0)
|
if ((updateFlags & RELATED_STREAMS_UPDATE_FLAG) != 0)
|
||||||
initRelatedVideos(currentInfo);
|
initRelatedVideos(currentInfo);
|
||||||
if ((updateFlags & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBar(currentInfo);
|
if ((updateFlags & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBar(currentInfo);
|
||||||
if ((updateFlags & COMMENTS_UPDATE_FLAG) != 0) initComments(currentInfo);
|
if ((updateFlags & COMMENTS_UPDATE_FLAG) != 0) initComments(currentInfo.getCommentsInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((updateFlags & TOOLBAR_ITEMS_UPDATE_FLAG) != 0
|
if ((updateFlags & TOOLBAR_ITEMS_UPDATE_FLAG) != 0
|
||||||
|
@ -343,8 +344,7 @@ public class VideoDetailFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoading.get() && currentInfo != null && isVisible()) {
|
if (!isLoading.get() && currentInfo != null && isVisible()) {
|
||||||
//TODO fix this. it should not be commented
|
outState.putSerializable(INFO_KEY, currentInfo);
|
||||||
//outState.putSerializable(INFO_KEY, currentInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outState.putSerializable(STACK_KEY, stack);
|
outState.putSerializable(STACK_KEY, stack);
|
||||||
|
@ -425,7 +425,7 @@ public class VideoDetailFragment
|
||||||
toggleExpandRelatedVideos(currentInfo);
|
toggleExpandRelatedVideos(currentInfo);
|
||||||
break;
|
break;
|
||||||
case R.id.detail_comments_expand:
|
case R.id.detail_comments_expand:
|
||||||
toggleExpandComments(currentInfo);
|
toggleExpandComments(currentInfo.getCommentsInfo());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,9 +488,9 @@ public class VideoDetailFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void toggleExpandComments(StreamInfo info) {
|
private void toggleExpandComments(CommentsInfo info) {
|
||||||
if (DEBUG) Log.d(TAG, "toggleExpandComments() called with: info = [" + info + "]");
|
if (DEBUG) Log.d(TAG, "toggleExpandComments() called with: info = [" + info + "]");
|
||||||
if (!showComments) return;
|
if (!showComments || null == info) return;
|
||||||
|
|
||||||
int initialCount = INITIAL_COMMENTS;
|
int initialCount = INITIAL_COMMENTS;
|
||||||
|
|
||||||
|
@ -519,11 +519,11 @@ public class VideoDetailFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMoreComments(StreamInfo info) {
|
private void loadMoreComments(CommentsInfo info) {
|
||||||
if (commentsDisposable != null) commentsDisposable.dispose();
|
if (commentsDisposable != null) commentsDisposable.dispose();
|
||||||
|
|
||||||
commentsDisposable = Single.fromCallable(() -> {
|
commentsDisposable = Single.fromCallable(() -> {
|
||||||
StreamInfo.loadMoreComments(info);
|
CommentsInfo.loadMoreComments(info);
|
||||||
return info.getComments();
|
return info.getComments();
|
||||||
}).subscribeOn(Schedulers.io()).doOnError(e -> info.addError(e)).subscribe();
|
}).subscribeOn(Schedulers.io()).doOnError(e -> info.addError(e)).subscribe();
|
||||||
}
|
}
|
||||||
|
@ -756,10 +756,10 @@ public class VideoDetailFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initComments(StreamInfo info) {
|
private void initComments(CommentsInfo info) {
|
||||||
if (commentsView.getChildCount() > 0) commentsView.removeAllViews();
|
if (commentsView.getChildCount() > 0) commentsView.removeAllViews();
|
||||||
|
|
||||||
if (info.getComments() != null
|
if (null != info && info.getComments() != null
|
||||||
&& !info.getComments().isEmpty() && showComments) {
|
&& !info.getComments().isEmpty() && showComments) {
|
||||||
//long first = System.nanoTime(), each;
|
//long first = System.nanoTime(), each;
|
||||||
int to = info.getComments().size() >= INITIAL_RELATED_VIDEOS
|
int to = info.getComments().size() >= INITIAL_RELATED_VIDEOS
|
||||||
|
@ -1360,7 +1360,7 @@ public class VideoDetailFragment
|
||||||
setupActionBar(info);
|
setupActionBar(info);
|
||||||
initThumbnailViews(info);
|
initThumbnailViews(info);
|
||||||
initRelatedVideos(info);
|
initRelatedVideos(info);
|
||||||
initComments(info);
|
initComments(info.getCommentsInfo());
|
||||||
|
|
||||||
if (wasRelatedStreamsExpanded) {
|
if (wasRelatedStreamsExpanded) {
|
||||||
toggleExpandRelatedVideos(currentInfo);
|
toggleExpandRelatedVideos(currentInfo);
|
||||||
|
|
Loading…
Reference in a new issue