From 8b1a1bdf855c3420dd9efe7d0fd2a91523493de2 Mon Sep 17 00:00:00 2001 From: Floens Date: Wed, 4 Jul 2018 18:34:14 +0200 Subject: [PATCH] post: extend the clickable area of the replies to the right We can't change the width or the pressed drawable is enormous. Might change it to a touchdelegate later. --- .../org/floens/chan/ui/cell/PostCell.java | 25 +++++++++++-------- Clover/app/src/main/res/layout/cell_post.xml | 9 +++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java b/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java index 9d5d93cd..74f3603d 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java @@ -99,6 +99,7 @@ public class PostCell extends LinearLayout implements PostCellInterface { private PostIcons icons; private TextView comment; private FastTextView replies; + private View repliesAdditionalArea; private ImageView options; private View divider; private View filterMatchColor; @@ -153,6 +154,7 @@ public class PostCell extends LinearLayout implements PostCellInterface { icons = findViewById(R.id.icons); comment = findViewById(R.id.comment); replies = findViewById(R.id.replies); + repliesAdditionalArea = findViewById(R.id.replies_additional_area); options = findViewById(R.id.options); divider = findViewById(R.id.divider); filterMatchColor = findViewById(R.id.filter_match_color); @@ -186,18 +188,21 @@ public class PostCell extends LinearLayout implements PostCellInterface { dividerParams.rightMargin = paddingPx; divider.setLayoutParams(dividerParams); - replies.setOnClickListener(v -> { - if (threadMode) { - int repliesFromSize; - synchronized (post.repliesFrom) { - repliesFromSize = post.repliesFrom.size(); - } + OnClickListener repliesClickListener = v -> { + if (replies.getVisibility() != VISIBLE || !replies.isClickable() || !threadMode) { + return; + } + int repliesFromSize; + synchronized (post.repliesFrom) { + repliesFromSize = post.repliesFrom.size(); + } - if (repliesFromSize > 0) { - callback.onShowPostReplies(post); - } + if (repliesFromSize > 0) { + callback.onShowPostReplies(post); } - }); + }; + replies.setOnClickListener(repliesClickListener); + repliesAdditionalArea.setOnClickListener(repliesClickListener); options.setOnClickListener(v -> { List items = new ArrayList<>(); diff --git a/Clover/app/src/main/res/layout/cell_post.xml b/Clover/app/src/main/res/layout/cell_post.xml index 9fd6a16f..f7a2ec9d 100644 --- a/Clover/app/src/main/res/layout/cell_post.xml +++ b/Clover/app/src/main/res/layout/cell_post.xml @@ -83,6 +83,15 @@ along with this program. If not, see . app:singleLine="true" app:textColor="?attr/text_color_secondary" /> + +