mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-29 19:14:44 +01:00
New option: Settings->Interface->Comment->Show Fewer Toolbar Options Starting From.
This commit is contained in:
parent
2569742e1c
commit
5a5011f19e
@ -82,6 +82,7 @@ import ml.docilealligator.infinityforreddit.services.EditProfileService;
|
||||
import ml.docilealligator.infinityforreddit.services.MaterialYouService;
|
||||
import ml.docilealligator.infinityforreddit.services.SubmitPostService;
|
||||
import ml.docilealligator.infinityforreddit.settings.AdvancedPreferenceFragment;
|
||||
import ml.docilealligator.infinityforreddit.settings.CommentPreferenceFragment;
|
||||
import ml.docilealligator.infinityforreddit.settings.CrashReportsFragment;
|
||||
import ml.docilealligator.infinityforreddit.settings.CustomizeBottomAppBarFragment;
|
||||
import ml.docilealligator.infinityforreddit.settings.CustomizeMainPageTabsFragment;
|
||||
@ -292,4 +293,6 @@ public interface AppComponent {
|
||||
void inject(EditProfileActivity editProfileActivity);
|
||||
|
||||
void inject(FontPreferenceFragment fontPreferenceFragment);
|
||||
|
||||
void inject(CommentPreferenceFragment commentPreferenceFragment);
|
||||
}
|
||||
|
@ -115,6 +115,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
private boolean mFullyCollapseComment;
|
||||
private boolean mShowOnlyOneCommentLevelIndicator;
|
||||
private boolean mHideCommentAwards;
|
||||
private int mDepthThreshold;
|
||||
private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback;
|
||||
private boolean isInitiallyLoading;
|
||||
private boolean isInitiallyLoadingFailed;
|
||||
@ -123,7 +124,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
private Drawable expandDrawable;
|
||||
private Drawable collapseDrawable;
|
||||
|
||||
private int depthThreshold = 5;
|
||||
private int mColorPrimaryLightTheme;
|
||||
private int mColorAccent;
|
||||
private int mCircularProgressBarBackgroundColor;
|
||||
@ -237,6 +237,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
mFullyCollapseComment = sharedPreferences.getBoolean(SharedPreferencesUtils.FULLY_COLLAPSE_COMMENT, false);
|
||||
mShowOnlyOneCommentLevelIndicator = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ONLY_ONE_COMMENT_LEVEL_INDICATOR, false);
|
||||
mHideCommentAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_COMMENT_AWARDS, false);
|
||||
mDepthThreshold = sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5);
|
||||
|
||||
mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback;
|
||||
isInitiallyLoading = true;
|
||||
@ -451,7 +452,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
|
||||
((CommentViewHolder) holder).commentIndentationView.setShowOnlyOneDivider(mShowOnlyOneCommentLevelIndicator);
|
||||
((CommentViewHolder) holder).commentIndentationView.setLevelAndColors(comment.getDepth(), verticalBlockColors);
|
||||
if (comment.getDepth() > depthThreshold) {
|
||||
if (comment.getDepth() >= mDepthThreshold) {
|
||||
((CommentViewHolder) holder).saveButton.setVisibility(View.GONE);
|
||||
((CommentViewHolder) holder).replyButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
@ -1260,7 +1261,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
}
|
||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_COMMENT_MARKDOWN, comment.getCommentMarkdown());
|
||||
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_IS_NSFW, mPost.isNSFW());
|
||||
if (comment.getDepth() > depthThreshold) {
|
||||
if (comment.getDepth() >= mDepthThreshold) {
|
||||
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_SHOW_REPLY_AND_SAVE_OPTION, true);
|
||||
}
|
||||
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
||||
|
@ -1,18 +1,45 @@
|
||||
package ml.docilealligator.infinityforreddit.settings;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SeekBarPreference;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.customviews.CustomFontPreferenceFragmentCompat;
|
||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||
|
||||
public class CommentPreferenceFragment extends CustomFontPreferenceFragmentCompat {
|
||||
|
||||
@Inject
|
||||
@Named("default")
|
||||
SharedPreferences sharedPreferences;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
setPreferencesFromResource(R.xml.comment_preferences, rootKey);
|
||||
|
||||
((Infinity) activity.getApplication()).getAppComponent().inject(this);
|
||||
|
||||
if (activity.typeface != null) {
|
||||
setFont(activity.typeface);
|
||||
}
|
||||
|
||||
SeekBarPreference showFewerToolbarOptionsThresholdSeekBarPreference = findPreference(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD);
|
||||
|
||||
if (showFewerToolbarOptionsThresholdSeekBarPreference != null) {
|
||||
showFewerToolbarOptionsThresholdSeekBarPreference.setSummary(getString(R.string.settings_show_fewer_toolbar_options_threshold_summary, sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5)));
|
||||
|
||||
showFewerToolbarOptionsThresholdSeekBarPreference.setOnPreferenceChangeListener((Preference.OnPreferenceChangeListener) (preference, newValue) -> {
|
||||
showFewerToolbarOptionsThresholdSeekBarPreference.setSummary(
|
||||
getString(R.string.settings_show_fewer_toolbar_options_threshold_summary, (Integer) newValue));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -203,6 +203,7 @@ public class SharedPreferencesUtils {
|
||||
public static final String FIXED_HEIGHT_PREVIEW_IN_CARD = "fixed_height_preview_in_card";
|
||||
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 SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD = "show_fewer_toolbar_options_threshold";
|
||||
|
||||
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";
|
||||
|
@ -627,6 +627,8 @@
|
||||
<string name="settings_fixed_height_preview_in_card_title">Fixed Height in Card</string>
|
||||
<string name="settings_hide_text_post_content">Hide Text Post Content</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_summary">Level %1$d</string>
|
||||
|
||||
<string name="no_link_available">Cannot get the link</string>
|
||||
|
||||
|
@ -37,4 +37,11 @@
|
||||
app:key="hide_comment_awards"
|
||||
android:title="@string/settings_hide_comment_awards_title" />
|
||||
|
||||
<ml.docilealligator.infinityforreddit.customviews.CustomFontSeekBarPreference
|
||||
app:defaultValue="5"
|
||||
android:max="10"
|
||||
app:key="show_fewer_toolbar_options_threshold"
|
||||
app:title="@string/settings_show_fewer_toolbar_options_threshold_title"
|
||||
app:singleLineTitle="false" />
|
||||
|
||||
</PreferenceScreen>
|
Loading…
x
Reference in New Issue
Block a user