Merge branch 'feature/mark-media-as-sensitive' into fork

This commit is contained in:
sk 2022-11-07 20:47:15 +01:00
commit e7fb96b3ff
1 changed files with 8 additions and 7 deletions

View File

@ -374,7 +374,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
spoilerBtn.setSelected(true); spoilerBtn.setSelected(true);
} }
sensitive = savedInstanceState != null && savedInstanceState.getBoolean("sensitive", false); sensitive = editingStatus != null ? editingStatus.sensitive
: (savedInstanceState != null && savedInstanceState.getBoolean("sensitive", false));
sensitiveIcon.setSelected(sensitive); sensitiveIcon.setSelected(sensitive);
ArrayList<Parcelable> serializedAttachments=(savedInstanceState!=null ? savedInstanceState : getArguments()) ArrayList<Parcelable> serializedAttachments=(savedInstanceState!=null ? savedInstanceState : getArguments())
@ -398,7 +399,6 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
} }
updateVisibilityIcon(); updateVisibilityIcon();
updateSensitivity();
autocompleteViewController=new ComposeAutocompleteViewController(getActivity(), accountID); autocompleteViewController=new ComposeAutocompleteViewController(getActivity(), accountID);
autocompleteViewController.setCompletionSelectedListener(this::onAutocompleteOptionSelected); autocompleteViewController.setCompletionSelectedListener(this::onAutocompleteOptionSelected);
@ -580,6 +580,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
} }
} }
updateSensitive();
if(editingStatus!=null){ if(editingStatus!=null){
updateCharCounter(); updateCharCounter();
visibilityBtn.setEnabled(false); visibilityBtn.setEnabled(false);
@ -897,7 +899,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
uploadNextQueuedAttachment(); uploadNextQueuedAttachment();
} }
updatePublishButtonState(); updatePublishButtonState();
updateSensitivity(); updateSensitive();
if(getMediaAttachmentsCount()==MAX_ATTACHMENTS) if(getMediaAttachmentsCount()==MAX_ATTACHMENTS)
mediaBtn.setEnabled(false); mediaBtn.setEnabled(false);
return true; return true;
@ -1072,7 +1074,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
updatePublishButtonState(); updatePublishButtonState();
pollBtn.setEnabled(attachments.isEmpty()); pollBtn.setEnabled(attachments.isEmpty());
mediaBtn.setEnabled(true); mediaBtn.setEnabled(true);
updateSensitivity(); updateSensitive();
} }
private void onRetryOrCancelMediaUploadClick(View v){ private void onRetryOrCancelMediaUploadClick(View v){
@ -1268,7 +1270,6 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
spoilerEdit.setVisibility(View.VISIBLE); spoilerEdit.setVisibility(View.VISIBLE);
spoilerBtn.setSelected(true); spoilerBtn.setSelected(true);
spoilerEdit.requestFocus(); spoilerEdit.requestFocus();
updateSensitivity();
}else{ }else{
spoilerEdit.setVisibility(View.GONE); spoilerEdit.setVisibility(View.GONE);
spoilerEdit.setText(""); spoilerEdit.setText("");
@ -1277,7 +1278,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
updateCharCounter(); updateCharCounter();
sensitiveIcon.setVisibility(getMediaAttachmentsCount() > 0 ? View.VISIBLE : View.GONE); sensitiveIcon.setVisibility(getMediaAttachmentsCount() > 0 ? View.VISIBLE : View.GONE);
} }
updateSensitivity(); updateSensitive();
} }
private void toggleSensitive() { private void toggleSensitive() {
@ -1285,7 +1286,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
sensitiveIcon.setSelected(sensitive); sensitiveIcon.setSelected(sensitive);
} }
private void updateSensitivity() { private void updateSensitive() {
sensitiveItem.setVisibility(View.GONE); sensitiveItem.setVisibility(View.GONE);
if (!attachments.isEmpty() && !hasSpoiler) sensitiveItem.setVisibility(View.VISIBLE); if (!attachments.isEmpty() && !hasSpoiler) sensitiveItem.setVisibility(View.VISIBLE);
if (attachments.isEmpty()) sensitive = false; if (attachments.isEmpty()) sensitive = false;