mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-05-24 23:54:12 +02:00
Fix issue #89
This commit is contained in:
parent
f0ff8a6feb
commit
c8e7c23855
@ -376,7 +376,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
binding.closeReply.setOnClickListener(v -> closeCommentThread());
|
binding.closeReply.setOnClickListener(v -> closeCommentThread());
|
||||||
binding.closePost.setOnClickListener(v -> closePostComment());
|
binding.closePost.setOnClickListener(v -> closePostComment());
|
||||||
|
|
||||||
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube), false);
|
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube), false, peertubeInstance);
|
||||||
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||||
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
||||||
@ -460,7 +460,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
comment.setInReplyToCommentId(null);
|
comment.setInReplyToCommentId(null);
|
||||||
comment.setTotalReplies(0);
|
comment.setTotalReplies(0);
|
||||||
commentsThread.add(0, comment);
|
commentsThread.add(0, comment);
|
||||||
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube), true);
|
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube), true, peertubeInstance);
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||||
binding.peertubeReply.setLayoutManager(mLayoutManager);
|
binding.peertubeReply.setLayoutManager(mLayoutManager);
|
||||||
binding.peertubeReply.setNestedScrollingEnabled(false);
|
binding.peertubeReply.setNestedScrollingEnabled(false);
|
||||||
@ -580,7 +580,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
captionsViewModel.getCaptions(sepiaSearch ? peertubeInstance : null, videoUuid).observe(PeertubeActivity.this, this::manageCaptions);
|
captionsViewModel.getCaptions(sepiaSearch ? peertubeInstance : null, videoUuid).observe(PeertubeActivity.this, this::manageCaptions);
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
RetrofitPeertubeAPI api = new RetrofitPeertubeAPI(PeertubeActivity.this);
|
RetrofitPeertubeAPI api;
|
||||||
|
if (peertubeInstance != null) {
|
||||||
|
api = new RetrofitPeertubeAPI(PeertubeActivity.this, peertubeInstance, null);
|
||||||
|
} else {
|
||||||
|
api = new RetrofitPeertubeAPI(PeertubeActivity.this);
|
||||||
|
}
|
||||||
VideoData.Description description = api.getVideoDescription(videoUuid);
|
VideoData.Description description = api.getVideoDescription(videoUuid);
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
Runnable myRunnable = () -> {
|
Runnable myRunnable = () -> {
|
||||||
@ -589,7 +594,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
show_more_content = null;
|
show_more_content = null;
|
||||||
} else {
|
} else {
|
||||||
if (!PeertubeActivity.this.isFinishing()) {
|
if (!PeertubeActivity.this.isFinishing()) {
|
||||||
if (peertube != null && peertube.getDescription() != null && description.getDescription() != null && description.getDescription().compareTo(peertube.getDescription()) > 0) {
|
if ((peertube.getDescription() == null && description.getDescription() != null) || (peertube.getDescription() != null && description.getDescription() != null && description.getDescription().compareTo(peertube.getDescription()) > 0)) {
|
||||||
binding.peertubeDescriptionMore.setVisibility(View.VISIBLE);
|
binding.peertubeDescriptionMore.setVisibility(View.VISIBLE);
|
||||||
show_more_content = description.getDescription();
|
show_more_content = description.getDescription();
|
||||||
} else {
|
} else {
|
||||||
@ -930,10 +935,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startStream(String videoURL, String streamingPlaylistsURLS, boolean autoPlay, long position, Uri subtitles, String lang) {
|
private void startStream(String videoURL, String streamingPlaylistsURLS, boolean autoPlay, long position, Uri subtitles, String lang) {
|
||||||
|
if (videoURL != null && !videoURL.endsWith("m3u8")) {
|
||||||
if (videoURL != null) {
|
|
||||||
if (videoURL.endsWith(".torrent")) {
|
if (videoURL.endsWith(".torrent")) {
|
||||||
|
|
||||||
torrentStream.startStream(videoURL);
|
torrentStream.startStream(videoURL);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -970,6 +973,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (streamingPlaylistsURLS == null && videoURL != null) {
|
||||||
|
streamingPlaylistsURLS = videoURL;
|
||||||
|
}
|
||||||
MediaItem mediaItem = new MediaItem.Builder().setUri(Uri.parse(streamingPlaylistsURLS)).build();
|
MediaItem mediaItem = new MediaItem.Builder().setUri(Uri.parse(streamingPlaylistsURLS)).build();
|
||||||
HlsMediaSource hlsMediaSource = new HlsMediaSource.Factory(new DefaultHttpDataSourceFactory(System.getProperty("http.agent")))
|
HlsMediaSource hlsMediaSource = new HlsMediaSource.Factory(new DefaultHttpDataSourceFactory(System.getProperty("http.agent")))
|
||||||
.createMediaSource(mediaItem);
|
.createMediaSource(mediaItem);
|
||||||
@ -1552,9 +1558,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
private void initResolution() {
|
private void initResolution() {
|
||||||
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
|
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
|
||||||
TextView resolution = controlView.findViewById(R.id.resolution);
|
TextView resolution = controlView.findViewById(R.id.resolution);
|
||||||
currentResolution = Helper.defaultFile(PeertubeActivity.this, peertube.getFiles()).getResolutions().getLabel();
|
if (Helper.defaultFile(PeertubeActivity.this, peertube.getFiles()) != null) {
|
||||||
if (peertube.getFiles() != null && peertube.getFiles().size() > 0) {
|
currentResolution = Helper.defaultFile(PeertubeActivity.this, peertube.getFiles()).getResolutions().getLabel();
|
||||||
resolution.setText(String.format("%s", currentResolution));
|
if (peertube.getFiles() != null && peertube.getFiles().size() > 0) {
|
||||||
|
resolution.setText(String.format("%s", currentResolution));
|
||||||
|
} else {
|
||||||
|
resolution.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
resolution.setVisibility(View.GONE);
|
resolution.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -1736,7 +1746,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
boolean autoplayNextVideo = sharedpreferences.getBoolean(getString(R.string.set_autoplay_next_video_choice), true);
|
boolean autoplayNextVideo = sharedpreferences.getBoolean(getString(R.string.set_autoplay_next_video_choice), true);
|
||||||
if (reason == MEDIA_ITEM_TRANSITION_REASON_AUTO && autoplayNextVideo) {
|
if (reason == MEDIA_ITEM_TRANSITION_REASON_AUTO && autoplayNextVideo) {
|
||||||
player.removeMediaItems(0, player.getMediaItemCount());
|
player.removeMediaItems(0, player.getMediaItemCount());
|
||||||
playNextVideo();
|
if (!sepiaSearch) {
|
||||||
|
playNextVideo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,12 +78,14 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
public AllCommentRemoved allCommentRemoved;
|
public AllCommentRemoved allCommentRemoved;
|
||||||
boolean isVideoOwner;
|
boolean isVideoOwner;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
private final String instance;
|
||||||
|
|
||||||
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner, boolean isThread) {
|
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner, boolean isThread, String instance) {
|
||||||
this.comments = comments;
|
this.comments = comments;
|
||||||
commentListAdapter = this;
|
commentListAdapter = this;
|
||||||
this.isVideoOwner = isVideoOwner;
|
this.isVideoOwner = isVideoOwner;
|
||||||
this.isThread = isThread;
|
this.isThread = isThread;
|
||||||
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -268,8 +270,13 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
|
|
||||||
holder.comment_date.setText(Helper.dateDiff(context, comment.getCreatedAt()));
|
holder.comment_date.setText(Helper.dateDiff(context, comment.getCreatedAt()));
|
||||||
|
|
||||||
|
String avatarUrl;
|
||||||
Helper.loadGiF(context, comment.getAccount().getAvatar() != null ? comment.getAccount().getAvatar().getPath() : null, holder.comment_account_profile);
|
if (instance != null) {
|
||||||
|
avatarUrl = comment.getAccount().getAvatar() != null ? "https://" + instance + comment.getAccount().getAvatar().getPath() : null;
|
||||||
|
} else {
|
||||||
|
avatarUrl = comment.getAccount().getAvatar() != null ? comment.getAccount().getAvatar().getPath() : null;
|
||||||
|
}
|
||||||
|
Helper.loadGiF(context, avatarUrl, holder.comment_account_profile);
|
||||||
|
|
||||||
holder.comment_account_profile.setOnClickListener(v -> {
|
holder.comment_account_profile.setOnClickListener(v -> {
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user