Search in sources :

Example 6 with InfoItem

use of org.schabi.newpipe.extractor.InfoItem in project NewPipe by TeamNewPipe.

the class VideoDetailFragment method toggleExpandRelatedVideos.

private void toggleExpandRelatedVideos(StreamInfo info) {
    if (DEBUG)
        Log.d(TAG, "toggleExpandRelatedVideos() called with: info = [" + info + "]");
    if (!showRelatedStreams)
        return;
    int nextCount = info.getNextVideo() != null ? 2 : 0;
    int initialCount = INITIAL_RELATED_VIDEOS + nextCount;
    if (relatedStreamsView.getChildCount() > initialCount) {
        relatedStreamsView.removeViews(initialCount, relatedStreamsView.getChildCount() - (initialCount));
        relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable(activity, ThemeHelper.resolveResourceIdFromAttr(activity, R.attr.expand)));
        return;
    }
    // Log.d(TAG, "toggleExpandRelatedVideos() called with: info = [" + info + "], from = [" + INITIAL_RELATED_VIDEOS + "]");
    for (int i = INITIAL_RELATED_VIDEOS; i < info.getRelatedStreams().size(); i++) {
        InfoItem item = info.getRelatedStreams().get(i);
        // Log.d(TAG, "i = " + i);
        relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, item));
    }
    relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable(activity, ThemeHelper.resolveResourceIdFromAttr(activity, R.attr.collapse)));
}
Also used : InfoItem(org.schabi.newpipe.extractor.InfoItem) StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem)

Aggregations

InfoItem (org.schabi.newpipe.extractor.InfoItem)6 StreamInfoItem (org.schabi.newpipe.extractor.stream.StreamInfoItem)3 ArrayList (java.util.ArrayList)2 Point (android.graphics.Point)1 Nullable (android.support.annotation.Nullable)1 LinearLayout (android.widget.LinearLayout)1 MaybeObserver (io.reactivex.MaybeObserver)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 Disposable (io.reactivex.disposables.Disposable)1 HashSet (java.util.HashSet)1 SubscriptionEntity (org.schabi.newpipe.database.subscription.SubscriptionEntity)1 ChannelInfo (org.schabi.newpipe.extractor.channel.ChannelInfo)1 ChannelInfoItem (org.schabi.newpipe.extractor.channel.ChannelInfoItem)1 InfoItemBuilder (org.schabi.newpipe.info_list.InfoItemBuilder)1 PlayQueueItem (org.schabi.newpipe.playlist.PlayQueueItem)1 SinglePlayQueue (org.schabi.newpipe.playlist.SinglePlayQueue)1