WIP filter conversations feature, last minute ui changes

Signed-off-by: Julius Linus julius.linus@nextcloud.com

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
rapterjet2004 2023-06-13 16:47:27 -05:00 committed by Andy Scherzinger
parent b4719bcad3
commit cc0fd41c90
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
2 changed files with 24 additions and 14 deletions

View File

@ -34,6 +34,7 @@ import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.net.Uri
@ -765,6 +766,8 @@ class ConversationsListActivity :
}
}
updateFilterConversationButtonColor()
binding.filterConversationsButton.setOnClickListener {
val newFragment: DialogFragment = FilterConversationFragment.newInstance(
adapter!!,
@ -784,6 +787,17 @@ class ConversationsListActivity :
binding?.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) }
}
fun updateFilterConversationButtonColor() {
val colorInt: Int = if (filterState[NONE]!!) {
context.getColor(R.color.grey_200)
} else {
context.getColor(R.color.colorPrimary)
}
val csl = ColorStateList.valueOf(colorInt)
binding.filterConversationsButton.iconTint = csl
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun checkToShowUnreadBubble() {
try {

View File

@ -5,6 +5,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment
import autodagger.AutoInjector
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -105,29 +106,22 @@ class FilterConversationFragment(
}
private fun changeMentionFilter() {
if (filterState[MENTION]!!) {
binding.mentionedFilterButton.setBackgroundColor(resources.getColor(R.color.colorPrimary))
} else
binding.mentionedFilterButton.setBackgroundColor(resources.getColor(R.color.grey_200))
val colorInt = if (filterState[MENTION]!!) R.color.colorPrimary else R.color.grey_200
binding.mentionedFilterButton.setBackgroundColor(ContextCompat.getColor(requireContext(), colorInt))
}
private fun changeUnreadFilter() {
if (filterState[UNREAD]!!) {
binding.unreadFilterButton.setBackgroundColor(
resources.getColor(R.color.colorPrimary)
)
} else binding.unreadFilterButton.setBackgroundColor(resources.getColor(R.color.grey_200))
val colorInt = if (filterState[UNREAD]!!) R.color.colorPrimary else R.color.grey_200
binding.unreadFilterButton.setBackgroundColor(ContextCompat.getColor(requireContext(), colorInt))
}
private fun changeNoneFilter() {
if (filterState[NONE]!!) {
binding.noFilterButton.setBackgroundColor(resources.getColor(R.color.colorPrimary))
} else
binding.noFilterButton.setBackgroundColor(resources.getColor(R.color.grey_200))
val colorInt = if (filterState[NONE]!!) R.color.colorPrimary else R.color.grey_200
binding.noFilterButton.setBackgroundColor(ContextCompat.getColor(requireContext(), colorInt))
}
private fun processSubmit() {
var newItems: MutableList<AbstractFlexibleItem<*>> = ArrayList()
val newItems: MutableList<AbstractFlexibleItem<*>> = ArrayList()
if (filterState[NONE]!!) {
currentAdapter.updateDataSet(currentItems, true)
} else {
@ -145,6 +139,8 @@ class FilterConversationFragment(
filterState[MENTION]!!,
filterState[UNREAD]!!
)
conversationsList.updateFilterConversationButtonColor()
}
private fun filter(conversation: Conversation): Boolean {
var result = true