for now only added logic in IncomingTextMessageViewHolder.kt ...
- add thread button for quoted messages if thread of message != current thread
- open a new ChatActivity when clicked the button and pass threadId
- change the title
- add todos
for now, the parentId was taken instead of topmostParentId (which is not available yet)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
1. reverting changes from commit 971cc79b76. The scroll to methods are used in other places and a user reported that the search window suddenly opened without to search.
2. remove checkIfMessageIsSaved method. If the message is saved or not does not matter. The only fact for "scroll to" would be that it's loaded in the adapter.
3. As the adapter is always null with the current implementation (when coming back from the first search window), the "scroll to" is replaced with the startContextChatWindowForMessage. This could be changed again when adapter is not null anymore after coming back from the other screen...
startContextChatWindowForMessage
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Opening it when adapter was null is a bit hacky but it works (better would be to make sure adapter is not null of course)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
For v21.0.0, the following crash was reported:
Exception java.lang.NullPointerException: null cannot be cast to non-null type com.nextcloud.talk.chat.data.model.ChatMessage
at com.nextcloud.talk.chat.ChatActivity.onLoadMore (ChatActivity.kt:3107)
at com.stfalcon.chatkit.messages.MessagesListAdapter.onLoadMore (MessagesListAdapter.java:148)
at com.stfalcon.chatkit.messages.RecyclerScrollMoreListener.onScrolled (RecyclerScrollMoreListener.java:82)
at androidx.recyclerview.widget.RecyclerView.dispatchOnScrolled (RecyclerView.java:5688)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3 (RecyclerView.java:4741)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout (RecyclerView.java:4367)
at androidx.recyclerview.widget.RecyclerView.onLayout (RecyclerView.java:4919)
This is now improved:
- lastOrNull prevents exceptions if no matching item is found
- as? is a safe cast that returns null if the cast fails
Whole expression becomes null-safe, and id will be null if anything along the way doesn't match. Only when not null, onLoadMore continues.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
to be discussed: does it make sense to show a dialog instead? At least when it's created via 1:1 conversation
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>