fix: use reference config instead of baseConfig
This commit is contained in:
parent
8a84e84a8d
commit
25daf4de8f
21 changed files with 116 additions and 105 deletions
|
@ -10,9 +10,7 @@ import android.graphics.drawable.ColorDrawable
|
|||
import android.graphics.drawable.Drawable
|
||||
import android.media.RingtoneManager
|
||||
import android.net.Uri
|
||||
import android.provider.ContactsContract
|
||||
import android.provider.ContactsContract.CommonDataKinds.*
|
||||
import android.provider.ContactsContract.CommonDataKinds.Email
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.bumptech.glide.Glide
|
||||
|
@ -31,7 +29,7 @@ import com.simplemobiletools.commons.helpers.letterBackgroundColors
|
|||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.extensions.shareContacts
|
||||
import com.simplemobiletools.commons.models.contacts.*
|
||||
import com.simplemobiletools.commons.models.contacts.Contact
|
||||
|
||||
abstract class ContactActivity : SimpleActivity() {
|
||||
protected val PICK_RINGTONE_INTENT_ID = 1500
|
||||
|
@ -209,8 +207,8 @@ abstract class ContactActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
fun getEventTextId(type: Int) = when (type) {
|
||||
ContactsContract.CommonDataKinds.Event.TYPE_ANNIVERSARY -> R.string.anniversary
|
||||
ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY -> R.string.birthday
|
||||
Event.TYPE_ANNIVERSARY -> R.string.anniversary
|
||||
Event.TYPE_BIRTHDAY -> R.string.birthday
|
||||
else -> R.string.other
|
||||
}
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ class EditContactActivity : ContactActivity() {
|
|||
}
|
||||
|
||||
private fun setupFieldVisibility() {
|
||||
val showFields = baseConfig.showContactFields
|
||||
val showFields = config.showContactFields
|
||||
if (showFields and (SHOW_PREFIX_FIELD or SHOW_FIRST_NAME_FIELD or SHOW_MIDDLE_NAME_FIELD or SHOW_SURNAME_FIELD or SHOW_SUFFIX_FIELD) == 0) {
|
||||
contact_name_image.beInvisible()
|
||||
}
|
||||
|
@ -744,7 +744,7 @@ class EditContactActivity : ContactActivity() {
|
|||
}
|
||||
|
||||
private fun setupNewContact() {
|
||||
originalContactSource = if (hasContactPermissions()) baseConfig.lastUsedContactSource else SMT_PRIVATE
|
||||
originalContactSource = if (hasContactPermissions()) config.lastUsedContactSource else SMT_PRIVATE
|
||||
contact = getEmptyContact()
|
||||
getPublicContactSource(contact!!.source) {
|
||||
contact_source.text = if (it == "") getString(R.string.phone_storage) else it
|
||||
|
@ -1049,7 +1049,7 @@ class EditContactActivity : ContactActivity() {
|
|||
contact = contactValues
|
||||
|
||||
ensureBackgroundThread {
|
||||
baseConfig.lastUsedContactSource = contact!!.source
|
||||
config.lastUsedContactSource = contact!!.source
|
||||
when {
|
||||
contact!!.id == 0 -> insertNewContact(false)
|
||||
originalContactSource != contact!!.source -> insertNewContact(true)
|
||||
|
|
|
@ -13,17 +13,17 @@ import android.widget.TextView
|
|||
import androidx.viewpager.widget.ViewPager
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.contacts.*
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.adapters.ViewPagerAdapter
|
||||
import com.simplemobiletools.contacts.pro.dialogs.ChangeSortingDialog
|
||||
import com.simplemobiletools.contacts.pro.dialogs.FilterContactSourcesDialog
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment
|
||||
import com.simplemobiletools.contacts.pro.helpers.ADD_NEW_CONTACT_NUMBER
|
||||
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.commons.models.contacts.*
|
||||
import kotlinx.android.synthetic.main.activity_insert_edit_contact.*
|
||||
import kotlinx.android.synthetic.main.fragment_contacts.*
|
||||
import kotlinx.android.synthetic.main.fragment_favorites.*
|
||||
|
@ -159,7 +159,7 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener {
|
|||
private fun setupTabs() {
|
||||
insert_edit_tabs_holder.removeAllTabs()
|
||||
contactsFavoritesList.forEachIndexed { index, value ->
|
||||
if (baseConfig.showTabs and value != 0) {
|
||||
if (config.showTabs and value != 0) {
|
||||
insert_edit_tabs_holder.newTab().setCustomView(R.layout.bottom_tablayout_item).apply {
|
||||
customView?.findViewById<ImageView>(R.id.tab_item_icon)?.setImageDrawable(getTabIcon(index))
|
||||
customView?.findViewById<TextView>(R.id.tab_item_label)?.text = getTabLabel(index)
|
||||
|
@ -349,7 +349,7 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener {
|
|||
|
||||
private fun getTabsMask(): Int {
|
||||
var mask = TAB_CONTACTS
|
||||
if (baseConfig.showTabs and TAB_FAVORITES != 0) {
|
||||
if (config.showTabs and TAB_FAVORITES != 0) {
|
||||
mask += TAB_FAVORITES
|
||||
}
|
||||
return mask
|
||||
|
|
|
@ -18,7 +18,6 @@ import com.simplemobiletools.commons.databases.ContactsDatabase
|
|||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.FAQItem
|
||||
import com.simplemobiletools.commons.models.Release
|
||||
|
@ -30,6 +29,7 @@ import com.simplemobiletools.contacts.pro.dialogs.ChangeSortingDialog
|
|||
import com.simplemobiletools.contacts.pro.dialogs.ExportContactsDialog
|
||||
import com.simplemobiletools.contacts.pro.dialogs.FilterContactSourcesDialog
|
||||
import com.simplemobiletools.contacts.pro.dialogs.ImportContactsDialog
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import com.simplemobiletools.contacts.pro.extensions.handleGenericContactClick
|
||||
import com.simplemobiletools.contacts.pro.fragments.FavoritesFragment
|
||||
import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment
|
||||
|
@ -90,19 +90,19 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (storedShowPhoneNumbers != baseConfig.showPhoneNumbers) {
|
||||
if (storedShowPhoneNumbers != config.showPhoneNumbers) {
|
||||
System.exit(0)
|
||||
return
|
||||
}
|
||||
|
||||
if (storedShowTabs != baseConfig.showTabs) {
|
||||
baseConfig.lastUsedViewPagerPage = 0
|
||||
if (storedShowTabs != config.showTabs) {
|
||||
config.lastUsedViewPagerPage = 0
|
||||
finish()
|
||||
startActivity(intent)
|
||||
return
|
||||
}
|
||||
|
||||
val configShowContactThumbnails = baseConfig.showContactThumbnails
|
||||
val configShowContactThumbnails = config.showContactThumbnails
|
||||
if (storedShowContactThumbnails != configShowContactThumbnails) {
|
||||
getAllFragments().forEach {
|
||||
it?.showContactThumbnailsChanged(configShowContactThumbnails)
|
||||
|
@ -119,13 +119,13 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
updateMenuColors()
|
||||
setupTabColors()
|
||||
|
||||
val configStartNameWithSurname = baseConfig.startNameWithSurname
|
||||
val configStartNameWithSurname = config.startNameWithSurname
|
||||
if (storedStartNameWithSurname != configStartNameWithSurname) {
|
||||
contacts_fragment?.startNameWithSurnameChanged(configStartNameWithSurname)
|
||||
favorites_fragment?.startNameWithSurnameChanged(configStartNameWithSurname)
|
||||
}
|
||||
|
||||
val configFontSize = baseConfig.fontSize
|
||||
val configFontSize = config.fontSize
|
||||
if (storedFontSize != configFontSize) {
|
||||
getAllFragments().forEach {
|
||||
it?.fontSizeChanged()
|
||||
|
@ -144,23 +144,23 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
main_dialpad_button.apply {
|
||||
setImageDrawable(dialpadIcon)
|
||||
background.applyColorFilter(properPrimaryColor)
|
||||
beVisibleIf(baseConfig.showDialpadButton)
|
||||
beVisibleIf(config.showDialpadButton)
|
||||
}
|
||||
|
||||
isFirstResume = false
|
||||
checkShortcuts()
|
||||
|
||||
if (!baseConfig.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.contacts")) {
|
||||
if (!config.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.contacts")) {
|
||||
val dialogText = getString(R.string.upgraded_to_pro_contacts, getString(R.string.phone_storage_hidden))
|
||||
ConfirmationDialog(this, dialogText, 0, R.string.ok, 0, false) {}
|
||||
baseConfig.wasUpgradedFromFreeShown = true
|
||||
config.wasUpgradedFromFreeShown = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
storeStateVariables()
|
||||
baseConfig.lastUsedViewPagerPage = view_pager.currentItem
|
||||
config.lastUsedViewPagerPage = view_pager.currentItem
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
@ -197,7 +197,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
main_menu.getToolbar().menu.apply {
|
||||
findItem(R.id.sort).isVisible = currentFragment != groups_fragment
|
||||
findItem(R.id.filter).isVisible = currentFragment != groups_fragment
|
||||
findItem(R.id.dialpad).isVisible = !baseConfig.showDialpadButton
|
||||
findItem(R.id.dialpad).isVisible = !config.showDialpadButton
|
||||
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
}
|
||||
|
||||
private fun storeStateVariables() {
|
||||
baseConfig.apply {
|
||||
config.apply {
|
||||
storedShowContactThumbnails = showContactThumbnails
|
||||
storedShowPhoneNumbers = showPhoneNumbers
|
||||
storedStartNameWithSurname = startNameWithSurname
|
||||
|
@ -250,13 +250,13 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
|
||||
@SuppressLint("NewApi")
|
||||
private fun checkShortcuts() {
|
||||
val appIconColor = baseConfig.appIconColor
|
||||
if (isNougatMR1Plus() && baseConfig.lastHandledShortcutColor != appIconColor) {
|
||||
val appIconColor = config.appIconColor
|
||||
if (isNougatMR1Plus() && config.lastHandledShortcutColor != appIconColor) {
|
||||
val createNewContact = getCreateNewContactShortcut(appIconColor)
|
||||
|
||||
try {
|
||||
shortcutManager.dynamicShortcuts = Arrays.asList(createNewContact)
|
||||
baseConfig.lastHandledShortcutColor = appIconColor
|
||||
config.lastHandledShortcutColor = appIconColor
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
}
|
||||
|
||||
private fun getCurrentFragment(): MyViewPagerFragment? {
|
||||
val showTabs = baseConfig.showTabs
|
||||
val showTabs = config.showTabs
|
||||
val fragments = arrayListOf<MyViewPagerFragment>()
|
||||
if (showTabs and TAB_CONTACTS != 0) {
|
||||
fragments.add(contacts_fragment)
|
||||
|
@ -314,7 +314,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
private fun getInactiveTabIndexes(activeIndex: Int) = (0 until main_tabs_holder.tabCount).filter { it != activeIndex }
|
||||
|
||||
private fun getSelectedTabDrawableIds(): ArrayList<Int> {
|
||||
val showTabs = baseConfig.showTabs
|
||||
val showTabs = config.showTabs
|
||||
val icons = ArrayList<Int>()
|
||||
|
||||
if (showTabs and TAB_CONTACTS != 0) {
|
||||
|
@ -333,7 +333,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
}
|
||||
|
||||
private fun getDeselectedTabDrawableIds(): ArrayList<Int> {
|
||||
val showTabs = baseConfig.showTabs
|
||||
val showTabs = config.showTabs
|
||||
val icons = ArrayList<Int>()
|
||||
|
||||
if (showTabs and TAB_CONTACTS != 0) {
|
||||
|
@ -385,7 +385,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
private fun setupTabs() {
|
||||
main_tabs_holder.removeAllTabs()
|
||||
tabsList.forEachIndexed { index, value ->
|
||||
if (baseConfig.showTabs and value != 0) {
|
||||
if (config.showTabs and value != 0) {
|
||||
main_tabs_holder.newTab().setCustomView(R.layout.bottom_tablayout_item).apply {
|
||||
customView?.findViewById<ImageView>(R.id.tab_item_icon)?.setImageDrawable(getTabIcon(index))
|
||||
customView?.findViewById<TextView>(R.id.tab_item_label)?.text = getTabLabel(index)
|
||||
|
@ -499,7 +499,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
|
||||
private fun tryExportContacts() {
|
||||
if (isQPlus()) {
|
||||
ExportContactsDialog(this, baseConfig.lastExportPath, true) { file, ignoredContactSources ->
|
||||
ExportContactsDialog(this, config.lastExportPath, true) { file, ignoredContactSources ->
|
||||
ignoredExportContactSources = ignoredContactSources
|
||||
|
||||
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
|
||||
|
@ -519,7 +519,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
} else {
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
ExportContactsDialog(this, baseConfig.lastExportPath, false) { file, ignoredContactSources ->
|
||||
ExportContactsDialog(this, config.lastExportPath, false) { file, ignoredContactSources ->
|
||||
getFileOutputStream(file.toFileDirItem(this), true) {
|
||||
exportContactsTo(ignoredContactSources, it)
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
isGettingContacts = true
|
||||
|
||||
if (view_pager.adapter == null) {
|
||||
view_pager.adapter = ViewPagerAdapter(this, tabsList, baseConfig.showTabs)
|
||||
view_pager.adapter = ViewPagerAdapter(this, tabsList, config.showTabs)
|
||||
view_pager.currentItem = getDefaultTab()
|
||||
}
|
||||
|
||||
|
@ -617,9 +617,9 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
private fun getAllFragments() = arrayListOf(contacts_fragment, favorites_fragment, groups_fragment)
|
||||
|
||||
private fun getDefaultTab(): Int {
|
||||
val showTabsMask = baseConfig.showTabs
|
||||
return when (baseConfig.defaultTab) {
|
||||
TAB_LAST_USED -> baseConfig.lastUsedViewPagerPage
|
||||
val showTabsMask = config.showTabs
|
||||
return when (config.defaultTab) {
|
||||
TAB_LAST_USED -> config.lastUsedViewPagerPage
|
||||
TAB_CONTACTS -> 0
|
||||
TAB_FAVORITES -> if (showTabsMask and TAB_CONTACTS > 0) 1 else 0
|
||||
else -> {
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.simplemobiletools.commons.models.RadioItem
|
|||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.dialogs.ManageVisibleFieldsDialog
|
||||
import com.simplemobiletools.contacts.pro.dialogs.ManageVisibleTabsDialog
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.activity_settings.*
|
||||
import java.util.*
|
||||
|
||||
|
@ -77,8 +77,8 @@ class SettingsActivity : SimpleActivity() {
|
|||
RadioItem(TAB_LAST_USED, getString(R.string.last_used_tab))
|
||||
)
|
||||
|
||||
RadioGroupDialog(this@SettingsActivity, items, baseConfig.defaultTab) {
|
||||
baseConfig.defaultTab = it as Int
|
||||
RadioGroupDialog(this@SettingsActivity, items, config.defaultTab) {
|
||||
config.defaultTab = it as Int
|
||||
settings_default_tab.text = getDefaultTabText()
|
||||
}
|
||||
}
|
||||
|
@ -103,19 +103,19 @@ class SettingsActivity : SimpleActivity() {
|
|||
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(R.string.extra_large))
|
||||
)
|
||||
|
||||
RadioGroupDialog(this@SettingsActivity, items, baseConfig.fontSize) {
|
||||
baseConfig.fontSize = it as Int
|
||||
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
|
||||
config.fontSize = it as Int
|
||||
settings_font_size.text = getFontSizeText()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupUseEnglish() {
|
||||
settings_use_english_holder.beVisibleIf((baseConfig.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
|
||||
settings_use_english.isChecked = baseConfig.useEnglish
|
||||
settings_use_english_holder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
|
||||
settings_use_english.isChecked = config.useEnglish
|
||||
settings_use_english_holder.setOnClickListener {
|
||||
settings_use_english.toggle()
|
||||
baseConfig.useEnglish = settings_use_english.isChecked
|
||||
config.useEnglish = settings_use_english.isChecked
|
||||
System.exit(0)
|
||||
}
|
||||
}
|
||||
|
@ -129,50 +129,50 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun setupShowContactThumbnails() {
|
||||
settings_show_contact_thumbnails.isChecked = baseConfig.showContactThumbnails
|
||||
settings_show_contact_thumbnails.isChecked = config.showContactThumbnails
|
||||
settings_show_contact_thumbnails_holder.setOnClickListener {
|
||||
settings_show_contact_thumbnails.toggle()
|
||||
baseConfig.showContactThumbnails = settings_show_contact_thumbnails.isChecked
|
||||
config.showContactThumbnails = settings_show_contact_thumbnails.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupShowPhoneNumbers() {
|
||||
settings_show_phone_numbers.isChecked = baseConfig.showPhoneNumbers
|
||||
settings_show_phone_numbers.isChecked = config.showPhoneNumbers
|
||||
settings_show_phone_numbers_holder.setOnClickListener {
|
||||
settings_show_phone_numbers.toggle()
|
||||
baseConfig.showPhoneNumbers = settings_show_phone_numbers.isChecked
|
||||
config.showPhoneNumbers = settings_show_phone_numbers.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupShowContactsWithNumbers() {
|
||||
settings_show_only_contacts_with_numbers.isChecked = baseConfig.showOnlyContactsWithNumbers
|
||||
settings_show_only_contacts_with_numbers.isChecked = config.showOnlyContactsWithNumbers
|
||||
settings_show_only_contacts_with_numbers_holder.setOnClickListener {
|
||||
settings_show_only_contacts_with_numbers.toggle()
|
||||
baseConfig.showOnlyContactsWithNumbers = settings_show_only_contacts_with_numbers.isChecked
|
||||
config.showOnlyContactsWithNumbers = settings_show_only_contacts_with_numbers.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupStartNameWithSurname() {
|
||||
settings_start_name_with_surname.isChecked = baseConfig.startNameWithSurname
|
||||
settings_start_name_with_surname.isChecked = config.startNameWithSurname
|
||||
settings_start_name_with_surname_holder.setOnClickListener {
|
||||
settings_start_name_with_surname.toggle()
|
||||
baseConfig.startNameWithSurname = settings_start_name_with_surname.isChecked
|
||||
config.startNameWithSurname = settings_start_name_with_surname.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupShowDialpadButton() {
|
||||
settings_show_dialpad_button.isChecked = baseConfig.showDialpadButton
|
||||
settings_show_dialpad_button.isChecked = config.showDialpadButton
|
||||
settings_show_dialpad_button_holder.setOnClickListener {
|
||||
settings_show_dialpad_button.toggle()
|
||||
baseConfig.showDialpadButton = settings_show_dialpad_button.isChecked
|
||||
config.showDialpadButton = settings_show_dialpad_button.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupShowPrivateContacts() {
|
||||
settings_show_private_contacts.isChecked = baseConfig.showPrivateContacts
|
||||
settings_show_private_contacts.isChecked = config.showPrivateContacts
|
||||
settings_show_private_contacts_holder.setOnClickListener {
|
||||
settings_show_private_contacts.toggle()
|
||||
baseConfig.showPrivateContacts = settings_show_private_contacts.isChecked
|
||||
config.showPrivateContacts = settings_show_private_contacts.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,15 +185,15 @@ class SettingsActivity : SimpleActivity() {
|
|||
RadioItem(ON_CLICK_EDIT_CONTACT, getString(R.string.edit_contact))
|
||||
)
|
||||
|
||||
RadioGroupDialog(this@SettingsActivity, items, baseConfig.onContactClick) {
|
||||
baseConfig.onContactClick = it as Int
|
||||
RadioGroupDialog(this@SettingsActivity, items, config.onContactClick) {
|
||||
config.onContactClick = it as Int
|
||||
settings_on_contact_click.text = getOnContactClickText()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getOnContactClickText() = getString(
|
||||
when (baseConfig.onContactClick) {
|
||||
when (config.onContactClick) {
|
||||
ON_CLICK_CALL_CONTACT -> R.string.call_contact
|
||||
ON_CLICK_VIEW_CONTACT -> R.string.view_contact
|
||||
else -> R.string.edit_contact
|
||||
|
@ -201,18 +201,18 @@ class SettingsActivity : SimpleActivity() {
|
|||
)
|
||||
|
||||
private fun setupShowCallConfirmation() {
|
||||
settings_show_call_confirmation.isChecked = baseConfig.showCallConfirmation
|
||||
settings_show_call_confirmation.isChecked = config.showCallConfirmation
|
||||
settings_show_call_confirmation_holder.setOnClickListener {
|
||||
settings_show_call_confirmation.toggle()
|
||||
baseConfig.showCallConfirmation = settings_show_call_confirmation.isChecked
|
||||
config.showCallConfirmation = settings_show_call_confirmation.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupMergeDuplicateContacts() {
|
||||
settings_merge_duplicate_contacts.isChecked = baseConfig.mergeDuplicateContacts
|
||||
settings_merge_duplicate_contacts.isChecked = config.mergeDuplicateContacts
|
||||
settings_merge_duplicate_contacts_holder.setOnClickListener {
|
||||
settings_merge_duplicate_contacts.toggle()
|
||||
baseConfig.mergeDuplicateContacts = settings_merge_duplicate_contacts.isChecked
|
||||
config.mergeDuplicateContacts = settings_merge_duplicate_contacts.isChecked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class ViewContactActivity : ContactActivity() {
|
|||
private var showFields = 0
|
||||
private var fullContact: Contact? = null // contact with all fields filled from duplicates
|
||||
private var duplicateInitialized = false
|
||||
private val mergeDuplicate: Boolean get() = baseConfig.mergeDuplicateContacts
|
||||
private val mergeDuplicate: Boolean get() = config.mergeDuplicateContacts
|
||||
|
||||
private val COMPARABLE_PHONE_NUMBER_LENGTH = 9
|
||||
|
||||
|
@ -59,7 +59,7 @@ class ViewContactActivity : ContactActivity() {
|
|||
return
|
||||
}
|
||||
|
||||
showFields = baseConfig.showContactFields
|
||||
showFields = config.showContactFields
|
||||
contact_wrapper.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
setupMenu()
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class ViewContactActivity : ContactActivity() {
|
|||
|
||||
findItem(R.id.manage_visible_fields).setOnMenuItemClickListener {
|
||||
ManageVisibleFieldsDialog(this@ViewContactActivity) {
|
||||
showFields = baseConfig.showContactFields
|
||||
showFields = config.showContactFields
|
||||
ensureBackgroundThread {
|
||||
initContact()
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ class ViewContactActivity : ContactActivity() {
|
|||
copyOnLongClick(phoneNumber.value)
|
||||
|
||||
setOnClickListener {
|
||||
if (baseConfig.showCallConfirmation) {
|
||||
if (config.showCallConfirmation) {
|
||||
CallConfirmationDialog(this@ViewContactActivity, phoneNumber.value) {
|
||||
startCallIntent(phoneNumber.value)
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class ContactsAdapter(
|
|||
|
||||
private val NEW_GROUP_ID = -1
|
||||
|
||||
private var config = activity.baseConfig
|
||||
private var config = activity.config
|
||||
private var textToHighlight = highlightText
|
||||
|
||||
var startNameWithSurname = config.startNameWithSurname
|
||||
|
@ -452,7 +452,7 @@ class ContactsAdapter(
|
|||
override fun onChange(position: Int) = contactItems.getOrNull(position)?.getBubbleText() ?: ""
|
||||
|
||||
override fun onRowMoved(fromPosition: Int, toPosition: Int) {
|
||||
activity.baseConfig.isCustomOrderSelected = true
|
||||
activity.config.isCustomOrderSelected = true
|
||||
|
||||
if (fromPosition < toPosition) {
|
||||
for (i in fromPosition until toPosition) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.simplemobiletools.contacts.pro.activities.SimpleActivity
|
|||
import com.simplemobiletools.contacts.pro.dialogs.RenameGroupDialog
|
||||
import com.simplemobiletools.commons.helpers.ContactsHelper
|
||||
import com.simplemobiletools.commons.models.contacts.Group
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener
|
||||
import kotlinx.android.synthetic.main.item_group.view.*
|
||||
import java.util.*
|
||||
|
@ -27,7 +28,7 @@ class GroupsAdapter(
|
|||
) : MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate {
|
||||
|
||||
private var textToHighlight = ""
|
||||
var showContactThumbnails = activity.baseConfig.showContactThumbnails
|
||||
var showContactThumbnails = activity.config.showContactThumbnails
|
||||
var fontSize = activity.getTextSize()
|
||||
|
||||
init {
|
||||
|
|
|
@ -11,12 +11,12 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.signature.ObjectKey
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
||||
import com.simplemobiletools.commons.models.contacts.*
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.item_add_favorite_with_number.view.*
|
||||
|
||||
class SelectContactsAdapter(
|
||||
|
@ -30,7 +30,7 @@ class SelectContactsAdapter(
|
|||
RecyclerView.Adapter<SelectContactsAdapter.ViewHolder>() {
|
||||
private val itemViews = SparseArray<View>()
|
||||
private val selectedPositions = HashSet<Int>()
|
||||
private val config = activity.baseConfig
|
||||
private val config = activity.config
|
||||
private val adjustedPrimaryColor = activity.getProperPrimaryColor()
|
||||
private val fontSize = activity.getTextSize()
|
||||
|
||||
|
|
|
@ -6,15 +6,15 @@ import android.database.Cursor
|
|||
import android.database.MatrixCursor
|
||||
import android.net.Uri
|
||||
import com.google.gson.Gson
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.helpers.MyContactsContentProvider
|
||||
import com.simplemobiletools.commons.helpers.LocalContactsHelper
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
|
||||
class MyContactsContentProvider : ContentProvider() {
|
||||
override fun insert(uri: Uri, contentValues: ContentValues?) = null
|
||||
|
||||
override fun query(uri: Uri, projection: Array<out String>?, selection: String?, selectionArgs: Array<out String>?, sortOrder: String?): Cursor? {
|
||||
if (context == null || !context!!.baseConfig.showPrivateContacts) {
|
||||
if (context == null || !context!!.config.showPrivateContacts) {
|
||||
return null
|
||||
} else {
|
||||
val matrixCursor = MatrixCursor(
|
||||
|
|
|
@ -2,16 +2,16 @@ package com.simplemobiletools.contacts.pro.dialogs
|
|||
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.beGoneIf
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.dialog_change_sorting.view.*
|
||||
|
||||
class ChangeSortingDialog(val activity: BaseSimpleActivity, private val showCustomSorting: Boolean = false, private val callback: () -> Unit) {
|
||||
private var currSorting = 0
|
||||
private var config = activity.baseConfig
|
||||
private var config = activity.config
|
||||
private var view = activity.layoutInflater.inflate(R.layout.dialog_change_sorting, null)
|
||||
|
||||
init {
|
||||
|
|
|
@ -5,13 +5,13 @@ import android.view.ViewGroup
|
|||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.helpers.ContactsHelper
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.commons.models.contacts.*
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.contacts.pro.adapters.FilterContactSourcesAdapter
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.dialog_export_contacts.view.*
|
||||
import java.io.File
|
||||
|
||||
|
@ -80,7 +80,7 @@ class ExportContactsDialog(
|
|||
|
||||
ignoreClicks = true
|
||||
ensureBackgroundThread {
|
||||
activity.baseConfig.lastExportPath = file.absolutePath.getParentPath()
|
||||
activity.config.lastExportPath = file.absolutePath.getParentPath()
|
||||
val selectedSources = (view.export_contacts_list.adapter as FilterContactSourcesAdapter).getSelectedContactSources()
|
||||
val ignoredSources = contactSources
|
||||
.filter { !selectedSources.contains(it) }
|
||||
|
|
|
@ -7,10 +7,10 @@ import com.simplemobiletools.commons.helpers.SMT_PRIVATE
|
|||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.contacts.pro.adapters.FilterContactSourcesAdapter
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.extensions.getVisibleContactSources
|
||||
import com.simplemobiletools.commons.helpers.ContactsHelper
|
||||
import com.simplemobiletools.commons.models.contacts.*
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.dialog_filter_contact_sources.view.*
|
||||
|
||||
class FilterContactSourcesDialog(val activity: SimpleActivity, private val callback: () -> Unit) {
|
||||
|
@ -77,7 +77,7 @@ class FilterContactSourcesDialog(val activity: SimpleActivity, private val callb
|
|||
}.toHashSet()
|
||||
|
||||
if (activity.getVisibleContactSources() != ignoredContactSources) {
|
||||
activity.baseConfig.ignoredContactSources = ignoredContactSources
|
||||
activity.config.ignoredContactSources = ignoredContactSources
|
||||
callback()
|
||||
}
|
||||
dialog?.dismiss()
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.simplemobiletools.commons.helpers.SMT_PRIVATE
|
|||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
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.extensions.showContactSourcePicker
|
||||
import com.simplemobiletools.contacts.pro.helpers.VcfImporter
|
||||
import com.simplemobiletools.contacts.pro.helpers.VcfImporter.ImportResult.IMPORT_FAIL
|
||||
|
@ -19,7 +20,7 @@ class ImportContactsDialog(val activity: SimpleActivity, val path: String, priva
|
|||
|
||||
init {
|
||||
val view = (activity.layoutInflater.inflate(R.layout.dialog_import_contacts, null) as ViewGroup).apply {
|
||||
targetContactSource = activity.baseConfig.lastUsedContactSource
|
||||
targetContactSource = activity.config.lastUsedContactSource
|
||||
activity.getPublicContactSource(targetContactSource) {
|
||||
import_contacts_title.setText(it)
|
||||
if (it.isEmpty()) {
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
|||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
|
||||
class ManageVisibleFieldsDialog(val activity: BaseSimpleActivity, val callback: (hasSomethingChanged: Boolean) -> Unit) {
|
||||
private var view = activity.layoutInflater.inflate(R.layout.dialog_manage_visible_fields, null)
|
||||
|
@ -33,7 +33,7 @@ class ManageVisibleFieldsDialog(val activity: BaseSimpleActivity, val callback:
|
|||
put(SHOW_RINGTONE_FIELD, R.id.manage_ringtone)
|
||||
}
|
||||
|
||||
val showContactFields = activity.baseConfig.showContactFields
|
||||
val showContactFields = activity.config.showContactFields
|
||||
for ((key, value) in fields) {
|
||||
view.findViewById<MyAppCompatCheckbox>(value).isChecked = showContactFields and key != 0
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ class ManageVisibleFieldsDialog(val activity: BaseSimpleActivity, val callback:
|
|||
}
|
||||
}
|
||||
|
||||
val hasSomethingChanged = activity.baseConfig.showContactFields != result
|
||||
activity.baseConfig.showContactFields = result
|
||||
val hasSomethingChanged = activity.config.showContactFields != result
|
||||
activity.config.showContactFields = result
|
||||
|
||||
if (hasSomethingChanged) {
|
||||
callback(true)
|
||||
|
|
|
@ -8,8 +8,8 @@ import com.simplemobiletools.commons.helpers.TAB_FAVORITES
|
|||
import com.simplemobiletools.commons.helpers.TAB_GROUPS
|
||||
import com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.helpers.ALL_TABS_MASK
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
|
||||
class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) {
|
||||
private var view = activity.layoutInflater.inflate(R.layout.dialog_manage_visible_tabs, null)
|
||||
|
@ -22,7 +22,7 @@ class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) {
|
|||
put(TAB_GROUPS, R.id.manage_visible_tabs_groups)
|
||||
}
|
||||
|
||||
val showTabs = activity.baseConfig.showTabs
|
||||
val showTabs = activity.config.showTabs
|
||||
for ((key, value) in tabs) {
|
||||
view.findViewById<MyAppCompatCheckbox>(value).isChecked = showTabs and key != 0
|
||||
}
|
||||
|
@ -47,6 +47,6 @@ class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) {
|
|||
result = ALL_TABS_MASK
|
||||
}
|
||||
|
||||
activity.baseConfig.showTabs = result
|
||||
activity.config.showTabs = result
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
|||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.helpers.isSPlus
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.dialog_date_picker.view.*
|
||||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
@ -38,7 +38,7 @@ class MyDatePickerDialog(val activity: BaseSimpleActivity, val defaultDate: Stri
|
|||
}
|
||||
}
|
||||
|
||||
if (activity.baseConfig.isUsingSystemTheme && isSPlus()) {
|
||||
if (activity.config.isUsingSystemTheme && isSPlus()) {
|
||||
val dialogBackgroundColor = activity.getColor(R.color.you_dialog_background_color)
|
||||
view.dialog_holder.setBackgroundColor(dialogBackgroundColor)
|
||||
view.date_picker.setBackgroundColor(dialogBackgroundColor)
|
||||
|
|
|
@ -9,13 +9,12 @@ import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
|||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.models.contacts.Contact
|
||||
import com.simplemobiletools.contacts.pro.BuildConfig
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.activities.EditContactActivity
|
||||
import com.simplemobiletools.contacts.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.contacts.pro.activities.ViewContactActivity
|
||||
import com.simplemobiletools.contacts.pro.helpers.*
|
||||
import com.simplemobiletools.commons.models.contacts.*
|
||||
import com.simplemobiletools.contacts.pro.helpers.DEFAULT_FILE_NAME
|
||||
import com.simplemobiletools.contacts.pro.helpers.VcfExporter
|
||||
|
||||
|
@ -30,7 +29,7 @@ fun SimpleActivity.startCallIntent(recipient: String) {
|
|||
}
|
||||
|
||||
fun SimpleActivity.tryStartCall(contact: Contact) {
|
||||
if (baseConfig.showCallConfirmation) {
|
||||
if (config.showCallConfirmation) {
|
||||
CallConfirmationDialog(this, contact.getNameToDisplay()) {
|
||||
startCall(contact)
|
||||
}
|
||||
|
@ -107,7 +106,7 @@ fun BaseSimpleActivity.shareContacts(contacts: ArrayList<Contact>) {
|
|||
}
|
||||
|
||||
fun SimpleActivity.handleGenericContactClick(contact: Contact) {
|
||||
when (baseConfig.onContactClick) {
|
||||
when (config.onContactClick) {
|
||||
ON_CLICK_CALL_CONTACT -> callContact(contact)
|
||||
ON_CLICK_VIEW_CONTACT -> viewContact(contact)
|
||||
ON_CLICK_EDIT_CONTACT -> editContact(contact)
|
||||
|
|
|
@ -11,8 +11,10 @@ import com.simplemobiletools.commons.helpers.VIBER_PACKAGE
|
|||
import com.simplemobiletools.commons.helpers.WHATSAPP_PACKAGE
|
||||
import com.simplemobiletools.contacts.pro.BuildConfig
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.helpers.Config
|
||||
import java.io.File
|
||||
|
||||
val Context.config: Config get() = Config.newInstance(applicationContext)
|
||||
fun Context.getCachePhotoUri(file: File = getCachePhoto()) = FileProvider.getUriForFile(this, "${BuildConfig.APPLICATION_ID}.provider", file)
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
|
|
|
@ -17,11 +17,11 @@ import com.simplemobiletools.contacts.pro.activities.MainActivity
|
|||
import com.simplemobiletools.contacts.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.contacts.pro.adapters.ContactsAdapter
|
||||
import com.simplemobiletools.contacts.pro.adapters.GroupsAdapter
|
||||
import com.simplemobiletools.commons.extensions.baseConfig
|
||||
import com.simplemobiletools.commons.helpers.Converters
|
||||
import com.simplemobiletools.contacts.pro.helpers.*
|
||||
import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener
|
||||
import com.simplemobiletools.commons.models.contacts.*
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.fragment_layout.view.*
|
||||
import kotlinx.android.synthetic.main.fragment_layout.view.fragment_fab
|
||||
import kotlinx.android.synthetic.main.fragment_layout.view.fragment_list
|
||||
|
@ -38,13 +38,13 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
private var lastHashCode = 0
|
||||
private var contactsIgnoringSearch = ArrayList<Contact>()
|
||||
private var groupsIgnoringSearch = ArrayList<Group>()
|
||||
private lateinit var config: BaseConfig
|
||||
private lateinit var config: Config
|
||||
|
||||
var skipHashComparing = false
|
||||
var forceListRedraw = false
|
||||
|
||||
fun setupFragment(activity: SimpleActivity) {
|
||||
config = activity.baseConfig
|
||||
config = activity.config
|
||||
if (this.activity == null) {
|
||||
this.activity = activity
|
||||
fragment_fab?.beGoneIf(activity is InsertOrEditContactActivity)
|
||||
|
@ -124,7 +124,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
this is FavoritesFragment -> {
|
||||
val favorites = contacts.filter { it.starred == 1 } as ArrayList<Contact>
|
||||
|
||||
if (activity!!.baseConfig.isCustomOrderSelected) {
|
||||
if (activity!!.config.isCustomOrderSelected) {
|
||||
sortByCustomOrder(favorites)
|
||||
} else {
|
||||
favorites
|
||||
|
@ -158,7 +158,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
}
|
||||
|
||||
private fun sortByCustomOrder(starred: List<Contact>): ArrayList<Contact> {
|
||||
val favoritesOrder = activity!!.baseConfig.favoritesContactsOrder
|
||||
val favoritesOrder = activity!!.config.favoritesContactsOrder
|
||||
|
||||
if (favoritesOrder.isEmpty()) {
|
||||
return ArrayList(starred)
|
||||
|
@ -218,7 +218,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
}
|
||||
} else {
|
||||
(currAdapter as GroupsAdapter).apply {
|
||||
showContactThumbnails = activity.baseConfig.showContactThumbnails
|
||||
showContactThumbnails = activity.config.showContactThumbnails
|
||||
updateItems(storedGroups)
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
activity?.apply {
|
||||
val orderIds = items.map { it.id }
|
||||
val orderGsonString = Gson().toJson(orderIds)
|
||||
baseConfig.favoritesContactsOrder = orderGsonString
|
||||
config.favoritesContactsOrder = orderGsonString
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
}
|
||||
|
||||
private fun setupLetterFastscroller(contacts: ArrayList<Contact>) {
|
||||
val sorting = context.baseConfig.sorting
|
||||
val sorting = context.config.sorting
|
||||
letter_fastscroller.setupWithRecyclerView(fragment_list, { position ->
|
||||
try {
|
||||
val contact = contacts[position]
|
||||
|
@ -308,7 +308,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
sorting and SORT_BY_SURNAME != 0 && contact.surname.isNotEmpty() -> contact.surname
|
||||
sorting and SORT_BY_MIDDLE_NAME != 0 && contact.middleName.isNotEmpty() -> contact.middleName
|
||||
sorting and SORT_BY_FIRST_NAME != 0 && contact.firstName.isNotEmpty() -> contact.firstName
|
||||
context.baseConfig.startNameWithSurname -> contact.surname
|
||||
context.config.startNameWithSurname -> contact.surname
|
||||
else -> contact.firstName
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.simplemobiletools.contacts.pro.helpers
|
||||
|
||||
import android.content.Context
|
||||
import com.simplemobiletools.commons.helpers.BaseConfig
|
||||
|
||||
class Config(context: Context) : BaseConfig(context) {
|
||||
companion object {
|
||||
fun newInstance(context: Context) = Config(context)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue