mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 21:07:11 +01:00
New option: Settings->Interface->Comment->Hide Author Avatar. Fix Application ClassCastException in MainActivity. Don't show the number of child comments in expanded comments.
This commit is contained in:
parent
101525ae33
commit
c265bbecf9
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="ml.docilealligator.infinityforreddit.Infinity"
|
android:name="ml.docilealligator.infinityforreddit.Infinity"
|
||||||
android:allowBackup="true"
|
android:allowBackup="false"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/application_name"
|
android:label="@string/application_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
@ -115,6 +115,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
private boolean mFullyCollapseComment;
|
private boolean mFullyCollapseComment;
|
||||||
private boolean mShowOnlyOneCommentLevelIndicator;
|
private boolean mShowOnlyOneCommentLevelIndicator;
|
||||||
private boolean mHideCommentAwards;
|
private boolean mHideCommentAwards;
|
||||||
|
private boolean mShowAuthorAvatar;
|
||||||
private int mDepthThreshold;
|
private int mDepthThreshold;
|
||||||
private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback;
|
private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback;
|
||||||
private boolean isInitiallyLoading;
|
private boolean isInitiallyLoading;
|
||||||
@ -237,6 +238,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
mFullyCollapseComment = sharedPreferences.getBoolean(SharedPreferencesUtils.FULLY_COLLAPSE_COMMENT, false);
|
mFullyCollapseComment = sharedPreferences.getBoolean(SharedPreferencesUtils.FULLY_COLLAPSE_COMMENT, false);
|
||||||
mShowOnlyOneCommentLevelIndicator = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ONLY_ONE_COMMENT_LEVEL_INDICATOR, false);
|
mShowOnlyOneCommentLevelIndicator = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ONLY_ONE_COMMENT_LEVEL_INDICATOR, false);
|
||||||
mHideCommentAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_COMMENT_AWARDS, false);
|
mHideCommentAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_COMMENT_AWARDS, false);
|
||||||
|
mShowAuthorAvatar = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AUTHOR_AVATAR, false);
|
||||||
mDepthThreshold = sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5);
|
mDepthThreshold = sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5);
|
||||||
|
|
||||||
mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback;
|
mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback;
|
||||||
@ -461,7 +463,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (comment.hasReply()) {
|
if (comment.hasReply()) {
|
||||||
if (comment.getChildCount() > 0) {
|
if (comment.getChildCount() > 0 && !comment.isExpanded()) {
|
||||||
((CommentViewHolder) holder).expandButton.setText("+" + comment.getChildCount());
|
((CommentViewHolder) holder).expandButton.setText("+" + comment.getChildCount());
|
||||||
}
|
}
|
||||||
if (comment.isExpanded()) {
|
if (comment.isExpanded()) {
|
||||||
@ -936,8 +938,9 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
|
|
||||||
public void initiallyLoading() {
|
public void initiallyLoading() {
|
||||||
resetCommentSearchIndex();
|
resetCommentSearchIndex();
|
||||||
notifyItemRangeRemoved(0, getItemCount());
|
int removedItemCount = getItemCount();
|
||||||
mVisibleComments.clear();
|
mVisibleComments.clear();
|
||||||
|
notifyItemRangeRemoved(0, removedItemCount);
|
||||||
isInitiallyLoading = true;
|
isInitiallyLoading = true;
|
||||||
isInitiallyLoadingFailed = false;
|
isInitiallyLoadingFailed = false;
|
||||||
notifyItemInserted(0);
|
notifyItemInserted(0);
|
||||||
@ -1224,7 +1227,12 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
commentMarkdownView.setTypeface(mActivity.contentTypeface);
|
commentMarkdownView.setTypeface(mActivity.contentTypeface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mShowAuthorAvatar) {
|
||||||
authorIconImageView.setVisibility(View.VISIBLE);
|
authorIconImageView.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
((ConstraintLayout.LayoutParams) authorTextView.getLayoutParams()).leftMargin = 0;
|
||||||
|
((ConstraintLayout.LayoutParams) authorFlairTextView.getLayoutParams()).leftMargin = 0;
|
||||||
|
}
|
||||||
|
|
||||||
itemView.setBackgroundColor(mCommentBackgroundColor);
|
itemView.setBackgroundColor(mCommentBackgroundColor);
|
||||||
authorTextView.setTextColor(mUsernameColor);
|
authorTextView.setTextColor(mUsernameColor);
|
||||||
@ -1341,7 +1349,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
Utils.getNVotes(mShowAbsoluteNumberOfVotes,
|
||||||
comment.getScore() + comment.getVoteType())));
|
comment.getScore() + comment.getVoteType())));
|
||||||
|
|
||||||
int position = getBindingAdapterPosition();
|
|
||||||
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onVoteThingSuccess(int position) {
|
public void onVoteThingSuccess(int position) {
|
||||||
@ -1516,6 +1523,10 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
authorIconImageView.setOnClickListener(view -> {
|
||||||
|
authorTextView.performClick();
|
||||||
|
});
|
||||||
|
|
||||||
expandButton.setOnClickListener(view -> {
|
expandButton.setOnClickListener(view -> {
|
||||||
if (expandButton.getVisibility() == View.VISIBLE) {
|
if (expandButton.getVisibility() == View.VISIBLE) {
|
||||||
int commentPosition = mIsSingleCommentThreadMode ? getBindingAdapterPosition() - 1 : getBindingAdapterPosition();
|
int commentPosition = mIsSingleCommentThreadMode ? getBindingAdapterPosition() - 1 : getBindingAdapterPosition();
|
||||||
@ -1523,6 +1534,9 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
if (mVisibleComments.get(commentPosition).isExpanded()) {
|
if (mVisibleComments.get(commentPosition).isExpanded()) {
|
||||||
collapseChildren(commentPosition);
|
collapseChildren(commentPosition);
|
||||||
|
if (comment.getChildCount() > 0) {
|
||||||
|
expandButton.setText("+" + comment.getChildCount());
|
||||||
|
}
|
||||||
expandButton.setCompoundDrawablesWithIntrinsicBounds(expandDrawable, null, null, null);
|
expandButton.setCompoundDrawablesWithIntrinsicBounds(expandDrawable, null, null, null);
|
||||||
} else {
|
} else {
|
||||||
comment.setExpanded(true);
|
comment.setExpanded(true);
|
||||||
@ -1536,6 +1550,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
} else {
|
} else {
|
||||||
notifyItemRangeInserted(commentPosition + 1, newList.size());
|
notifyItemRangeInserted(commentPosition + 1, newList.size());
|
||||||
}
|
}
|
||||||
|
expandButton.setText("");
|
||||||
expandButton.setCompoundDrawablesWithIntrinsicBounds(collapseDrawable, null, null, null);
|
expandButton.setCompoundDrawablesWithIntrinsicBounds(collapseDrawable, null, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1665,6 +1680,12 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
commentDivider.setVisibility(View.VISIBLE);
|
commentDivider.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mShowAuthorAvatar) {
|
||||||
|
authorIconImageView.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
usernameTextView.setPaddingRelative(0, usernameTextView.getPaddingTop(), usernameTextView.getPaddingEnd(), usernameTextView.getPaddingBottom());
|
||||||
|
}
|
||||||
|
|
||||||
itemView.setOnClickListener(view -> {
|
itemView.setOnClickListener(view -> {
|
||||||
int commentPosition = mIsSingleCommentThreadMode ? getBindingAdapterPosition() - 1 : getBindingAdapterPosition();
|
int commentPosition = mIsSingleCommentThreadMode ? getBindingAdapterPosition() - 1 : getBindingAdapterPosition();
|
||||||
if (commentPosition >= 0 && commentPosition < mVisibleComments.size()) {
|
if (commentPosition >= 0 && commentPosition < mVisibleComments.size()) {
|
||||||
|
@ -253,6 +253,6 @@ public class MultiReddit implements Parcelable {
|
|||||||
parcel.writeByte((byte) (over18 ? 1 : 0));
|
parcel.writeByte((byte) (over18 ? 1 : 0));
|
||||||
parcel.writeByte((byte) (isSubscriber ? 1 : 0));
|
parcel.writeByte((byte) (isSubscriber ? 1 : 0));
|
||||||
parcel.writeByte((byte) (isFavorite ? 1 : 0));
|
parcel.writeByte((byte) (isFavorite ? 1 : 0));
|
||||||
parcel.writeStringList(subreddits);
|
parcel.writeList(subreddits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ public class SubredditWithSelection implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected SubredditWithSelection(Parcel in) {
|
protected SubredditWithSelection(Parcel in) {
|
||||||
super();
|
|
||||||
name = in.readString();
|
name = in.readString();
|
||||||
iconUrl = in.readString();
|
iconUrl = in.readString();
|
||||||
selected = in.readByte() != 0;
|
selected = in.readByte() != 0;
|
||||||
|
@ -204,6 +204,7 @@ public class SharedPreferencesUtils {
|
|||||||
public static final String HIDE_TEXT_POST_CONTENT = "hide_text_post_content";
|
public static final String HIDE_TEXT_POST_CONTENT = "hide_text_post_content";
|
||||||
public static final String HIDE_COMMENT_AWARDS = "hide_comment_awards";
|
public static final String HIDE_COMMENT_AWARDS = "hide_comment_awards";
|
||||||
public static final String SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD = "show_fewer_toolbar_options_threshold";
|
public static final String SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD = "show_fewer_toolbar_options_threshold";
|
||||||
|
public static final String SHOW_AUTHOR_AVATAR = "show_author_avatar";
|
||||||
|
|
||||||
public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences";
|
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";
|
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
android:id="@+id/author_icon_image_view_item_comment_fully_collapsed"
|
android:id="@+id/author_icon_image_view_item_comment_fully_collapsed"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_gravity="center_vertical" />
|
android:layout_gravity="center_vertical"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/user_name_text_view_item_comment_fully_collapsed"
|
android:id="@+id/user_name_text_view_item_comment_fully_collapsed"
|
||||||
|
@ -629,6 +629,7 @@
|
|||||||
<string name="settings_hide_comment_awards_title">Hide Comment Awards</string>
|
<string name="settings_hide_comment_awards_title">Hide Comment Awards</string>
|
||||||
<string name="settings_show_fewer_toolbar_options_threshold_title">Show Fewer Toolbar Options Starting From</string>
|
<string name="settings_show_fewer_toolbar_options_threshold_title">Show Fewer Toolbar Options Starting From</string>
|
||||||
<string name="settings_show_fewer_toolbar_options_threshold_summary">Level %1$d</string>
|
<string name="settings_show_fewer_toolbar_options_threshold_summary">Level %1$d</string>
|
||||||
|
<string name="settings_show_author_avatar_title">Hide Author Avatar</string>
|
||||||
|
|
||||||
<string name="no_link_available">Cannot get the link</string>
|
<string name="no_link_available">Cannot get the link</string>
|
||||||
|
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
app:key="fully_collapse_comment"
|
app:key="fully_collapse_comment"
|
||||||
android:title="@string/settings_fully_collapse_comment_title" />
|
android:title="@string/settings_fully_collapse_comment_title" />
|
||||||
|
|
||||||
|
<ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="show_author_avatar"
|
||||||
|
android:title="@string/settings_show_author_avatar_title" />
|
||||||
|
|
||||||
<ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference
|
<ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
app:key="hide_comment_awards"
|
app:key="hide_comment_awards"
|
||||||
|
Loading…
Reference in New Issue
Block a user