|
|
@ -98,7 +98,6 @@ public class PostCell extends LinearLayout implements PostCellInterface { |
|
|
|
private View divider; |
|
|
|
private View divider; |
|
|
|
private View filterMatchColor; |
|
|
|
private View filterMatchColor; |
|
|
|
|
|
|
|
|
|
|
|
private boolean commentClickable = false; |
|
|
|
|
|
|
|
private int detailsSizePx; |
|
|
|
private int detailsSizePx; |
|
|
|
private int iconSizePx; |
|
|
|
private int iconSizePx; |
|
|
|
private int paddingPx; |
|
|
|
private int paddingPx; |
|
|
@ -109,6 +108,7 @@ public class PostCell extends LinearLayout implements PostCellInterface { |
|
|
|
private Theme theme; |
|
|
|
private Theme theme; |
|
|
|
private Post post; |
|
|
|
private Post post; |
|
|
|
private PostCellCallback callback; |
|
|
|
private PostCellCallback callback; |
|
|
|
|
|
|
|
private boolean selectable; |
|
|
|
private boolean highlighted; |
|
|
|
private boolean highlighted; |
|
|
|
private boolean selected; |
|
|
|
private boolean selected; |
|
|
|
private int markedNo; |
|
|
|
private int markedNo; |
|
|
@ -143,12 +143,12 @@ public class PostCell extends LinearLayout implements PostCellInterface { |
|
|
|
protected void onFinishInflate() { |
|
|
|
protected void onFinishInflate() { |
|
|
|
super.onFinishInflate(); |
|
|
|
super.onFinishInflate(); |
|
|
|
|
|
|
|
|
|
|
|
thumbnailView = (PostImageThumbnailView) findViewById(R.id.thumbnail_view); |
|
|
|
thumbnailView = findViewById(R.id.thumbnail_view); |
|
|
|
title = (FastTextView) findViewById(R.id.title); |
|
|
|
title = findViewById(R.id.title); |
|
|
|
icons = (PostIcons) findViewById(R.id.icons); |
|
|
|
icons = findViewById(R.id.icons); |
|
|
|
comment = (TextView) findViewById(R.id.comment); |
|
|
|
comment = findViewById(R.id.comment); |
|
|
|
replies = (FastTextView) findViewById(R.id.replies); |
|
|
|
replies = findViewById(R.id.replies); |
|
|
|
options = (ImageView) findViewById(R.id.options); |
|
|
|
options = findViewById(R.id.options); |
|
|
|
divider = findViewById(R.id.divider); |
|
|
|
divider = findViewById(R.id.divider); |
|
|
|
filterMatchColor = findViewById(R.id.filter_match_color); |
|
|
|
filterMatchColor = findViewById(R.id.filter_match_color); |
|
|
|
|
|
|
|
|
|
|
@ -182,55 +182,44 @@ public class PostCell extends LinearLayout implements PostCellInterface { |
|
|
|
divider.setLayoutParams(dividerParams); |
|
|
|
divider.setLayoutParams(dividerParams); |
|
|
|
|
|
|
|
|
|
|
|
thumbnailView.setClickable(true); |
|
|
|
thumbnailView.setClickable(true); |
|
|
|
thumbnailView.setOnClickListener(new View.OnClickListener() { |
|
|
|
thumbnailView.setOnClickListener(v -> callback.onThumbnailClicked(post, thumbnailView)); |
|
|
|
@Override |
|
|
|
|
|
|
|
public void onClick(View v) { |
|
|
|
|
|
|
|
callback.onThumbnailClicked(post, thumbnailView); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
thumbnailView.setRounding(dp(2)); |
|
|
|
thumbnailView.setRounding(dp(2)); |
|
|
|
|
|
|
|
|
|
|
|
replies.setOnClickListener(new View.OnClickListener() { |
|
|
|
replies.setOnClickListener(v -> { |
|
|
|
@Override |
|
|
|
if (threadMode) { |
|
|
|
public void onClick(View v) { |
|
|
|
int repliesFromSize; |
|
|
|
if (threadMode) { |
|
|
|
synchronized (post.repliesFrom) { |
|
|
|
int repliesFromSize; |
|
|
|
repliesFromSize = post.repliesFrom.size(); |
|
|
|
synchronized (post.repliesFrom) { |
|
|
|
} |
|
|
|
repliesFromSize = post.repliesFrom.size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (repliesFromSize > 0) { |
|
|
|
if (repliesFromSize > 0) { |
|
|
|
callback.onShowPostReplies(post); |
|
|
|
callback.onShowPostReplies(post); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
options.setOnClickListener(new OnClickListener() { |
|
|
|
options.setOnClickListener(v -> { |
|
|
|
@Override |
|
|
|
if (ThemeHelper.getInstance().getTheme().isLightTheme) { |
|
|
|
public void onClick(View v) { |
|
|
|
options.setImageResource(R.drawable.ic_overflow_black); |
|
|
|
if (ThemeHelper.getInstance().getTheme().isLightTheme) { |
|
|
|
} |
|
|
|
options.setImageResource(R.drawable.ic_overflow_black); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<FloatingMenuItem> items = new ArrayList<>(); |
|
|
|
List<FloatingMenuItem> items = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
callback.onPopulatePostOptions(post, items); |
|
|
|
callback.onPopulatePostOptions(post, items); |
|
|
|
|
|
|
|
|
|
|
|
FloatingMenu menu = new FloatingMenu(getContext(), v, items); |
|
|
|
FloatingMenu menu = new FloatingMenu(getContext(), v, items); |
|
|
|
menu.setCallback(new FloatingMenu.FloatingMenuCallback() { |
|
|
|
menu.setCallback(new FloatingMenu.FloatingMenuCallback() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onFloatingMenuItemClicked(FloatingMenu menu, FloatingMenuItem item) { |
|
|
|
public void onFloatingMenuItemClicked(FloatingMenu menu, FloatingMenuItem item) { |
|
|
|
callback.onPostOptionClicked(post, item.getId()); |
|
|
|
callback.onPostOptionClicked(post, item.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onFloatingMenuDismissed(FloatingMenu menu) { |
|
|
|
public void onFloatingMenuDismissed(FloatingMenu menu) { |
|
|
|
options.setImageResource(R.drawable.ic_overflow); |
|
|
|
options.setImageResource(R.drawable.ic_overflow); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
menu.show(); |
|
|
|
menu.show(); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
setOnClickListener(selfClicked); |
|
|
|
setOnClickListener(selfClicked); |
|
|
@ -254,9 +243,21 @@ public class PostCell extends LinearLayout implements PostCellInterface { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setPost(Theme theme, final Post post, PostCellInterface.PostCellCallback callback, |
|
|
|
public void setPost(Theme theme, |
|
|
|
boolean highlighted, boolean selected, int markedNo, boolean showDivider, ChanSettings.PostViewMode postViewMode) { |
|
|
|
final Post post, |
|
|
|
if (this.post == post && this.highlighted == highlighted && this.selected == selected && this.markedNo == markedNo && this.showDivider == showDivider) { |
|
|
|
PostCellInterface.PostCellCallback callback, |
|
|
|
|
|
|
|
boolean selectable, |
|
|
|
|
|
|
|
boolean highlighted, |
|
|
|
|
|
|
|
boolean selected, |
|
|
|
|
|
|
|
int markedNo, |
|
|
|
|
|
|
|
boolean showDivider, |
|
|
|
|
|
|
|
ChanSettings.PostViewMode postViewMode) { |
|
|
|
|
|
|
|
if (this.post == post && |
|
|
|
|
|
|
|
this.selectable == selectable && |
|
|
|
|
|
|
|
this.highlighted == highlighted && |
|
|
|
|
|
|
|
this.selected == selected && |
|
|
|
|
|
|
|
this.markedNo == markedNo && |
|
|
|
|
|
|
|
this.showDivider == showDivider) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -272,6 +273,7 @@ public class PostCell extends LinearLayout implements PostCellInterface { |
|
|
|
this.theme = theme; |
|
|
|
this.theme = theme; |
|
|
|
this.post = post; |
|
|
|
this.post = post; |
|
|
|
this.callback = callback; |
|
|
|
this.callback = callback; |
|
|
|
|
|
|
|
this.selectable = selectable; |
|
|
|
this.highlighted = highlighted; |
|
|
|
this.highlighted = highlighted; |
|
|
|
this.selected = selected; |
|
|
|
this.selected = selected; |
|
|
|
this.markedNo = markedNo; |
|
|
|
this.markedNo = markedNo; |
|
|
@ -416,24 +418,43 @@ public class PostCell extends LinearLayout implements PostCellInterface { |
|
|
|
commentText = post.comment; |
|
|
|
commentText = post.comment; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
comment.setText(commentText); |
|
|
|
|
|
|
|
comment.setVisibility(isEmpty(commentText) && post.image == null ? GONE : VISIBLE); |
|
|
|
comment.setVisibility(isEmpty(commentText) && post.image == null ? GONE : VISIBLE); |
|
|
|
|
|
|
|
|
|
|
|
if (commentClickable != threadMode) { |
|
|
|
if (threadMode) { |
|
|
|
commentClickable = threadMode; |
|
|
|
if (selectable) { |
|
|
|
if (commentClickable) { |
|
|
|
// Setting the text to selectable creates an editor, sets up a bunch of click
|
|
|
|
comment.setMovementMethod(commentMovementMethod); |
|
|
|
// handlers and sets a movementmethod.
|
|
|
|
comment.setOnClickListener(selfClicked); |
|
|
|
// Required for the isTextSelectable check.
|
|
|
|
|
|
|
|
// We override the test and movementmethod settings.
|
|
|
|
|
|
|
|
comment.setTextIsSelectable(true); |
|
|
|
|
|
|
|
|
|
|
|
if (noClickable) { |
|
|
|
comment.setText(commentText, TextView.BufferType.SPANNABLE); |
|
|
|
title.setMovementMethod(titleMovementMethod); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
comment.setOnClickListener(null); |
|
|
|
comment.setText(commentText); |
|
|
|
comment.setClickable(false); |
|
|
|
} |
|
|
|
comment.setMovementMethod(null); |
|
|
|
|
|
|
|
title.setMovementMethod(null); |
|
|
|
// Sets focusable to auto, clickable and longclickable to true.
|
|
|
|
|
|
|
|
comment.setMovementMethod(commentMovementMethod); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// And this sets clickable to appropriate values again.
|
|
|
|
|
|
|
|
comment.setOnClickListener(selfClicked); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (noClickable) { |
|
|
|
|
|
|
|
title.setMovementMethod(titleMovementMethod); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// comment.setTextIsSelectable(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
comment.setText(commentText); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
comment.setOnClickListener(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
comment.setClickable(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sets focusable to auto, clickable and longclickable to false.
|
|
|
|
|
|
|
|
comment.setMovementMethod(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
title.setMovementMethod(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int repliesFromSize; |
|
|
|
int repliesFromSize; |
|
|
|