diff --git a/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java b/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java index 419486d..3c2db29 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java +++ b/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java @@ -33,15 +33,14 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; import android.widget.EditText; -import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.widget.PopupMenu; +import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.ViewModelProvider; @@ -59,6 +58,7 @@ import app.fedilab.fedilabtube.client.APIResponse; import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI; import app.fedilab.fedilabtube.client.data.CommentData.Comment; import app.fedilab.fedilabtube.client.entities.Report; +import app.fedilab.fedilabtube.databinding.DrawerCommentBinding; import app.fedilab.fedilabtube.helper.CommentDecorationHelper; import app.fedilab.fedilabtube.helper.EmojiHelper; import app.fedilab.fedilabtube.helper.Helper; @@ -104,8 +104,8 @@ public class CommentListAdapter extends RecyclerView.Adapter { - PopupMenu popup = new PopupMenu(context, holder.more_actions); + holder.binding.commentAccountProfile.setLayoutParams(params); + holder.binding.moreActions.setOnClickListener(view -> { + PopupMenu popup = new PopupMenu(context, holder.binding.moreActions); popup.getMenuInflater() .inflate(R.menu.comment_menu, popup.getMenu()); if (!Helper.isOwner(context, comment.getAccount())) { @@ -219,7 +221,7 @@ public class CommentListAdapter extends RecyclerView.Adapter { + holder.binding.commentContent.setOnTouchListener((view, motionEvent) -> { if (motionEvent.getAction() == MotionEvent.ACTION_UP && !view.hasFocus()) { try { view.requestFocus(); @@ -234,22 +236,22 @@ public class CommentListAdapter extends RecyclerView.Adapter ((PeertubeActivity) context).openCommentThread(comment)); - holder.comment_content.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment)); + holder.binding.mainContainer.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment)); + holder.binding.commentContent.setOnClickListener(v -> ((PeertubeActivity) context).openCommentThread(comment)); } if (comment.getTotalReplies() > 0) { - holder.number_of_replies.setVisibility(View.VISIBLE); - holder.number_of_replies.setText(context.getResources().getQuantityString(R.plurals.number_of_replies, comment.getTotalReplies(), comment.getTotalReplies())); + holder.binding.numberOfReplies.setVisibility(View.VISIBLE); + holder.binding.numberOfReplies.setText(context.getResources().getQuantityString(R.plurals.number_of_replies, comment.getTotalReplies(), comment.getTotalReplies())); } else { - holder.number_of_replies.setVisibility(View.GONE); + holder.binding.numberOfReplies.setVisibility(View.GONE); } if (comment.getAccount() != null) { @@ -265,10 +267,10 @@ public class CommentListAdapter extends RecyclerView.Adapter { + holder.binding.commentAccountProfile.setOnClickListener(v -> { Bundle b = new Bundle(); Intent intent = new Intent(context, ShowAccountActivity.class); b.putParcelable("account", comment.getAccount()); @@ -287,17 +289,17 @@ public class CommentListAdapter extends RecyclerView.Adapter ((PeertubeActivity) context).openPostComment(comment, i)); - holder.replyButton.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i)); + holder.binding.postReplyButton.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i)); + holder.binding.replyButton.setOnClickListener(v -> ((PeertubeActivity) context).openPostComment(comment, i)); } public void manageVIewPostActions(RetrofitPeertubeAPI.ActionType statusAction, int i, APIResponse apiResponse) { @@ -358,40 +360,15 @@ public class CommentListAdapter extends RecyclerView.Adapter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_decoration_2.xml b/app/src/main/res/drawable/rounded_decoration_2.xml new file mode 100644 index 0000000..504273d --- /dev/null +++ b/app/src/main/res/drawable/rounded_decoration_2.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/drawer_comment.xml b/app/src/main/res/layout/drawer_comment.xml index d6dfc9e..7cd2958 100644 --- a/app/src/main/res/layout/drawer_comment.xml +++ b/app/src/main/res/layout/drawer_comment.xml @@ -28,11 +28,43 @@ + + + + + + + @@ -42,9 +74,10 @@ android:layout_width="40dp" android:layout_height="40dp" android:layout_marginTop="5dp" + android:src="@drawable/missing_peertube" android:layout_marginStart="10dp" android:contentDescription="@string/profile_picture" - app:layout_constraintStart_toStartOf="@id/decoration" + app:layout_constraintStart_toStartOf="@id/decoration_long" app:layout_constraintTop_toTopOf="parent" />