Hide single media with preview is now a setting (default: disabled)

This commit is contained in:
Thomas 2023-01-16 16:49:48 +01:00
parent 21abe0e297
commit a1f97d7cfa
4 changed files with 19 additions and 2 deletions

View file

@ -407,6 +407,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
boolean displayReactions = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_REACTIONS) + MainActivity.currentUserID + MainActivity.currentInstance, true); boolean displayReactions = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_REACTIONS) + MainActivity.currentUserID + MainActivity.currentInstance, true);
boolean compactButtons = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_COMPACT_ACTION_BUTTON), false); boolean compactButtons = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_COMPACT_ACTION_BUTTON), false);
boolean originalDateForBoost = sharedpreferences.getBoolean(context.getString(R.string.SET_BOOST_ORIGINAL_DATE), true); boolean originalDateForBoost = sharedpreferences.getBoolean(context.getString(R.string.SET_BOOST_ORIGINAL_DATE), true);
boolean hideSingleMediaWithCard = sharedpreferences.getBoolean(context.getString(R.string.SET_HIDE_SINGLE_MEDIA_WITH_CARD), false);
if (compactButtons) { if (compactButtons) {
ConstraintSet set = new ConstraintSet(); ConstraintSet set = new ConstraintSet();
@ -1343,7 +1344,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
LayoutInflater inflater = ((Activity) context).getLayoutInflater(); LayoutInflater inflater = ((Activity) context).getLayoutInflater();
//--- MEDIA ATTACHMENT --- //--- MEDIA ATTACHMENT ---
boolean cardDisplayed = (statusToDeal.card != null && (display_card || statusToDeal.isFocused) && statusToDeal.quote_id == null); boolean cardDisplayed = (statusToDeal.card != null && (display_card || statusToDeal.isFocused) && statusToDeal.quote_id == null);
if (statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0 && (!cardDisplayed || statusToDeal.media_attachments.size() > 1)) { if (statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0 && (!hideSingleMediaWithCard || !cardDisplayed || statusToDeal.media_attachments.size() > 1)) {
holder.binding.attachmentsList.removeAllViews(); holder.binding.attachmentsList.removeAllViews();
holder.binding.mediaContainer.removeAllViews(); holder.binding.mediaContainer.removeAllViews();

View file

@ -1480,7 +1480,7 @@
<string name="SET_EXPAND_MEDIA" translatable="false">SET_EXPAND_MEDIA</string> <string name="SET_EXPAND_MEDIA" translatable="false">SET_EXPAND_MEDIA</string>
<string name="SET_GROUP_REBLOGS" translatable="false">SET_GROUP_REBLOGS</string> <string name="SET_GROUP_REBLOGS" translatable="false">SET_GROUP_REBLOGS</string>
<string name="SET_BOOST_ORIGINAL_DATE" translatable="false">SET_BOOST_ORIGINAL_DATE</string> <string name="SET_BOOST_ORIGINAL_DATE" translatable="false">SET_BOOST_ORIGINAL_DATE</string>
<string name="SET_HIDE_SINGLE_MEDIA_WITH_CARD" translatable="false">SET_HIDE_SINGLE_MEDIA_WITH_CARD</string>
<string name="SET_LIVE_TRANSLATE" translatable="false">SET_LIVE_TRANSLATE</string> <string name="SET_LIVE_TRANSLATE" translatable="false">SET_LIVE_TRANSLATE</string>
<string name="SET_TRUNCATE_TOOTS_SIZE" translatable="false">SET_TRUNCATE_TOOTS_SIZE</string> <string name="SET_TRUNCATE_TOOTS_SIZE" translatable="false">SET_TRUNCATE_TOOTS_SIZE</string>
<string name="SET_ART_WITH_NSFW" translatable="false">SET_ART_WITH_NSFW</string> <string name="SET_ART_WITH_NSFW" translatable="false">SET_ART_WITH_NSFW</string>
@ -2223,4 +2223,5 @@
<string name="formula">Formula</string> <string name="formula">Formula</string>
<string name="set_maths_support">Write formula</string> <string name="set_maths_support">Write formula</string>
<string name="maths_format">Maths format</string> <string name="maths_format">Maths format</string>
<string name="hide_single_media_with_card">Hide single media when there is a link preview</string>
</resources> </resources>

View file

@ -31,6 +31,13 @@
app:key="@string/SET_BOOST_ORIGINAL_DATE" app:key="@string/SET_BOOST_ORIGINAL_DATE"
app:singleLineTitle="false" app:singleLineTitle="false"
app:title="@string/boost_original_date" /> app:title="@string/boost_original_date" />
<SwitchPreferenceCompat
android:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/SET_HIDE_SINGLE_MEDIA_WITH_CARD"
app:singleLineTitle="false"
app:title="@string/hide_single_media_with_card" />
<ListPreference <ListPreference
android:defaultValue="default" android:defaultValue="default"
app:entries="@array/SET_LIVE_TRANSLATE_VALUES" app:entries="@array/SET_LIVE_TRANSLATE_VALUES"

View file

@ -0,0 +1,8 @@
Added:
- Maths support (view and compose)
Changed:
- Hide single media with preview is now a setting (default: disabled)
Fixed:
-