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.
master
Floens 7 years ago
parent 6e7457ce79
commit 8b1a1bdf85
  1. 25
      Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java
  2. 9
      Clover/app/src/main/res/layout/cell_post.xml

@ -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<FloatingMenuItem> items = new ArrayList<>();

@ -83,6 +83,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
app:singleLine="true"
app:textColor="?attr/text_color_secondary" />
<View
android:id="@+id/replies_additional_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/replies"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/replies"
android:layout_toRightOf="@id/replies" />
<View
android:id="@+id/divider"
android:layout_width="match_parent"

Loading…
Cancel
Save