diff --git a/app/build.gradle b/app/build.gradle index 6349d866..42faafdd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,12 +10,12 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 30 + compileSdkVersion 31 defaultConfig { applicationId "com.simplemobiletools.contacts.pro" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 31 versionCode 92 versionName "6.18.0" setProperty("archivesBaseName", "contacts") @@ -63,7 +63,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:99ed70cdbf' + implementation 'com.github.SimpleMobileTools:Simple-Commons:b264da6cff' implementation 'com.googlecode.ez-vcard:ez-vcard:0.11.3' implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt index ac391458..e43b179a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt @@ -204,7 +204,7 @@ class EditContactActivity : ContactActivity() { updateContactPhoto(contact!!.photoUri, contact_photo, contact_photo_bottom_shadow, contact!!.photo) } - val textColor = config.textColor + val textColor = getProperTextColor() arrayOf( contact_name_image, contact_numbers_image, contact_emails_image, contact_addresses_image, contact_ims_image, contact_events_image, contact_notes_image, contact_ringtone_image, contact_organization_image, contact_websites_image, contact_groups_image, contact_source_image @@ -212,12 +212,12 @@ class EditContactActivity : ContactActivity() { it.applyColorFilter(textColor) } - val adjustedPrimaryColor = getAdjustedPrimaryColor() + val properPrimaryColor = getProperPrimaryColor() arrayOf( contact_numbers_add_new, contact_emails_add_new, contact_addresses_add_new, contact_ims_add_new, contact_events_add_new, contact_websites_add_new, contact_groups_add_new ).forEach { - it.applyColorFilter(adjustedPrimaryColor) + it.applyColorFilter(properPrimaryColor) } arrayOf( @@ -250,8 +250,8 @@ class EditContactActivity : ContactActivity() { } updateTextColors(contact_scrollview) - numberViewToColor?.setTextColor(adjustedPrimaryColor) - emailViewToColor?.setTextColor(adjustedPrimaryColor) + numberViewToColor?.setTextColor(properPrimaryColor) + emailViewToColor?.setTextColor(properPrimaryColor) wasActivityInitialized = true contact_toolbar.menu.apply { @@ -602,8 +602,8 @@ class EditContactActivity : ContactActivity() { contact_event_remove.apply { beVisible() - applyColorFilter(getAdjustedPrimaryColor()) - background.applyColorFilter(config.textColor) + applyColorFilter(getProperPrimaryColor()) + background.applyColorFilter(getProperTextColor()) setOnClickListener { resetContactEvent(contactEvent, this) } @@ -625,7 +625,7 @@ class EditContactActivity : ContactActivity() { (groupHolder as ViewGroup).apply { contact_group.apply { text = group.title - setTextColor(config.textColor) + setTextColor(getProperTextColor()) tag = group.id alpha = 1f } @@ -636,8 +636,8 @@ class EditContactActivity : ContactActivity() { contact_group_remove.apply { beVisible() - applyColorFilter(getAdjustedPrimaryColor()) - background.applyColorFilter(config.textColor) + applyColorFilter(getProperPrimaryColor()) + background.applyColorFilter(getProperTextColor()) setOnClickListener { removeGroup(group.id!!) } @@ -650,7 +650,7 @@ class EditContactActivity : ContactActivity() { contact_group.apply { alpha = 0.5f text = getString(R.string.no_groups) - setTextColor(config.textColor) + setTextColor(getProperTextColor()) } contact_groups_holder.addView(this) @@ -790,8 +790,8 @@ class EditContactActivity : ContactActivity() { } eventHolder.contact_event_remove.apply { - applyColorFilter(getAdjustedPrimaryColor()) - background.applyColorFilter(config.textColor) + applyColorFilter(getProperPrimaryColor()) + background.applyColorFilter(getProperTextColor()) setOnClickListener { resetContactEvent(eventField, this@apply) } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/GroupContactsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/GroupContactsActivity.kt index 8b023941..0b332179 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/GroupContactsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/GroupContactsActivity.kt @@ -65,10 +65,10 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh fabClicked() } - val adjustedPrimaryColor = getAdjustedPrimaryColor() - group_contacts_fastscroller?.updateColors(adjustedPrimaryColor) + val properPrimaryColor = getProperPrimaryColor() + group_contacts_fastscroller?.updateColors(properPrimaryColor) group_contacts_placeholder_2.underlineText() - group_contacts_placeholder_2.setTextColor(adjustedPrimaryColor) + group_contacts_placeholder_2.setTextColor(properPrimaryColor) } override fun onResume() { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/InsertOrEditContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/InsertOrEditContactActivity.kt index fc7e332c..88f091fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/InsertOrEditContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/InsertOrEditContactActivity.kt @@ -25,7 +25,10 @@ import com.simplemobiletools.contacts.pro.dialogs.FilterContactSourcesDialog import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.getContactPublicUri import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment -import com.simplemobiletools.contacts.pro.helpers.* +import com.simplemobiletools.contacts.pro.helpers.ADD_NEW_CONTACT_NUMBER +import com.simplemobiletools.contacts.pro.helpers.ContactsHelper +import com.simplemobiletools.contacts.pro.helpers.KEY_EMAIL +import com.simplemobiletools.contacts.pro.helpers.KEY_NAME import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener import com.simplemobiletools.contacts.pro.models.Contact import kotlinx.android.synthetic.main.activity_insert_edit_contact.* @@ -134,7 +137,7 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener { insert_or_edit_tabs_holder.onTabSelectionChanged( tabUnselectedAction = { - it.icon?.applyColorFilter(config.textColor) + it.icon?.applyColorFilter(getProperTextColor()) }, tabSelectedAction = { if (isSearchOpen) { @@ -142,7 +145,7 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener { searchMenuItem?.collapseActionView() } viewpager.currentItem = it.position - it.icon?.applyColorFilter(getAdjustedPrimaryColor()) + it.icon?.applyColorFilter(getProperPrimaryColor()) } ) @@ -159,9 +162,9 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener { insert_or_edit_tabs_holder.beVisibleIf(skippedTabs == 0) - select_contact_label?.setTextColor(getAdjustedPrimaryColor()) - new_contact_tmb?.setImageDrawable(resources.getColoredDrawableWithColor(R.drawable.ic_add_person_vector, config.textColor)) - new_contact_name.setTextColor(config.textColor) + select_contact_label?.setTextColor(getProperPrimaryColor()) + new_contact_tmb?.setImageDrawable(resources.getColoredDrawableWithColor(R.drawable.ic_add_person_vector, getProperTextColor())) + new_contact_name.setTextColor(getProperTextColor()) new_contact_holder?.setOnClickListener { createNewContact() } @@ -218,8 +221,8 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener { private fun setupTabColors() { insert_or_edit_tabs_holder.apply { - background = ColorDrawable(config.backgroundColor) - setSelectedTabIndicatorColor(getAdjustedPrimaryColor()) + background = ColorDrawable(getProperBackgroundColor()) + setSelectedTabIndicatorColor(getProperPrimaryColor()) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt index 86533743..8b27cd8f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt @@ -35,7 +35,10 @@ import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.getTempFile import com.simplemobiletools.contacts.pro.extensions.handleGenericContactClick import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment -import com.simplemobiletools.contacts.pro.helpers.* +import com.simplemobiletools.contacts.pro.helpers.ALL_TABS_MASK +import com.simplemobiletools.contacts.pro.helpers.ContactsHelper +import com.simplemobiletools.contacts.pro.helpers.VcfExporter +import com.simplemobiletools.contacts.pro.helpers.tabsList import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener import com.simplemobiletools.contacts.pro.models.Contact import kotlinx.android.synthetic.main.activity_main.* @@ -110,11 +113,11 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { } } - val adjustedPrimaryColor = getAdjustedPrimaryColor() - main_tabs_holder.background = ColorDrawable(config.backgroundColor) - main_tabs_holder.setSelectedTabIndicatorColor(adjustedPrimaryColor) + val properPrimaryColor = getProperPrimaryColor() + main_tabs_holder.background = ColorDrawable(getProperBackgroundColor()) + main_tabs_holder.setSelectedTabIndicatorColor(properPrimaryColor) getAllFragments().forEach { - it?.setupColors(config.textColor, adjustedPrimaryColor) + it?.setupColors(getProperTextColor(), properPrimaryColor) } updateTabColors() @@ -140,10 +143,10 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { } } - val dialpadIcon = resources.getColoredDrawableWithColor(R.drawable.ic_dialpad_vector, adjustedPrimaryColor.getContrastColor()) + val dialpadIcon = resources.getColoredDrawableWithColor(R.drawable.ic_dialpad_vector, properPrimaryColor.getContrastColor()) main_dialpad_button.apply { setImageDrawable(dialpadIcon) - background.applyColorFilter(adjustedPrimaryColor) + background.applyColorFilter(properPrimaryColor) beVisibleIf(config.showDialpadButton) } @@ -257,9 +260,9 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { private fun updateTabColors() { getInactiveTabIndexes(viewpager.currentItem).forEach { - main_tabs_holder.getTabAt(it)?.icon?.applyColorFilter(config.textColor) + main_tabs_holder.getTabAt(it)?.icon?.applyColorFilter(getProperTextColor()) } - main_tabs_holder.getTabAt(viewpager.currentItem)?.icon?.applyColorFilter(getAdjustedPrimaryColor()) + main_tabs_holder.getTabAt(viewpager.currentItem)?.icon?.applyColorFilter(getProperPrimaryColor()) } private fun getSearchString(): Int { @@ -322,13 +325,13 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { private fun setupTabColors() { val lastUsedPage = getDefaultTab() main_tabs_holder.apply { - background = ColorDrawable(config.backgroundColor) - setSelectedTabIndicatorColor(getAdjustedPrimaryColor()) + background = ColorDrawable(getProperBackgroundColor()) + setSelectedTabIndicatorColor(getProperPrimaryColor()) getTabAt(lastUsedPage)?.select() - getTabAt(lastUsedPage)?.icon?.applyColorFilter(getAdjustedPrimaryColor()) + getTabAt(lastUsedPage)?.icon?.applyColorFilter(getProperPrimaryColor()) getInactiveTabIndexes(lastUsedPage).forEach { - getTabAt(it)?.icon?.applyColorFilter(config.textColor) + getTabAt(it)?.icon?.applyColorFilter(getProperTextColor()) } } } @@ -362,7 +365,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { main_tabs_holder.onTabSelectionChanged( tabUnselectedAction = { - it.icon?.applyColorFilter(config.textColor) + it.icon?.applyColorFilter(getProperTextColor()) }, tabSelectedAction = { if (isSearchOpen) { @@ -370,7 +373,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { searchMenuItem?.collapseActionView() } viewpager.currentItem = it.position - it.icon?.applyColorFilter(getAdjustedPrimaryColor()) + it.icon?.applyColorFilter(getProperPrimaryColor()) } ) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/SettingsActivity.kt index 8e2dd378..17f22837 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/SettingsActivity.kt @@ -44,7 +44,7 @@ class SettingsActivity : SimpleActivity() { invalidateOptionsMenu() arrayOf(settings_color_customization_label, settings_general_settings_label, settings_main_screen_label, settings_list_view_label).forEach { - it.setTextColor(getAdjustedPrimaryColor()) + it.setTextColor(getProperPrimaryColor()) } arrayOf( @@ -53,7 +53,7 @@ class SettingsActivity : SimpleActivity() { settings_main_screen_holder, settings_list_view_holder ).forEach { - it.background.applyColorFilter(baseConfig.backgroundColor.getContrastColor()) + it.background.applyColorFilter(getProperBackgroundColor().getContrastColor()) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/SimpleActivity.kt index 7d48248f..aeceec80 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/SimpleActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/SimpleActivity.kt @@ -6,9 +6,9 @@ import android.graphics.drawable.Drawable import android.net.Uri import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.helpers.KEY_PHONE import com.simplemobiletools.contacts.pro.R -import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.helpers.KEY_MAILTO import com.simplemobiletools.contacts.pro.helpers.LOCATION_CONTACTS_TAB import com.simplemobiletools.contacts.pro.helpers.LOCATION_FAVORITES_TAB @@ -70,7 +70,7 @@ open class SimpleActivity : BaseSimpleActivity() { else -> R.drawable.ic_people_vector } - return resources.getColoredDrawableWithColor(drawableId, config.textColor) + return resources.getColoredDrawableWithColor(drawableId, getProperTextColor()) } protected fun getTabContentDescription(position: Int): String { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt index be5aa9ab..5e2ca888 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt @@ -216,7 +216,7 @@ class ViewContactActivity : ContactActivity() { } } - val textColor = config.textColor + val textColor = getProperTextColor() arrayOf( contact_name_image, contact_numbers_image, contact_emails_image, contact_addresses_image, contact_events_image, contact_source_image, contact_notes_image, contact_ringtone_image, contact_organization_image, contact_websites_image, contact_groups_image diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ContactsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ContactsAdapter.kt index 78a88acd..e918627a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ContactsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ContactsAdapter.kt @@ -36,7 +36,6 @@ import com.simplemobiletools.contacts.pro.helpers.* import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener import com.simplemobiletools.contacts.pro.interfaces.RemoveFromGroupListener import com.simplemobiletools.contacts.pro.models.Contact -import java.util.* class ContactsAdapter( activity: SimpleActivity, var contactItems: ArrayList, private val refreshListener: RefreshContactsListener?, @@ -342,9 +341,9 @@ class ContactsAdapter( val fullName = contact.getNameToDisplay() findViewById(R.id.item_contact_name).text = if (textToHighlight.isEmpty()) fullName else { if (fullName.contains(textToHighlight, true)) { - fullName.highlightTextPart(textToHighlight, adjustedPrimaryColor) + fullName.highlightTextPart(textToHighlight, properPrimaryColor) } else { - fullName.highlightTextFromNumbers(textToHighlight, adjustedPrimaryColor) + fullName.highlightTextFromNumbers(textToHighlight, properPrimaryColor) } } @@ -362,7 +361,7 @@ class ContactsAdapter( val numberText = phoneNumberToUse?.value ?: "" findViewById(R.id.item_contact_number).apply { - text = if (textToHighlight.isEmpty()) numberText else numberText.highlightTextPart(textToHighlight, adjustedPrimaryColor, false, true) + text = if (textToHighlight.isEmpty()) numberText else numberText.highlightTextPart(textToHighlight, properPrimaryColor, false, true) setTextColor(textColor) setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize) } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/FilterContactSourcesAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/FilterContactSourcesAdapter.kt index 44332eba..39baf6e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/FilterContactSourcesAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/FilterContactSourcesAdapter.kt @@ -3,17 +3,21 @@ package com.simplemobiletools.contacts.pro.adapters import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView -import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor +import com.simplemobiletools.commons.extensions.getProperBackgroundColor +import com.simplemobiletools.commons.extensions.getProperPrimaryColor +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.activities.SimpleActivity -import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.helpers.SMT_PRIVATE import com.simplemobiletools.contacts.pro.models.ContactSource import kotlinx.android.synthetic.main.item_filter_contact_source.view.* -import java.util.* -class FilterContactSourcesAdapter(val activity: SimpleActivity, private val contactSources: List, private val displayContactSources: ArrayList) : - RecyclerView.Adapter() { +class FilterContactSourcesAdapter( + val activity: SimpleActivity, + private val contactSources: List, + private val displayContactSources: ArrayList +) : + RecyclerView.Adapter() { private val selectedKeys = HashSet() init { @@ -57,7 +61,7 @@ class FilterContactSourcesAdapter(val activity: SimpleActivity, private val cont val isSelected = selectedKeys.contains(contactSource.hashCode()) itemView.apply { filter_contact_source_checkbox.isChecked = isSelected - filter_contact_source_checkbox.setColors(activity.config.textColor, activity.getAdjustedPrimaryColor(), activity.config.backgroundColor) + filter_contact_source_checkbox.setColors(activity.getProperTextColor(), activity.getProperPrimaryColor(), activity.getProperBackgroundColor()) filter_contact_source_checkbox.text = contactSource.publicName filter_contact_source_holder.setOnClickListener { viewClicked(!isSelected, contactSource) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/GroupsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/GroupsAdapter.kt index a8335bdb..75dba883 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/GroupsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/GroupsAdapter.kt @@ -158,7 +158,7 @@ class GroupsAdapter( val groupTitle = if (textToHighlight.isEmpty()) { titleWithCnt } else { - titleWithCnt.highlightTextPart(textToHighlight, adjustedPrimaryColor) + titleWithCnt.highlightTextPart(textToHighlight, properPrimaryColor) } group_name.apply { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/SelectContactsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/SelectContactsAdapter.kt index 64caebb5..b0420660 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/SelectContactsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/SelectContactsAdapter.kt @@ -18,7 +18,6 @@ import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.models.Contact import kotlinx.android.synthetic.main.item_add_favorite_with_number.view.* -import java.util.* class SelectContactsAdapter( val activity: SimpleActivity, var contacts: ArrayList, private val selectedContacts: ArrayList, private val allowPickMultiple: Boolean, @@ -28,7 +27,7 @@ class SelectContactsAdapter( private val itemViews = SparseArray() private val selectedPositions = HashSet() private val config = activity.config - private val adjustedPrimaryColor = activity.getAdjustedPrimaryColor() + private val adjustedPrimaryColor = activity.getProperPrimaryColor() private val fontSize = activity.getTextSize() private val showContactThumbnails = config.showContactThumbnails @@ -101,8 +100,8 @@ class SelectContactsAdapter( fun bindView(contact: Contact): View { itemView.apply { contact_checkbox.beVisibleIf(allowPickMultiple) - contact_checkbox.setColors(config.textColor, context.getAdjustedPrimaryColor(), config.backgroundColor) - val textColor = config.textColor + contact_checkbox.setColors(context.getProperTextColor(), context.getProperPrimaryColor(), context.getProperBackgroundColor()) + val textColor = context.getProperTextColor() val fullName = contact.getNameToDisplay() contact_name.text = if (textToHighlight.isEmpty()) fullName else { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ViewPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ViewPagerAdapter.kt index f88c1566..592de5a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ViewPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ViewPagerAdapter.kt @@ -3,13 +3,13 @@ package com.simplemobiletools.contacts.pro.adapters import android.view.View import android.view.ViewGroup import androidx.viewpager.widget.PagerAdapter -import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor +import com.simplemobiletools.commons.extensions.getProperPrimaryColor +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.helpers.TAB_CONTACTS import com.simplemobiletools.commons.helpers.TAB_FAVORITES import com.simplemobiletools.commons.helpers.TAB_GROUPS import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.activities.SimpleActivity -import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment class ViewPagerAdapter(val activity: SimpleActivity, val currTabsList: ArrayList, val showTabs: Int) : PagerAdapter() { @@ -21,7 +21,7 @@ class ViewPagerAdapter(val activity: SimpleActivity, val currTabsList: ArrayList (view as MyViewPagerFragment).apply { setupFragment(activity) - setupColors(activity.config.textColor, activity.getAdjustedPrimaryColor()) + setupColors(activity.getProperTextColor(), activity.getProperPrimaryColor()) } return view diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectContactsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectContactsDialog.kt index 914d6175..9e31175d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectContactsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectContactsDialog.kt @@ -7,12 +7,10 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.adapters.SelectContactsAdapter -import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.getVisibleContactSources import com.simplemobiletools.contacts.pro.models.Contact import kotlinx.android.synthetic.main.layout_select_contact.view.* import java.util.* -import kotlin.collections.ArrayList class SelectContactsDialog( val activity: SimpleActivity, initialContacts: ArrayList, val allowSelectMultiple: Boolean, val showOnlyContactsWithNumber: Boolean, @@ -79,9 +77,9 @@ class SelectContactsDialog( } private fun setupFastscroller(allContacts: ArrayList) { - val adjustedPrimaryColor = activity.getAdjustedPrimaryColor() + val adjustedPrimaryColor = activity.getProperPrimaryColor() view.apply { - letter_fastscroller?.textColor = context.config.textColor.getColorStateList() + letter_fastscroller?.textColor = context.getProperTextColor().getColorStateList() letter_fastscroller?.pressedTextColor = adjustedPrimaryColor letter_fastscroller_thumb?.fontSize = context.getTextSize() letter_fastscroller_thumb?.textColor = adjustedPrimaryColor.getContrastColor() diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectGroupsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectGroupsDialog.kt index 0367c611..1ca5ff9f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectGroupsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectGroupsDialog.kt @@ -2,7 +2,9 @@ package com.simplemobiletools.contacts.pro.dialogs import android.view.ViewGroup import androidx.appcompat.app.AlertDialog -import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor +import com.simplemobiletools.commons.extensions.getProperBackgroundColor +import com.simplemobiletools.commons.extensions.getProperPrimaryColor +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.views.MyAppCompatCheckbox import com.simplemobiletools.contacts.pro.R @@ -13,7 +15,6 @@ import com.simplemobiletools.contacts.pro.models.Group import kotlinx.android.synthetic.main.dialog_select_groups.view.* import kotlinx.android.synthetic.main.item_checkbox.view.* import kotlinx.android.synthetic.main.item_textview.view.* -import java.util.* class SelectGroupsDialog(val activity: SimpleActivity, val selectedGroups: ArrayList, val callback: (newGroups: ArrayList) -> Unit) { private val view = activity.layoutInflater.inflate(R.layout.dialog_select_groups, null) as ViewGroup @@ -39,11 +40,11 @@ class SelectGroupsDialog(val activity: SimpleActivity, val selectedGroups: Array addCreateNewGroupButton() dialog = AlertDialog.Builder(activity) - .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } - .setNegativeButton(R.string.cancel, null) - .create().apply { - activity.setupDialogStuff(view, this) - } + .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } + .setNegativeButton(R.string.cancel, null) + .create().apply { + activity.setupDialogStuff(view, this) + } } private fun addGroupCheckbox(group: Group) { @@ -57,7 +58,7 @@ class SelectGroupsDialog(val activity: SimpleActivity, val selectedGroups: Array isChecked = selectedGroups.contains(group) text = group.title tag = group.id - setColors(config.textColor, activity.getAdjustedPrimaryColor(), config.backgroundColor) + setColors(activity.getProperTextColor(), activity.getProperPrimaryColor(), activity.getProperBackgroundColor()) } view.dialog_groups_holder.addView(this) } @@ -68,7 +69,7 @@ class SelectGroupsDialog(val activity: SimpleActivity, val selectedGroups: Array activity.layoutInflater.inflate(R.layout.item_textview, null, false).item_textview.apply { text = newGroup.title tag = newGroup.id - setTextColor(config.textColor) + setTextColor(activity.getProperTextColor()) view.dialog_groups_holder.addView(this) setOnClickListener { CreateNewGroupDialog(activity) {