mirror of
				https://framagit.org/tom79/fedilab-tube
				synced 2025-06-05 21:09:11 +02:00 
			
		
		
		
	Fix issue #129
This commit is contained in:
		| @@ -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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user