diff --git a/Clover/app/src/main/java/org/floens/chan/ui/adapter/PostAdapter.java b/Clover/app/src/main/java/org/floens/chan/ui/adapter/PostAdapter.java index 3c146ffa..df0b1c11 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/adapter/PostAdapter.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/adapter/PostAdapter.java @@ -104,7 +104,7 @@ public class PostAdapter extends RecyclerView.Adapter { PostViewHolder postViewHolder = (PostViewHolder) holder; Post post = displayList.get(getPostPosition(position)); boolean highlight = post == highlightedPost || post.id.equals(highlightedPostId) || post.no == highlightedPostNo || post.tripcode.equals(highlightedPostTripcode); - postViewHolder.postView.setPost(null, post, postCellCallback, highlight, -1, postViewMode); + postViewHolder.postView.setPost(null, post, postCellCallback, highlight, -1, true, postViewMode); break; case TYPE_STATUS: ((StatusViewHolder) holder).threadStatusCell.update(); diff --git a/Clover/app/src/main/java/org/floens/chan/ui/cell/CardPostCell.java b/Clover/app/src/main/java/org/floens/chan/ui/cell/CardPostCell.java index 29411638..cbbb9c1c 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/cell/CardPostCell.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/cell/CardPostCell.java @@ -139,7 +139,8 @@ public class CardPostCell extends CardView implements PostCellInterface, View.On } } - public void setPost(Theme theme, final Post post, PostCellInterface.PostCellCallback callback, boolean highlighted, int markedNo, PostCellInterface.PostViewMode postViewMode) { + public void setPost(Theme theme, final Post post, PostCellInterface.PostCellCallback callback, + boolean highlighted, int markedNo, boolean showDivider, PostCellInterface.PostViewMode postViewMode) { if (this.post == post) { return; } 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 9b91e779..8632a192 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 @@ -98,6 +98,7 @@ public class PostCell extends LinearLayout implements PostCellInterface, PostLin private PostCellCallback callback; private boolean highlighted; private int markedNo; + private boolean showDivider; private OnClickListener selfClicked = new OnClickListener() { @Override @@ -234,7 +235,8 @@ public class PostCell extends LinearLayout implements PostCellInterface, PostLin } } - public void setPost(Theme theme, final Post post, PostCellInterface.PostCellCallback callback, boolean highlighted, int markedNo, PostCellInterface.PostViewMode postViewMode) { + public void setPost(Theme theme, final Post post, PostCellInterface.PostCellCallback callback, + boolean highlighted, int markedNo, boolean showDivider, PostCellInterface.PostViewMode postViewMode) { if (this.post == post && this.highlighted == highlighted && this.markedNo == markedNo) { return; } @@ -253,6 +255,7 @@ public class PostCell extends LinearLayout implements PostCellInterface, PostLin this.callback = callback; this.highlighted = highlighted; this.markedNo = markedNo; + this.showDivider = showDivider; bindPost(theme, post); } @@ -424,6 +427,8 @@ public class PostCell extends LinearLayout implements PostCellInterface, PostLin comment.setPadding(comment.getPaddingLeft(), comment.getPaddingTop(), comment.getPaddingRight(), paddingPx); replies.setPadding(replies.getPaddingLeft(), 0, replies.getPaddingRight(), replies.getPaddingBottom()); } + + divider.setVisibility(showDivider ? VISIBLE : GONE); } private void unbindPost(Post post) { diff --git a/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCellInterface.java b/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCellInterface.java index 938005fe..73069999 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCellInterface.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCellInterface.java @@ -27,7 +27,7 @@ import org.floens.chan.ui.view.ThumbnailView; import java.util.List; public interface PostCellInterface { - void setPost(Theme theme, Post post, PostCellCallback callback, boolean highlighted, int markedNo, PostCellInterface.PostViewMode postViewMode); + void setPost(Theme theme, Post post, PostCellCallback callback, boolean highlighted, int markedNo, boolean showDivider, PostCellInterface.PostViewMode postViewMode); Post getPost(); diff --git a/Clover/app/src/main/java/org/floens/chan/ui/cell/PostStubCell.java b/Clover/app/src/main/java/org/floens/chan/ui/cell/PostStubCell.java index 8d678f2a..6b79ef6a 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/cell/PostStubCell.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/cell/PostStubCell.java @@ -49,6 +49,7 @@ public class PostStubCell extends RelativeLayout implements PostCellInterface, V private Theme theme; private Post post; private PostViewMode postViewMode; + private boolean showDivider; private PostCellInterface.PostCellCallback callback; private TextView title; @@ -137,7 +138,8 @@ public class PostStubCell extends RelativeLayout implements PostCellInterface, V } } - public void setPost(Theme theme, final Post post, PostCellInterface.PostCellCallback callback, boolean highlighted, int markedNo, PostCellInterface.PostViewMode postViewMode) { + public void setPost(Theme theme, final Post post, PostCellInterface.PostCellCallback callback, + boolean highlighted, int markedNo, boolean showDivider, PostCellInterface.PostViewMode postViewMode) { if (this.post == post) { return; } @@ -155,6 +157,7 @@ public class PostStubCell extends RelativeLayout implements PostCellInterface, V this.post = post; this.callback = callback; this.postViewMode = postViewMode; + this.showDivider = showDivider; bindPost(theme, post); } @@ -188,7 +191,8 @@ public class PostStubCell extends RelativeLayout implements PostCellInterface, V title.setText(titleText); } - divider.setVisibility(postViewMode == PostViewMode.CARD ? GONE : VISIBLE); + divider.setVisibility(postViewMode == PostViewMode.CARD ? GONE : + (showDivider ? VISIBLE : GONE)); } private void unbindPost(Post post) { diff --git a/Clover/app/src/main/java/org/floens/chan/ui/controller/PostRepliesController.java b/Clover/app/src/main/java/org/floens/chan/ui/controller/PostRepliesController.java index 2337ee1f..80c33689 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/controller/PostRepliesController.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/controller/PostRepliesController.java @@ -177,7 +177,8 @@ public class PostRepliesController extends Controller { } final Post p = getItem(position); - postCell.setPost(null, p, presenter, false, data.forPost.no, PostCellInterface.PostViewMode.LIST); + boolean showDivider = position < getCount() - 1; + postCell.setPost(null, p, presenter, false, data.forPost.no, showDivider, PostCellInterface.PostViewMode.LIST); return (View) postCell; } diff --git a/Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java b/Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java index fbdbaf61..7552b494 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java @@ -254,7 +254,7 @@ public class ThemeSettingsController extends Controller implements View.OnClickL themeContext.getResources().getDimensionPixelSize(R.dimen.toolbar_height))); PostCell postCell = (PostCell) LayoutInflater.from(themeContext).inflate(R.layout.cell_post, null); - postCell.setPost(theme, post, DUMMY_POST_CALLBACK, false, -1, PostCellInterface.PostViewMode.LIST); + postCell.setPost(theme, post, DUMMY_POST_CALLBACK, false, -1, true, PostCellInterface.PostViewMode.LIST); linearLayout.addView(postCell, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); return linearLayout;