mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 21:59:54 +01:00
[android] migrate added conversation header to new LiveEvent
This commit is contained in:
@@ -243,7 +243,7 @@ public class ConversationActivity extends BriarActivity
|
|||||||
requireNonNull(deleted);
|
requireNonNull(deleted);
|
||||||
if (deleted) finish();
|
if (deleted) finish();
|
||||||
});
|
});
|
||||||
viewModel.getAddedPrivateMessage().observe(this,
|
viewModel.getAddedPrivateMessage().observeEvent(this,
|
||||||
this::onAddedPrivateMessage);
|
this::onAddedPrivateMessage);
|
||||||
|
|
||||||
setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId));
|
setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId));
|
||||||
@@ -678,7 +678,6 @@ public class ConversationActivity extends BriarActivity
|
|||||||
private void onAddedPrivateMessage(@Nullable PrivateMessageHeader h) {
|
private void onAddedPrivateMessage(@Nullable PrivateMessageHeader h) {
|
||||||
if (h == null) return;
|
if (h == null) return;
|
||||||
addConversationItem(h.accept(visitor));
|
addConversationItem(h.accept(visitor));
|
||||||
viewModel.onAddedPrivateMessageSeen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void askToRemoveContact() {
|
private void askToRemoveContact() {
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ public class ConversationViewModel extends AndroidViewModel
|
|||||||
new MutableLiveData<>();
|
new MutableLiveData<>();
|
||||||
private final MutableLiveData<Boolean> contactDeleted =
|
private final MutableLiveData<Boolean> contactDeleted =
|
||||||
new MutableLiveData<>();
|
new MutableLiveData<>();
|
||||||
private final MutableLiveData<PrivateMessageHeader> addedHeader =
|
private final MutableLiveEvent<PrivateMessageHeader> addedHeader =
|
||||||
new MutableLiveData<>();
|
new MutableLiveEvent<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ConversationViewModel(Application application,
|
ConversationViewModel(Application application,
|
||||||
@@ -301,18 +301,13 @@ public class ConversationViewModel extends AndroidViewModel
|
|||||||
text != null, attachments);
|
text != null, attachments);
|
||||||
attachmentCreator.onAttachmentsSent(m.getMessage().getId());
|
attachmentCreator.onAttachmentsSent(m.getMessage().getId());
|
||||||
// TODO add text to cache when available here
|
// TODO add text to cache when available here
|
||||||
addedHeader.postValue(h);
|
addedHeader.postEvent(h);
|
||||||
} catch (DbException e) {
|
} catch (DbException e) {
|
||||||
logException(LOG, WARNING, e);
|
logException(LOG, WARNING, e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
|
||||||
void onAddedPrivateMessageSeen() {
|
|
||||||
addedHeader.setValue(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
AttachmentRetriever getAttachmentRetriever() {
|
AttachmentRetriever getAttachmentRetriever() {
|
||||||
return attachmentRetriever;
|
return attachmentRetriever;
|
||||||
}
|
}
|
||||||
@@ -349,7 +344,7 @@ public class ConversationViewModel extends AndroidViewModel
|
|||||||
return contactDeleted;
|
return contactDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
LiveData<PrivateMessageHeader> getAddedPrivateMessage() {
|
LiveEvent<PrivateMessageHeader> getAddedPrivateMessage() {
|
||||||
return addedHeader;
|
return addedHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user