Fix issue #129
This commit is contained in:
parent
e9c10b17e0
commit
0a12020fd8
|
@ -403,7 +403,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, peertubeInstance);
|
||||
commentListAdapter = new CommentListAdapter(comments, isMyVideo || Helper.isVideoOwner(PeertubeActivity.this, peertube), false, peertubeInstance, sepiaSearch);
|
||||
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||
binding.peertubeComments.setLayoutManager(mLayoutManager);
|
||||
|
@ -532,7 +532,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, peertubeInstance);
|
||||
commentReplyListAdapter = new CommentListAdapter(commentsThread, Helper.isVideoOwner(PeertubeActivity.this, peertube), true, peertubeInstance, sepiaSearch);
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||
binding.peertubeReply.setLayoutManager(mLayoutManager);
|
||||
binding.peertubeReply.setNestedScrollingEnabled(false);
|
||||
|
|
|
@ -66,6 +66,7 @@ import es.dmoral.toasty.Toasty;
|
|||
|
||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||
|
||||
|
||||
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
@ -78,13 +79,15 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||
boolean isVideoOwner;
|
||||
private Context context;
|
||||
private final String instance;
|
||||
private final boolean sepiaSearch;
|
||||
|
||||
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner, boolean isThread, String instance) {
|
||||
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner, boolean isThread, String instance, boolean sepiaSearch) {
|
||||
this.comments = comments;
|
||||
commentListAdapter = this;
|
||||
this.isVideoOwner = isVideoOwner;
|
||||
this.isThread = isThread;
|
||||
this.instance = instance;
|
||||
this.sepiaSearch = sepiaSearch;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -296,8 +299,25 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||
} else {
|
||||
holder.binding.postReplyButton.setVisibility(View.GONE);
|
||||
}
|
||||
holder.binding.postReplyButton.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i));
|
||||
holder.binding.replyButton.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i));
|
||||
holder.binding.postReplyButton.setOnClickListener(v -> {
|
||||
if (isLoggedIn(context) && !sepiaSearch) {
|
||||
((PeertubeActivity) context).openPostComment(comment, i);
|
||||
} else {
|
||||
if (sepiaSearch) {
|
||||
Toasty.info(context, context.getString(R.string.federation_issue), Toasty.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toasty.error(context, context.getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
if (isLoggedIn(context) && !sepiaSearch) {
|
||||
holder.binding.replyButton.setVisibility(View.VISIBLE);
|
||||
holder.binding.replyButton.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i));
|
||||
} else {
|
||||
holder.binding.replyButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int i, APIResponse apiResponse) {
|
||||
|
|
Loading…
Reference in New Issue