fix message comparator
This commit is contained in:
parent
cc07f86bf4
commit
d52cbb8e8c
|
@ -13,7 +13,6 @@ public class ChatOverviewComparator extends DiffUtil.ItemCallback<ChatOverviewIt
|
||||||
@Override
|
@Override
|
||||||
public boolean areItemsTheSame(
|
public boolean areItemsTheSame(
|
||||||
@NonNull ChatOverviewItem oldItem, @NonNull ChatOverviewItem newItem) {
|
@NonNull ChatOverviewItem oldItem, @NonNull ChatOverviewItem newItem) {
|
||||||
// LOGGER.info("areItemsTheSame({},{})", oldItem.id, newItem.id);
|
|
||||||
return oldItem.id == newItem.id;
|
return oldItem.id == newItem.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@ public class MessageComparator extends DiffUtil.ItemCallback<MessageWithContentR
|
||||||
public boolean areContentsTheSame(
|
public boolean areContentsTheSame(
|
||||||
@NonNull MessageWithContentReactions oldItem,
|
@NonNull MessageWithContentReactions oldItem,
|
||||||
@NonNull MessageWithContentReactions newItem) {
|
@NonNull MessageWithContentReactions newItem) {
|
||||||
final var equals = oldItem.equals(newItem);
|
final var areContentsTheSame = oldItem.equals(newItem);
|
||||||
if (!equals) {
|
if (!areContentsTheSame) {
|
||||||
LOGGER.info("Message {} got modified", oldItem.id);
|
LOGGER.info("Message {} got modified", oldItem.id);
|
||||||
}
|
}
|
||||||
return false;
|
return areContentsTheSame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,7 @@ public class ChatFragment extends Fragment {
|
||||||
.getMessages()
|
.getMessages()
|
||||||
.observe(
|
.observe(
|
||||||
getViewLifecycleOwner(),
|
getViewLifecycleOwner(),
|
||||||
pagingData -> {
|
pagingData -> messageAdapter.submitData(getLifecycle(), pagingData));
|
||||||
LOGGER.info("submitData()");
|
|
||||||
messageAdapter.submitData(getLifecycle(), pagingData);
|
|
||||||
});
|
|
||||||
this.binding.materialToolbar.setNavigationOnClickListener(
|
this.binding.materialToolbar.setNavigationOnClickListener(
|
||||||
view -> {
|
view -> {
|
||||||
NavControllers.findNavController(requireActivity(), R.id.nav_host_fragment)
|
NavControllers.findNavController(requireActivity(), R.id.nav_host_fragment)
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ChatViewModel extends AndroidViewModel {
|
||||||
chatId -> {
|
chatId -> {
|
||||||
final Pager<Integer, MessageWithContentReactions> pager =
|
final Pager<Integer, MessageWithContentReactions> pager =
|
||||||
new Pager<>(
|
new Pager<>(
|
||||||
new PagingConfig(30),
|
new PagingConfig(50),
|
||||||
() -> chatRepository.getMessages(chatId));
|
() -> chatRepository.getMessages(chatId));
|
||||||
return PagingLiveData.getLiveData(pager);
|
return PagingLiveData.getLiveData(pager);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue