fix message comparator

This commit is contained in:
Daniel Gultsch 2023-03-27 11:18:29 +02:00
parent cc07f86bf4
commit d52cbb8e8c
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
4 changed files with 5 additions and 9 deletions

View file

@ -13,7 +13,6 @@ public class ChatOverviewComparator extends DiffUtil.ItemCallback<ChatOverviewIt
@Override
public boolean areItemsTheSame(
@NonNull ChatOverviewItem oldItem, @NonNull ChatOverviewItem newItem) {
// LOGGER.info("areItemsTheSame({},{})", oldItem.id, newItem.id);
return oldItem.id == newItem.id;
}

View file

@ -21,10 +21,10 @@ public class MessageComparator extends DiffUtil.ItemCallback<MessageWithContentR
public boolean areContentsTheSame(
@NonNull MessageWithContentReactions oldItem,
@NonNull MessageWithContentReactions newItem) {
final var equals = oldItem.equals(newItem);
if (!equals) {
final var areContentsTheSame = oldItem.equals(newItem);
if (!areContentsTheSame) {
LOGGER.info("Message {} got modified", oldItem.id);
}
return false;
return areContentsTheSame;
}
}

View file

@ -53,10 +53,7 @@ public class ChatFragment extends Fragment {
.getMessages()
.observe(
getViewLifecycleOwner(),
pagingData -> {
LOGGER.info("submitData()");
messageAdapter.submitData(getLifecycle(), pagingData);
});
pagingData -> messageAdapter.submitData(getLifecycle(), pagingData));
this.binding.materialToolbar.setNavigationOnClickListener(
view -> {
NavControllers.findNavController(requireActivity(), R.id.nav_host_fragment)

View file

@ -39,7 +39,7 @@ public class ChatViewModel extends AndroidViewModel {
chatId -> {
final Pager<Integer, MessageWithContentReactions> pager =
new Pager<>(
new PagingConfig(30),
new PagingConfig(50),
() -> chatRepository.getMessages(chatId));
return PagingLiveData.getLiveData(pager);
});