show future events in filters and hide them when filters are disabled

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2025-05-14 11:01:19 +02:00 committed by Marcel Hibbe
parent 8231e6b35c
commit 9474a02c3a
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
3 changed files with 18 additions and 3 deletions

View File

@ -572,6 +572,10 @@ class ConversationsListActivity :
AGE_THRESHOLD_FOR_EVENT_CONVERSATIONS
}
fun showOnlyNearFutureEvents() {
adapter?.updateDataSet(nearFutureEventConversationItems, false)
}
private fun addToNearFutureEventConversationItems(conversation: ConversationModel) {
val conversationItem = ConversationItem(conversation, currentUser!!, this, null, viewThemeUtils)
nearFutureEventConversationItems.add(conversationItem)

View File

@ -55,7 +55,7 @@ object Migrations {
}
}
val MIGRATION_13_14 = object:Migration(13,14) {
val MIGRATION_13_14 = object : Migration(13, 14) {
override fun migrate(db: SupportSQLiteDatabase) {
Log.i("Migrations", "Migrating 13 to 14")
addObjectId(db)
@ -272,9 +272,7 @@ object Migrations {
}
}
fun addObjectId(db: SupportSQLiteDatabase) {
try {
db.execSQL(
"ALTER TABLE Conversations " +

View File

@ -7,6 +7,7 @@
package com.nextcloud.talk.ui.dialog
import android.app.Dialog
import android.content.DialogInterface
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
@ -99,6 +100,10 @@ class FilterConversationFragment : DialogFragment() {
}
binding.buttonClose.setOnClickListener {
val noFiltersActive = !(filterState[MENTION] == true || filterState[UNREAD] == true || filterState[ARCHIVE] == true)
if (noFiltersActive) {
(requireActivity() as ConversationsListActivity).showOnlyNearFutureEvents()
}
dismiss()
}
}
@ -130,6 +135,14 @@ class FilterConversationFragment : DialogFragment() {
(requireActivity() as ConversationsListActivity).filterConversation()
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
val noFiltersActive = !(filterState[MENTION] == true || filterState[UNREAD] == true || filterState[ARCHIVE] == true)
if (noFiltersActive) {
(requireActivity() as ConversationsListActivity).showOnlyNearFutureEvents()
}
}
companion object {
private const val FILTER_STATE_ARG = "FILTER_STATE_ARG"