From 50dc97e9c0180765522aa8e40f723280d1df6f90 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 6 Jan 2019 14:55:45 +0100 Subject: [PATCH] minor code cleanup here and there --- app/build.gradle | 2 +- .../contacts/pro/extensions/Activity.kt | 3 +-- .../contacts/pro/helpers/Constants.kt | 19 +++---------------- .../contacts/pro/helpers/ContactsHelper.kt | 2 +- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 738fee73..4092cc7c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -51,7 +51,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.6.4' + implementation 'com.simplemobiletools:commons:5.6.5' implementation 'joda-time:joda-time:2.10.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3' implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5' diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt index ec023538..c032c720 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt @@ -71,8 +71,7 @@ fun SimpleActivity.showContactSourcePicker(currentSource: String, callback: (new sources = filteredSources.map { it.publicName } sources.forEachIndexed { index, account -> - var publicAccount = account - items.add(RadioItem(index, publicAccount)) + items.add(RadioItem(index, account)) if (currentSource == SMT_PRIVATE && account == getString(R.string.phone_storage_hidden)) { currentSourceIndex = index } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt index f4228e5d..0fa64cf7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt @@ -10,7 +10,6 @@ const val SHOW_ONLY_CONTACTS_WITH_NUMBERS = "show_only_contacts_with_numbers" const val IGNORED_CONTACT_SOURCES = "ignored_contact_sources_2" const val START_NAME_WITH_SURNAME = "start_name_with_surname" const val LAST_USED_CONTACT_SOURCE = "last_used_contact_source" -const val LOCAL_ACCOUNT_TYPE = "local_account_type" const val ON_CONTACT_CLICK = "on_contact_click" const val SHOW_CONTACT_FIELDS = "show_contact_fields" const val SHOW_TABS = "show_tabs" @@ -35,10 +34,9 @@ const val KEY_NAME = "name" const val LOCATION_CONTACTS_TAB = 0 const val LOCATION_FAVORITES_TAB = 1 -const val LOCATION_GROUPS_TAB = 2 -const val LOCATION_GROUP_CONTACTS = 3 -const val LOCATION_DIALPAD = 4 -const val LOCATION_INSERT_OR_EDIT = 5 +const val LOCATION_GROUP_CONTACTS = 2 +const val LOCATION_DIALPAD = 3 +const val LOCATION_INSERT_OR_EDIT = 4 const val CONTACTS_TAB_MASK = 1 const val FAVORITES_TAB_MASK = 2 @@ -104,17 +102,6 @@ const val DEFAULT_ORGANIZATION_TYPE = CommonDataKinds.Organization.TYPE_WORK const val DEFAULT_WEBSITE_TYPE = CommonDataKinds.Website.TYPE_HOMEPAGE const val DEFAULT_IM_TYPE = CommonDataKinds.Im.PROTOCOL_SKYPE -// some manufacturer contact account types from https://stackoverflow.com/a/44802016/1967672 -val localAccountTypes = arrayListOf("vnd.sec.contact.phone", - "com.htc.android.pcsc", - "com.sonyericsson.localcontacts", - "com.lge.sync", - "com.lge.phone", - "vnd.tmobileus.contact.phone", - "com.android.huawei.phone", - "Local Phone Account" -) - // apps with special handling const val TELEGRAM_PACKAGE = "org.telegram.messenger" const val SIGNAL_PACKAGE = "org.thoughtcrime.securesms" diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt index 766f5a48..e07326b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt @@ -670,7 +670,7 @@ class ContactsHelper(val context: Context) { return groups } - fun getDeviceStoredGroups(): ArrayList { + private fun getDeviceStoredGroups(): ArrayList { val groups = ArrayList() if (!context.hasContactPermissions()) { return groups