|
52 | 52 | import org.schabi.newpipe.fragments.OnScrollBelowItemsListener; |
53 | 53 | import org.schabi.newpipe.fragments.detail.VideoDetailFragment; |
54 | 54 | import org.schabi.newpipe.info_list.StreamSegmentAdapter; |
| 55 | +import org.schabi.newpipe.info_list.StreamSegmentItem; |
55 | 56 | import org.schabi.newpipe.ktx.AnimationType; |
56 | 57 | import org.schabi.newpipe.local.dialog.PlaylistDialog; |
57 | 58 | import org.schabi.newpipe.player.Player; |
|
69 | 70 | import org.schabi.newpipe.util.DeviceUtils; |
70 | 71 | import org.schabi.newpipe.util.NavigationHelper; |
71 | 72 | import org.schabi.newpipe.util.external_communication.KoreUtils; |
| 73 | +import org.schabi.newpipe.util.external_communication.ShareUtils; |
72 | 74 |
|
73 | 75 | import java.util.List; |
74 | 76 | import java.util.Objects; |
@@ -644,7 +646,7 @@ private void onSegmentsClicked() { |
644 | 646 | private void buildSegments() { |
645 | 647 | binding.itemsList.setAdapter(segmentAdapter); |
646 | 648 | binding.itemsList.setClickable(true); |
647 | | - binding.itemsList.setLongClickable(false); |
| 649 | + binding.itemsList.setLongClickable(true); |
648 | 650 |
|
649 | 651 | binding.itemsList.clearOnScrollListeners(); |
650 | 652 | if (itemTouchHelper != null) { |
@@ -696,10 +698,24 @@ public void onScrolledDown(final RecyclerView recyclerView) { |
696 | 698 | } |
697 | 699 |
|
698 | 700 | private StreamSegmentAdapter.StreamSegmentListener getStreamSegmentListener() { |
699 | | - return (item, seconds) -> { |
700 | | - segmentAdapter.selectSegment(item); |
701 | | - player.seekTo(seconds * 1000L); |
702 | | - player.triggerProgressUpdate(); |
| 701 | + return new StreamSegmentAdapter.StreamSegmentListener() { |
| 702 | + @Override |
| 703 | + public void onItemClick(@NonNull final StreamSegmentItem item, final int seconds) { |
| 704 | + segmentAdapter.selectSegment(item); |
| 705 | + player.seekTo(seconds * 1000L); |
| 706 | + player.triggerProgressUpdate(); |
| 707 | + } |
| 708 | + |
| 709 | + @Override |
| 710 | + public void onItemLongClick(@NonNull final StreamSegmentItem item, final int seconds) { |
| 711 | + final PlayQueueItem currentItem = player.getCurrentItem(); |
| 712 | + if (currentItem != null) { |
| 713 | + String videoUrl = player.getVideoUrl(); |
| 714 | + videoUrl += ("&t=" + seconds); |
| 715 | + ShareUtils.shareText(context, currentItem.getTitle(), |
| 716 | + videoUrl, currentItem.getThumbnailUrl()); |
| 717 | + } |
| 718 | + } |
703 | 719 | }; |
704 | 720 | } |
705 | 721 |
|
|
0 commit comments