mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-03-17 19:50:45 +01:00
update primary color at Search selection if it changes
This commit is contained in:
parent
d9133ca5b6
commit
cf7bc3b13c
@ -45,7 +45,7 @@ ext {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.19.3'
|
||||
implementation 'com.simplemobiletools:commons:3.19.4'
|
||||
implementation 'joda-time:joda-time:2.9.9'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
|
||||
|
@ -12,10 +12,7 @@ import com.bumptech.glide.signature.ObjectKey
|
||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
||||
import com.simplemobiletools.commons.extensions.highlightTextPart
|
||||
import com.simplemobiletools.commons.extensions.isActivityDestroyed
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.views.FastScroller
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
@ -38,6 +35,8 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
||||
private lateinit var contactDrawable: Drawable
|
||||
private var config = activity.config
|
||||
private var textToHighlight = ""
|
||||
|
||||
var adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
|
||||
var startNameWithSurname: Boolean
|
||||
var showContactThumbnails: Boolean
|
||||
var showPhoneNumbers: Boolean
|
||||
@ -250,14 +249,14 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
||||
private fun setupView(view: View, contact: Contact) {
|
||||
view.apply {
|
||||
val fullName = contact.getFullName()
|
||||
val nameText = if (textToHighlight.isEmpty()) fullName else fullName.highlightTextPart(textToHighlight, primaryColor)
|
||||
val nameText = if (textToHighlight.isEmpty()) fullName else fullName.highlightTextPart(textToHighlight, adjustedPrimaryColor)
|
||||
contact_name.text = nameText
|
||||
contact_name.setTextColor(textColor)
|
||||
contact_name.setPadding(if (showContactThumbnails) smallPadding else bigPadding, smallPadding, smallPadding, 0)
|
||||
|
||||
if (contact_number != null) {
|
||||
val numberText = contact.phoneNumbers.firstOrNull()?.value ?: ""
|
||||
contact_number.text = if (textToHighlight.isEmpty()) numberText else numberText.highlightTextPart(textToHighlight, primaryColor)
|
||||
contact_number.text = if (textToHighlight.isEmpty()) numberText else numberText.highlightTextPart(textToHighlight, adjustedPrimaryColor)
|
||||
contact_number.setTextColor(textColor)
|
||||
contact_number.setPadding(if (showContactThumbnails) smallPadding else bigPadding, 0, smallPadding, 0)
|
||||
}
|
||||
|
@ -74,6 +74,9 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
fun primaryColorChanged() {
|
||||
fragment_fastscroller.updatePrimaryColor()
|
||||
fragment_fastscroller.updateBubblePrimaryColor()
|
||||
(fragment_list.adapter as? ContactsAdapter)?.apply {
|
||||
adjustedPrimaryColor = context.getAdjustedPrimaryColor()
|
||||
}
|
||||
}
|
||||
|
||||
fun startNameWithSurnameChanged(startNameWithSurname: Boolean) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user