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.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;
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
||||
|
@ -460,7 +460,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
comment.setInReplyToCommentId(null);
|
||||
comment.setTotalReplies(0);
|
||||
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);
|
||||
binding.peertubeReply.setLayoutManager(mLayoutManager);
|
||||
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);
|
||||
new Thread(() -> {
|
||||
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);
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
|
@ -589,7 +594,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
show_more_content = null;
|
||||
} else {
|
||||
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);
|
||||
show_more_content = description.getDescription();
|
||||
} 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) {
|
||||
|
||||
if (videoURL != null) {
|
||||
if (videoURL != null && !videoURL.endsWith("m3u8")) {
|
||||
if (videoURL.endsWith(".torrent")) {
|
||||
|
||||
torrentStream.startStream(videoURL);
|
||||
return;
|
||||
} else {
|
||||
|
@ -970,6 +973,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (streamingPlaylistsURLS == null && videoURL != null) {
|
||||
streamingPlaylistsURLS = videoURL;
|
||||
}
|
||||
MediaItem mediaItem = new MediaItem.Builder().setUri(Uri.parse(streamingPlaylistsURLS)).build();
|
||||
HlsMediaSource hlsMediaSource = new HlsMediaSource.Factory(new DefaultHttpDataSourceFactory(System.getProperty("http.agent")))
|
||||
.createMediaSource(mediaItem);
|
||||
|
@ -1552,9 +1558,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
private void initResolution() {
|
||||
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
|
||||
TextView resolution = controlView.findViewById(R.id.resolution);
|
||||
currentResolution = Helper.defaultFile(PeertubeActivity.this, peertube.getFiles()).getResolutions().getLabel();
|
||||
if (peertube.getFiles() != null && peertube.getFiles().size() > 0) {
|
||||
resolution.setText(String.format("%s", currentResolution));
|
||||
if (Helper.defaultFile(PeertubeActivity.this, peertube.getFiles()) != null) {
|
||||
currentResolution = Helper.defaultFile(PeertubeActivity.this, peertube.getFiles()).getResolutions().getLabel();
|
||||
if (peertube.getFiles() != null && peertube.getFiles().size() > 0) {
|
||||
resolution.setText(String.format("%s", currentResolution));
|
||||
} else {
|
||||
resolution.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
if (reason == MEDIA_ITEM_TRANSITION_REASON_AUTO && autoplayNextVideo) {
|
||||
player.removeMediaItems(0, player.getMediaItemCount());
|
||||
playNextVideo();
|
||||
if (!sepiaSearch) {
|
||||
playNextVideo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,12 +78,14 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||
public AllCommentRemoved allCommentRemoved;
|
||||
boolean isVideoOwner;
|
||||
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;
|
||||
commentListAdapter = this;
|
||||
this.isVideoOwner = isVideoOwner;
|
||||
this.isThread = isThread;
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -268,8 +270,13 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||
|
||||
holder.comment_date.setText(Helper.dateDiff(context, comment.getCreatedAt()));
|
||||
|
||||
|
||||
Helper.loadGiF(context, comment.getAccount().getAvatar() != null ? comment.getAccount().getAvatar().getPath() : null, holder.comment_account_profile);
|
||||
String avatarUrl;
|
||||
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 -> {
|
||||
Bundle b = new Bundle();
|
||||
|
|
Loading…
Reference in New Issue