mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-23 13:40:43 +01:00
format code and suppress KtLint CheckResult rule
This commit is contained in:
parent
ce248a7fc0
commit
305ec470c8
@ -198,7 +198,7 @@ class ConversationsListActivity :
|
|||||||
FilterConversationFragment.MENTION to false,
|
FilterConversationFragment.MENTION to false,
|
||||||
FilterConversationFragment.UNREAD to false
|
FilterConversationFragment.UNREAD to false
|
||||||
)
|
)
|
||||||
val searchBehaviorSubject = BehaviorSubject.createDefault(false)
|
val searchBehaviorSubject = BehaviorSubject.createDefault(false)
|
||||||
|
|
||||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||||
override fun handleOnBackPressed() {
|
override fun handleOnBackPressed() {
|
||||||
@ -222,7 +222,6 @@ class ConversationsListActivity :
|
|||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onPostCreate(savedInstanceState: Bundle?) {
|
override fun onPostCreate(savedInstanceState: Bundle?) {
|
||||||
super.onPostCreate(savedInstanceState)
|
super.onPostCreate(savedInstanceState)
|
||||||
|
|
||||||
@ -277,6 +276,7 @@ class ConversationsListActivity :
|
|||||||
|
|
||||||
showSearchOrToolbar()
|
showSearchOrToolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun filterConversation() {
|
fun filterConversation() {
|
||||||
val accountId = UserIdUtils.getIdForUser(userManager.currentUser.blockingGet())
|
val accountId = UserIdUtils.getIdForUser(userManager.currentUser.blockingGet())
|
||||||
filterState[FilterConversationFragment.UNREAD] = (
|
filterState[FilterConversationFragment.UNREAD] = (
|
||||||
@ -329,6 +329,7 @@ class ConversationsListActivity :
|
|||||||
) &&
|
) &&
|
||||||
(conversation.unreadMessages > 0)
|
(conversation.unreadMessages > 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
FilterConversationFragment.UNREAD -> result = result && (conversation.unreadMessages > 0)
|
FilterConversationFragment.UNREAD -> result = result && (conversation.unreadMessages > 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -513,7 +514,7 @@ class ConversationsListActivity :
|
|||||||
// cancel any pending searches
|
// cancel any pending searches
|
||||||
searchHelper!!.cancelSearch()
|
searchHelper!!.cancelSearch()
|
||||||
binding?.swipeRefreshLayoutView?.isRefreshing = false
|
binding?.swipeRefreshLayoutView?.isRefreshing = false
|
||||||
searchBehaviorSubject.onNext(false )
|
searchBehaviorSubject.onNext(false)
|
||||||
}
|
}
|
||||||
binding?.swipeRefreshLayoutView?.isEnabled = true
|
binding?.swipeRefreshLayoutView?.isEnabled = true
|
||||||
searchView!!.onActionViewCollapsed()
|
searchView!!.onActionViewCollapsed()
|
||||||
@ -605,6 +606,7 @@ class ConversationsListActivity :
|
|||||||
fun showSnackbar(text: String) {
|
fun showSnackbar(text: String) {
|
||||||
Snackbar.make(binding.root, text, Snackbar.LENGTH_LONG).show()
|
Snackbar.make(binding.root, text, Snackbar.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fetchRooms() {
|
fun fetchRooms() {
|
||||||
val includeStatus = isUserStatusAvailable(userManager.currentUser.blockingGet())
|
val includeStatus = isUserStatusAvailable(userManager.currentUser.blockingGet())
|
||||||
|
|
||||||
@ -649,8 +651,7 @@ class ConversationsListActivity :
|
|||||||
if (!filterState.containsValue(true)) filterableConversationItems = conversationItems
|
if (!filterState.containsValue(true)) filterableConversationItems = conversationItems
|
||||||
filterConversation()
|
filterConversation()
|
||||||
adapter!!.updateDataSet(filterableConversationItems, false)
|
adapter!!.updateDataSet(filterableConversationItems, false)
|
||||||
Handler().postDelayed({ checkToShowUnreadBubble() }, UNREAD_BUBBLE_DELAY
|
Handler().postDelayed({ checkToShowUnreadBubble() }, UNREAD_BUBBLE_DELAY.toLong())
|
||||||
.toLong())
|
|
||||||
fetchOpenConversations(apiVersion)
|
fetchOpenConversations(apiVersion)
|
||||||
binding?.swipeRefreshLayoutView?.isRefreshing = false
|
binding?.swipeRefreshLayoutView?.isRefreshing = false
|
||||||
}, { throwable: Throwable ->
|
}, { throwable: Throwable ->
|
||||||
@ -826,9 +827,9 @@ class ConversationsListActivity :
|
|||||||
super.onScrollStateChanged(recyclerView, newState)
|
super.onScrollStateChanged(recyclerView, newState)
|
||||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||||
val isSearchActive = searchBehaviorSubject.value
|
val isSearchActive = searchBehaviorSubject.value
|
||||||
if(!isSearchActive!!){
|
if (!isSearchActive!!) {
|
||||||
checkToShowUnreadBubble()
|
checkToShowUnreadBubble()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -877,7 +878,7 @@ class ConversationsListActivity :
|
|||||||
binding?.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) }
|
binding?.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
private fun checkToShowUnreadBubble() {
|
private fun checkToShowUnreadBubble() {
|
||||||
searchBehaviorSubject.subscribe { value ->
|
searchBehaviorSubject.subscribe { value ->
|
||||||
@ -904,12 +905,13 @@ class ConversationsListActivity :
|
|||||||
Log.d(
|
Log.d(
|
||||||
TAG,
|
TAG,
|
||||||
"A NPE was caught when trying to show the unread popup bubble. This might happen when the " +
|
"A NPE was caught when trying to show the unread popup bubble. This might happen when the " +
|
||||||
"user already left the conversations-list screen so the popup bubble is not available anymore.",
|
"user already left the conversations-list screen so the popup bubble is not available " +
|
||||||
|
"anymore.",
|
||||||
e
|
e
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasUnreadItems(conversation: Conversation) =
|
private fun hasUnreadItems(conversation: Conversation) =
|
||||||
@ -923,7 +925,6 @@ class ConversationsListActivity :
|
|||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun dispose(disposable: Disposable?) {
|
private fun dispose(disposable: Disposable?) {
|
||||||
if (disposable != null && !disposable.isDisposed) {
|
if (disposable != null && !disposable.isDisposed) {
|
||||||
disposable.dispose()
|
disposable.dispose()
|
||||||
|
Loading…
Reference in New Issue
Block a user