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