mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 21:07:11 +01:00
New option: Show Only One Comment Level Indicator.
This commit is contained in:
parent
39291be2e9
commit
b21eb89271
@ -186,6 +186,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
private boolean mDataSavingMode;
|
||||
private boolean mDisableImagePreview;
|
||||
private boolean mOnlyDisablePreviewInVideoAndGifPosts;
|
||||
private boolean mShowOnlyOneCommentLevelIndicator;
|
||||
private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback;
|
||||
private boolean isInitiallyLoading;
|
||||
private boolean isInitiallyLoadingFailed;
|
||||
@ -513,6 +514,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
mDisableImagePreview = sharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false);
|
||||
mOnlyDisablePreviewInVideoAndGifPosts = sharedPreferences.getBoolean(SharedPreferencesUtils.ONLY_DISABLE_PREVIEW_IN_VIDEO_AND_GIF_POSTS, false);
|
||||
|
||||
mShowOnlyOneCommentLevelIndicator = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ONLY_ONE_COMMENT_LEVEL_INDICATOR, false);
|
||||
|
||||
mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback;
|
||||
isInitiallyLoading = true;
|
||||
isInitiallyLoadingFailed = false;
|
||||
@ -1098,6 +1101,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||
comment.getScore() + comment.getVoteType())));
|
||||
|
||||
((CommentViewHolder) holder).commentIndentationView.setShowOnlyOneDivider(mShowOnlyOneCommentLevelIndicator);
|
||||
((CommentViewHolder) holder).commentIndentationView.setLevelAndColors(comment.getDepth(), verticalBlockColors);
|
||||
if (comment.getDepth() > depthThreshold) {
|
||||
((CommentViewHolder) holder).saveButton.setVisibility(View.GONE);
|
||||
@ -1167,6 +1171,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
}
|
||||
((CommentFullyCollapsedViewHolder) holder).scoreTextView.setText(mActivity.getString(R.string.top_score,
|
||||
Utils.getNVotes(mShowAbsoluteNumberOfVotes, comment.getScore() + comment.getVoteType())));
|
||||
((CommentViewHolder) holder).commentIndentationView.setShowOnlyOneDivider(mShowOnlyOneCommentLevelIndicator);
|
||||
((CommentFullyCollapsedViewHolder) holder).commentIndentationView.setLevelAndColors(comment.getDepth(), verticalBlockColors);
|
||||
}
|
||||
} else if (holder instanceof LoadMoreChildCommentsViewHolder) {
|
||||
@ -1174,6 +1179,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getBindingAdapterPosition() - 2)
|
||||
: mVisibleComments.get(holder.getBindingAdapterPosition() - 1);
|
||||
|
||||
((LoadMoreChildCommentsViewHolder) holder).commentIndentationView.setShowOnlyOneDivider(mShowOnlyOneCommentLevelIndicator);
|
||||
((LoadMoreChildCommentsViewHolder) holder).commentIndentationView.setLevelAndColors(placeholder.getDepth(), verticalBlockColors);
|
||||
|
||||
if (placeholder.getPlaceholderType() == Comment.PLACEHOLDER_LOAD_MORE_COMMENTS) {
|
||||
|
@ -22,6 +22,7 @@ public class CommentIndentationView extends LinearLayout {
|
||||
private ArrayList<Integer> startXs;
|
||||
private final int spacing;
|
||||
private final int pathWidth;
|
||||
private boolean showOnlyOneDivider = false;
|
||||
|
||||
public CommentIndentationView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@ -49,9 +50,16 @@ public class CommentIndentationView extends LinearLayout {
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
for (int i = 0; i < startXs.size(); i++) {
|
||||
paint.setColor(colors[i % 7]);
|
||||
canvas.drawLine(startXs.get(i), 0, startXs.get(i), getHeight(), paint);
|
||||
if (showOnlyOneDivider) {
|
||||
if (startXs.size() > 0) {
|
||||
paint.setColor(colors[(startXs.size() - 1) % 7]);
|
||||
canvas.drawLine(startXs.get(startXs.size() - 1), 0, startXs.get(startXs.size() - 1), getHeight(), paint);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < startXs.size(); i++) {
|
||||
paint.setColor(colors[i % 7]);
|
||||
canvas.drawLine(startXs.get(i), 0, startXs.get(i), getHeight(), paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,6 +97,10 @@ public class CommentIndentationView extends LinearLayout {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setShowOnlyOneDivider(boolean showOnlyOneDivider) {
|
||||
this.showOnlyOneDivider = showOnlyOneDivider;
|
||||
}
|
||||
|
||||
private static class SavedState extends BaseSavedState {
|
||||
ArrayList<Integer> startXs;
|
||||
Integer[] colors;
|
||||
|
@ -177,6 +177,7 @@ public class SharedPreferencesUtils {
|
||||
public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_CARD_LAYOUT_2 = "number_of_columns_in_post_feed_portrait_card_layout_2";
|
||||
public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_CARD_LAYOUT_2 = "number_of_columns_in_post_feed_landscape_card_layout_2";
|
||||
public static final String DISABLE_NSFW_FOREVER = "disable_nsfw_forever";
|
||||
public static final String SHOW_ONLY_ONE_COMMENT_LEVEL_INDICATOR = "show_only_one_comment_level_indicator";
|
||||
|
||||
public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences";
|
||||
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
|
||||
|
@ -562,6 +562,7 @@
|
||||
<string name="settings_crash_reports_title">Crash Reports</string>
|
||||
<string name="settings_nsfw_and_spoiler_dangerous_group_title">Dangerous</string>
|
||||
<string name="settings_disable_nsfw_forever_title">Disable NSFW Forever</string>
|
||||
<string name="settings_show_only_one_comment_level_indicator">Show Only One Comment Level Indicator</string>
|
||||
|
||||
<string name="no_link_available">Cannot get the link</string>
|
||||
|
||||
|
@ -12,6 +12,11 @@
|
||||
app:key="show_comment_divider"
|
||||
app:title="@string/settings_show_comment_divider_title" />
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="false"
|
||||
app:key="show_only_one_comment_level_indicator"
|
||||
app:title="@string/settings_show_only_one_comment_level_indicator" />
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="false"
|
||||
app:key="comment_toolbar_hidden"
|
||||
|
Loading…
Reference in New Issue
Block a user