mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-26 12:44:38 +00:00
Fix some lifecycle-related crashes.
This commit is contained in:
@@ -814,7 +814,9 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||
items.add(new ActionItem(R.drawable.ic_reply_24_tinted, getResources().getString(R.string.conversation_selection__menu_reply), () -> {
|
||||
maybeShowSwipeToReplyTooltip();
|
||||
handleReplyMessage(getSelectedConversationMessage());
|
||||
actionMode.finish();
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -825,28 +827,36 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||
if (menuState.shouldShowSaveAttachmentAction()) {
|
||||
items.add(new ActionItem(R.drawable.ic_save_24_tinted, getResources().getString(R.string.conversation_selection__menu_save), () -> {
|
||||
handleSaveAttachment((MediaMmsMessageRecord) getSelectedConversationMessage().getMessageRecord());
|
||||
actionMode.finish();
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (menuState.shouldShowCopyAction()) {
|
||||
items.add(new ActionItem(R.drawable.ic_copy_24_tinted, getResources().getString(R.string.conversation_selection__menu_copy), () -> {
|
||||
handleCopyMessage(selectedParts);
|
||||
actionMode.finish();
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (menuState.shouldShowDetailsAction()) {
|
||||
items.add(new ActionItem(R.drawable.ic_info_tinted_24, getResources().getString(R.string.conversation_selection__menu_message_details), () -> {
|
||||
handleDisplayDetails(getSelectedConversationMessage());
|
||||
actionMode.finish();
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (menuState.shouldShowDeleteAction()) {
|
||||
items.add(new ActionItem(R.drawable.ic_delete_tinted_24, getResources().getString(R.string.conversation_selection__menu_delete), () -> {
|
||||
handleDeleteMessages(selectedParts);
|
||||
actionMode.finish();
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -2171,6 +2171,11 @@ public class ConversationParentFragment extends Fragment
|
||||
sendButton.setOnClickListener(sendButtonListener);
|
||||
sendButton.setEnabled(true);
|
||||
sendButton.addOnSelectionChangedListener((newMessageSendType, manuallySelected) -> {
|
||||
if (getContext() == null) {
|
||||
Log.w(TAG, "onSelectionChanged called in detached state. Ignoring.");
|
||||
return;
|
||||
}
|
||||
|
||||
calculateCharactersRemaining();
|
||||
updateLinkPreviewState();
|
||||
linkPreviewViewModel.onTransportChanged(newMessageSendType.usesSmsTransport());
|
||||
|
||||
@@ -82,6 +82,10 @@ class CircularProgressMaterialButton @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun transformTo(state: State, animate: Boolean) {
|
||||
if (!isAttachedToWindow) {
|
||||
return
|
||||
}
|
||||
|
||||
if (state == currentState && state == requestedState) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user