From 270d76554f0198c1e2ba77fb61132a55c2852750 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 9 Sep 2024 15:43:57 +0200 Subject: [PATCH 1/4] fix flickering of unread mention bubble bug was introduced with https://github.com/nextcloud/talk-android/pull/3417 Signed-off-by: Marcel Hibbe --- .../ConversationsListActivity.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt index 9b9d74f54..13457b34a 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt @@ -1009,13 +1009,13 @@ class ConversationsListActivity : newFragment.show(supportFragmentManager, FilterConversationFragment.TAG) } - binding.newMentionPopupBubble?.hide() - binding.newMentionPopupBubble?.setPopupBubbleListener { - binding.recyclerView?.smoothScrollToPosition( + binding.newMentionPopupBubble.hide() + binding.newMentionPopupBubble.setPopupBubbleListener { + binding.recyclerView.smoothScrollToPosition( nextUnreadConversationScrollPosition ) } - binding.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) } + binding.newMentionPopupBubble.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) } } private fun hideLogoForBrandedClients() { @@ -1039,14 +1039,14 @@ class ConversationsListActivity : val position = adapter!!.getGlobalPositionOf(flexItem) if (hasUnreadItems(conversation) && position > lastVisibleItem) { nextUnreadConversationScrollPosition = position - if (!binding.newMentionPopupBubble?.isShown!!) { - binding.newMentionPopupBubble?.show() + if (!binding.newMentionPopupBubble.isShown) { + binding.newMentionPopupBubble.show() } return@subscribe } - nextUnreadConversationScrollPosition = 0 - binding.newMentionPopupBubble?.hide() } + nextUnreadConversationScrollPosition = 0 + binding.newMentionPopupBubble.hide() } catch (e: NullPointerException) { Log.d( TAG, From bef414fc10e26bda7df171766e6bc1dd2c143f95 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 9 Sep 2024 15:55:23 +0200 Subject: [PATCH 2/4] fix logic to show UnifiedSearch results when federation capability exists Signed-off-by: Marcel Hibbe --- app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt b/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt index 69d34c497..63e55c08d 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt @@ -161,7 +161,7 @@ object CapabilitiesUtil { } fun isUnifiedSearchAvailable(spreedCapabilities: SpreedCapability): Boolean { - if (hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.FEDERATION_V1)) { + if (!hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.FEDERATION_V1)) { return false } return hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.UNIFIED_SEARCH) From 4209bfa2b4a241159dd0e6a0747ad1c51de5bc32 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 9 Sep 2024 16:04:08 +0200 Subject: [PATCH 3/4] fix to set searchBehaviorSubject regardless of searchHelper being not null same for swipeRefreshLayoutView?.isRefreshing If searchHelper would be null (= when UnifiedSearch is not available) then going back to conversations list view would not trigger to check to show for unread mentions bubble. This fix will make it independent from searchHelper. Signed-off-by: Marcel Hibbe --- .../talk/conversationlist/ConversationsListActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt index 13457b34a..14c0e6b5c 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt @@ -667,9 +667,9 @@ class ConversationsListActivity : if (searchHelper != null) { // cancel any pending searches searchHelper!!.cancelSearch() - binding.swipeRefreshLayoutView?.isRefreshing = false - searchBehaviorSubject.onNext(false) } + binding.swipeRefreshLayoutView?.isRefreshing = false + searchBehaviorSubject.onNext(false) binding.swipeRefreshLayoutView?.isEnabled = true searchView!!.onActionViewCollapsed() From 6ddf06e9fdda9d0a1f9bfd28665faf4f28843734 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 9 Sep 2024 16:29:52 +0200 Subject: [PATCH 4/4] improve to align unread conversation after tapping on unread mentions button ...instead to just show it on top Signed-off-by: Marcel Hibbe --- .../talk/conversationlist/ConversationsListActivity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt index 14c0e6b5c..1483815e4 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt @@ -1011,8 +1011,10 @@ class ConversationsListActivity : binding.newMentionPopupBubble.hide() binding.newMentionPopupBubble.setPopupBubbleListener { - binding.recyclerView.smoothScrollToPosition( - nextUnreadConversationScrollPosition + val layoutManager = binding.recyclerView.layoutManager as SmoothScrollLinearLayoutManager? + layoutManager?.scrollToPositionWithOffset( + nextUnreadConversationScrollPosition, + binding.recyclerView.height / 3 ) } binding.newMentionPopupBubble.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) }