comment #702 - Allow to disable some icons

This commit is contained in:
Thomas 2022-12-30 17:53:26 +01:00
parent e5c4efb4e9
commit 31929850c3
4 changed files with 68 additions and 3 deletions

View File

@ -397,6 +397,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
boolean displayCounters = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_COUNTER_FAV_BOOST), false);
boolean removeLeftMargin = sharedpreferences.getBoolean(context.getString(R.string.SET_REMOVE_LEFT_MARGIN), false);
boolean extraFeatures = sharedpreferences.getBoolean(context.getString(R.string.SET_EXTAND_EXTRA_FEATURES) + MainActivity.currentUserID + MainActivity.currentInstance, false);
boolean displayQuote = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_QUOTES) + MainActivity.currentUserID + MainActivity.currentInstance, true);
boolean displayReactions = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_REACTIONS) + MainActivity.currentUserID + MainActivity.currentInstance, true);
if (removeLeftMargin) {
LinearLayoutCompat.MarginLayoutParams p = (LinearLayoutCompat.MarginLayoutParams) holder.binding.spoiler.getLayoutParams();
@ -609,9 +611,20 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
int truncate_toots_size = sharedpreferences.getInt(context.getString(R.string.SET_TRUNCATE_TOOTS_SIZE), 0);
if (extraFeatures) {
if (displayQuote) {
holder.binding.actionButtonQuote.setVisibility(View.VISIBLE);
} else {
holder.binding.actionButtonQuote.setVisibility(View.GONE);
}
if (displayReactions) {
holder.binding.statusAddCustomEmoji.setVisibility(View.VISIBLE);
holder.binding.statusEmoji.setVisibility(View.VISIBLE);
holder.binding.actionButtonQuote.setVisibility(View.VISIBLE);
} else {
holder.binding.statusAddCustomEmoji.setVisibility(View.GONE);
holder.binding.statusEmoji.setVisibility(View.GONE);
}
}
holder.binding.actionButtonFavorite.pressOnTouch(false);

View File

@ -58,6 +58,18 @@ public class FragmentExtraFeaturesSettings extends PreferenceFragmentCompat impl
SET_DISPLAY_TRANSLATE.setChecked(checked);
}
SwitchPreferenceCompat SET_DISPLAY_QUOTES = findPreference(getString(R.string.SET_DISPLAY_QUOTES));
if (SET_DISPLAY_QUOTES != null) {
boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_QUOTES) + MainActivity.currentUserID + MainActivity.currentInstance, true);
SET_DISPLAY_QUOTES.setChecked(checked);
}
SwitchPreferenceCompat SET_DISPLAY_REACTIONS = findPreference(getString(R.string.SET_DISPLAY_REACTIONS));
if (SET_DISPLAY_REACTIONS != null) {
boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_REACTIONS) + MainActivity.currentUserID + MainActivity.currentInstance, true);
SET_DISPLAY_REACTIONS.setChecked(checked);
}
ListPreference SET_POST_FORMAT = findPreference(getString(R.string.SET_POST_FORMAT));
if (SET_POST_FORMAT != null) {
SET_POST_FORMAT.getContext().setTheme(Helper.dialogStyle());
@ -89,6 +101,18 @@ public class FragmentExtraFeaturesSettings extends PreferenceFragmentCompat impl
editor.putBoolean(getString(R.string.SET_DISPLAY_TRANSLATE) + MainActivity.currentUserID + MainActivity.currentInstance, SET_DISPLAY_TRANSLATE.isChecked());
}
}
if (key.compareToIgnoreCase(getString(R.string.SET_DISPLAY_QUOTES)) == 0) {
SwitchPreferenceCompat SET_DISPLAY_QUOTES = findPreference(getString(R.string.SET_DISPLAY_QUOTES));
if (SET_DISPLAY_QUOTES != null) {
editor.putBoolean(getString(R.string.SET_DISPLAY_QUOTES) + MainActivity.currentUserID + MainActivity.currentInstance, SET_DISPLAY_QUOTES.isChecked());
}
}
if (key.compareToIgnoreCase(getString(R.string.SET_DISPLAY_REACTIONS)) == 0) {
SwitchPreferenceCompat SET_DISPLAY_REACTIONS = findPreference(getString(R.string.SET_DISPLAY_REACTIONS));
if (SET_DISPLAY_REACTIONS != null) {
editor.putBoolean(getString(R.string.SET_DISPLAY_REACTIONS) + MainActivity.currentUserID + MainActivity.currentInstance, SET_DISPLAY_REACTIONS.isChecked());
}
}
if (key.compareToIgnoreCase(getString(R.string.SET_POST_FORMAT)) == 0) {
ListPreference SET_POST_FORMAT = findPreference(getString(R.string.SET_POST_FORMAT));
if (SET_POST_FORMAT != null) {

View File

@ -1428,6 +1428,9 @@
<string name="SET_FILTER_REGEX_PUBLIC" translatable="false">SET_FILTER_REGEX_PUBLIC</string>
<string name="SET_NOTIF_VALIDATION" translatable="false">SET_NOTIF_VALIDATION</string>
<string name="SET_DISPLAY_BOOKMARK" translatable="false">SET_DISPLAY_BOOKMARK</string>
<string name="SET_DISPLAY_QUOTES" translatable="false">SET_DISPLAY_QUOTES</string>
<string name="SET_DISPLAY_REACTIONS" translatable="false">SET_DISPLAY_REACTIONS</string>
<string name="SET_DISPLAY_TRANSLATE" translatable="false">SET_DISPLAY_TRANSLATE</string>
<string name="SET_POST_FORMAT" translatable="false">SET_POST_FORMAT</string>
@ -2167,4 +2170,8 @@
<string name="icons_visibility_summary">You can safely hide these icons at the bottom to have more space. They are also in the submenu.</string>
<string name="post_format">Post format</string>
<string name="set_post_format">Post format</string>
<string name="icons_extra_features">Icons for extra features</string>
<string name="icons_extra_features_visibility_summary">If your instance does not accept some extra features, you can hide these icons</string>
<string name="set_display_quote_indication">Display the \"Quote\" button</string>
<string name="set_display_reaction_indication">Display \"Reactions\" buttons</string>
</resources>

View File

@ -28,6 +28,27 @@
app:title="@string/set_display_translate_indication" />
</app.fedilab.android.helper.settings.LongSummaryPreferenceCategory>
<app.fedilab.android.helper.settings.LongSummaryPreferenceCategory
app:dependency="@string/SET_EXTAND_EXTRA_FEATURES"
app:iconSpaceReserved="false"
app:key="bottom_icon"
app:summary="@string/icons_extra_features_visibility_summary"
app:title="@string/icons_extra_features">
<SwitchPreferenceCompat
android:defaultValue="true"
app:iconSpaceReserved="false"
app:key="@string/SET_DISPLAY_QUOTES"
app:singleLineTitle="false"
app:title="@string/set_display_quote_indication" />
<SwitchPreferenceCompat
android:defaultValue="true"
app:iconSpaceReserved="false"
app:key="@string/SET_DISPLAY_REACTIONS"
app:singleLineTitle="false"
app:title="@string/set_display_reaction_indication" />
</app.fedilab.android.helper.settings.LongSummaryPreferenceCategory>
<ListPreference
app:defaultValue="text/plain"
app:dependency="@string/SET_EXTAND_EXTRA_FEATURES"