mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Merge pull request #1616 from nextcloud/feature/noid/improveScrollToMention
scroll to first unread mention and place it to the top
This commit is contained in:
commit
2ce5c01c9e
@ -207,6 +207,8 @@ public class ConversationsListController extends BaseController implements Searc
|
|||||||
|
|
||||||
private boolean forwardMessage;
|
private boolean forwardMessage;
|
||||||
|
|
||||||
|
private int nextUnreadConversationScrollPosition = 0;
|
||||||
|
|
||||||
private SmoothScrollLinearLayoutManager layoutManager;
|
private SmoothScrollLinearLayoutManager layoutManager;
|
||||||
|
|
||||||
public ConversationsListController(Bundle bundle) {
|
public ConversationsListController(Bundle bundle) {
|
||||||
@ -619,7 +621,7 @@ public class ConversationsListController extends BaseController implements Searc
|
|||||||
newMentionPopupBubble.setPopupBubbleListener(new PopupBubble.PopupBubbleClickListener() {
|
newMentionPopupBubble.setPopupBubbleListener(new PopupBubble.PopupBubbleClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void bubbleClicked(Context context) {
|
public void bubbleClicked(Context context) {
|
||||||
recyclerView.smoothScrollToPosition(callItems.size());
|
recyclerView.smoothScrollToPosition(nextUnreadConversationScrollPosition);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -634,12 +636,14 @@ public class ConversationsListController extends BaseController implements Searc
|
|||||||
(conversationItem.unreadMessages > 0 &&
|
(conversationItem.unreadMessages > 0 &&
|
||||||
conversationItem.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL)) &&
|
conversationItem.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL)) &&
|
||||||
position > lastVisibleItem) {
|
position > lastVisibleItem) {
|
||||||
|
nextUnreadConversationScrollPosition = position;
|
||||||
if (!newMentionPopupBubble.isShown()) {
|
if (!newMentionPopupBubble.isShown()) {
|
||||||
newMentionPopupBubble.show();
|
newMentionPopupBubble.show();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nextUnreadConversationScrollPosition = 0;
|
||||||
newMentionPopupBubble.hide();
|
newMentionPopupBubble.hide();
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
Log.d(TAG, "A NPE was caught when trying to show the unread popup bubble. This might happen when the " +
|
Log.d(TAG, "A NPE was caught when trying to show the unread popup bubble. This might happen when the " +
|
||||||
|
Loading…
Reference in New Issue
Block a user