fix option not being there when editing

This commit is contained in:
sk 2022-11-07 20:46:49 +01:00
parent 534fd8c119
commit ef75427b45
1 changed files with 8 additions and 7 deletions

View File

@ -358,7 +358,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);
if(savedInstanceState!=null && savedInstanceState.containsKey("attachments")){ if(savedInstanceState!=null && savedInstanceState.containsKey("attachments")){
@ -381,7 +382,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);
@ -563,6 +563,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
} }
} }
updateSensitive();
if(editingStatus!=null){ if(editingStatus!=null){
updateCharCounter(); updateCharCounter();
visibilityBtn.setEnabled(false); visibilityBtn.setEnabled(false);
@ -879,7 +881,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;
@ -1054,7 +1056,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){
@ -1250,7 +1252,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("");
@ -1259,7 +1260,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() {
@ -1267,7 +1268,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;