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.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.net.Uri import android.net.Uri
@ -765,6 +766,8 @@ class ConversationsListActivity :
} }
} }
updateFilterConversationButtonColor()
binding.filterConversationsButton.setOnClickListener { binding.filterConversationsButton.setOnClickListener {
val newFragment: DialogFragment = FilterConversationFragment.newInstance( val newFragment: DialogFragment = FilterConversationFragment.newInstance(
adapter!!, adapter!!,
@ -784,6 +787,17 @@ class ConversationsListActivity :
binding?.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) } 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") @Suppress("Detekt.TooGenericExceptionCaught")
private fun checkToShowUnreadBubble() { private fun checkToShowUnreadBubble() {
try { try {

View File

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