Warn before boosting a message having no media description
This commit is contained in:
parent
09e00cbbee
commit
22b43db39b
|
@ -428,6 +428,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
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);
|
boolean hideSingleMediaWithCard = sharedpreferences.getBoolean(context.getString(R.string.SET_HIDE_SINGLE_MEDIA_WITH_CARD), false);
|
||||||
boolean autofetch = sharedpreferences.getBoolean(context.getString(R.string.SET_AUTO_FETCH_MISSING_MESSAGES), false);
|
boolean autofetch = sharedpreferences.getBoolean(context.getString(R.string.SET_AUTO_FETCH_MISSING_MESSAGES), false);
|
||||||
|
boolean warnNoMedia = sharedpreferences.getBoolean(context.getString(R.string.SET_MANDATORY_ALT_TEXT_FOR_BOOSTS), true);
|
||||||
|
|
||||||
|
|
||||||
if (compactButtons) {
|
if (compactButtons) {
|
||||||
|
@ -988,12 +989,26 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
holder.binding.actionButtonBoost.setOnClickListener(v -> {
|
holder.binding.actionButtonBoost.setOnClickListener(v -> {
|
||||||
if (confirmBoost) {
|
boolean needToWarnForMissingDescription = false;
|
||||||
|
if (warnNoMedia && statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0) {
|
||||||
|
for (Attachment attachment : statusToDeal.media_attachments) {
|
||||||
|
if (attachment.description == null || attachment.description.trim().length() == 0) {
|
||||||
|
needToWarnForMissingDescription = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (confirmBoost || needToWarnForMissingDescription) {
|
||||||
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(context);
|
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(context);
|
||||||
|
|
||||||
if (statusToDeal.reblogged) {
|
if (statusToDeal.reblogged) {
|
||||||
alt_bld.setMessage(context.getString(R.string.reblog_remove));
|
alt_bld.setMessage(context.getString(R.string.reblog_remove));
|
||||||
} else {
|
} else {
|
||||||
alt_bld.setMessage(context.getString(R.string.reblog_add));
|
if (!needToWarnForMissingDescription) {
|
||||||
|
alt_bld.setMessage(context.getString(R.string.reblog_add));
|
||||||
|
} else {
|
||||||
|
alt_bld.setMessage(context.getString(R.string.reblog_missing_description));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
alt_bld.setPositiveButton(R.string.yes, (dialog, id) -> {
|
alt_bld.setPositiveButton(R.string.yes, (dialog, id) -> {
|
||||||
if (remote) {
|
if (remote) {
|
||||||
|
|
|
@ -71,6 +71,8 @@
|
||||||
<string name="favourite_add">Add this message to your favourites?</string>
|
<string name="favourite_add">Add this message to your favourites?</string>
|
||||||
<string name="favourite_remove">Remove this message from your favourites?</string>
|
<string name="favourite_remove">Remove this message from your favourites?</string>
|
||||||
<string name="reblog_add">Boost this message?</string>
|
<string name="reblog_add">Boost this message?</string>
|
||||||
|
<string name="warn_boost_no_media_description">Warn if message has no media description before boosting</string>
|
||||||
|
<string name="reblog_missing_description">This message has missing media description. Are you sure to boost it?</string>
|
||||||
<string name="reblog_remove">Unboost this message?</string>
|
<string name="reblog_remove">Unboost this message?</string>
|
||||||
<string name="more_action_1">Mute</string>
|
<string name="more_action_1">Mute</string>
|
||||||
<string name="more_action_2">Block</string>
|
<string name="more_action_2">Block</string>
|
||||||
|
@ -1096,6 +1098,8 @@
|
||||||
<string name="SET_FILTER_REGEX_LOCAL" translatable="false">SET_FILTER_REGEX_LOCAL</string>
|
<string name="SET_FILTER_REGEX_LOCAL" translatable="false">SET_FILTER_REGEX_LOCAL</string>
|
||||||
<string name="SET_FILTER_REGEX_PUBLIC" translatable="false">SET_FILTER_REGEX_PUBLIC</string>
|
<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_NOTIF_VALIDATION" translatable="false">SET_NOTIF_VALIDATION</string>
|
||||||
|
<string name="SET_MANDATORY_ALT_TEXT_FOR_BOOSTS" translatable="false">SET_MANDATORY_ALT_TEXT_FOR_BOOSTS</string>
|
||||||
|
|
||||||
<string name="SET_DISPLAY_BOOKMARK" translatable="false">SET_DISPLAY_BOOKMARK</string>
|
<string name="SET_DISPLAY_BOOKMARK" translatable="false">SET_DISPLAY_BOOKMARK</string>
|
||||||
<string name="SET_PIXELFED_PRESENTATION" translatable="false">SET_PIXELFED_PRESENTATION</string>
|
<string name="SET_PIXELFED_PRESENTATION" translatable="false">SET_PIXELFED_PRESENTATION</string>
|
||||||
<string name="SET_DISPLAY_QUOTES" translatable="false">SET_DISPLAY_QUOTES</string>
|
<string name="SET_DISPLAY_QUOTES" translatable="false">SET_DISPLAY_QUOTES</string>
|
||||||
|
|
|
@ -87,6 +87,12 @@
|
||||||
app:key="@string/SET_NOTIF_VALIDATION"
|
app:key="@string/SET_NOTIF_VALIDATION"
|
||||||
app:singleLineTitle="false"
|
app:singleLineTitle="false"
|
||||||
app:title="@string/set_share_validation" />
|
app:title="@string/set_share_validation" />
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
app:defaultValue="true"
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
app:key="@string/SET_MANDATORY_ALT_TEXT_FOR_BOOSTS"
|
||||||
|
app:singleLineTitle="false"
|
||||||
|
app:title="@string/warn_boost_no_media_description" />
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
|
|
|
@ -2,6 +2,7 @@ Added:
|
||||||
- Add a button to fetch remote media when it fails
|
- Add a button to fetch remote media when it fails
|
||||||
- Add a settings to automatically fetch remote media when it fails (default: disabled)
|
- Add a settings to automatically fetch remote media when it fails (default: disabled)
|
||||||
- Display on profiles & list of accounts if users have requested to follow you
|
- Display on profiles & list of accounts if users have requested to follow you
|
||||||
|
- Warn before boosting a message having no media description (default: enabled)
|
||||||
|
|
||||||
Changed:
|
Changed:
|
||||||
- Warn when there are missing descriptions enabled by default
|
- Warn when there are missing descriptions enabled by default
|
||||||
|
|
Loading…
Reference in New Issue