diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ace45ce..60a748cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ Changelog ========== +Version 6.1.2 *(2018-12-28)* +---------------------------- + + * Improve the way contacts are fetched, more contacts should show up + * Improve contact filtering to fix some glitches + * Added a Call menu button for calling not stored numbers from Recents + * Some stability improvements + +Version 6.1.1 *(2018-12-12)* +---------------------------- + + * Fixing a crash on Android Lollipop + * Added some translation improvements + Version 6.1.0 *(2018-11-30)* ---------------------------- diff --git a/app/build.gradle b/app/build.gradle index 5d27b633..556bf398 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "com.simplemobiletools.contacts.pro" minSdkVersion 21 targetSdkVersion 28 - versionCode 37 - versionName "6.1.0" + versionCode 39 + versionName "6.1.2" setProperty("archivesBaseName", "contacts") } @@ -51,9 +51,9 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.5.1' + implementation 'com.simplemobiletools:commons:5.6.2' implementation 'joda-time:joda-time:2.10.1' - implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3' implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.4' kapt "androidx.room:room-compiler:2.0.0" diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/DialpadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/DialpadActivity.kt index f6250e0d..ceedf0ff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/DialpadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/DialpadActivity.kt @@ -55,7 +55,7 @@ class DialpadActivity : SimpleActivity() { ContactsHelper(this).getContacts { gotContacts(it) } disableKeyboardPopping() - val callIcon = resources.getColoredDrawableWithColor(R.drawable.ic_phone_big, if (isBlackAndWhiteTheme()) Color.BLACK else Color.WHITE) + val callIcon = resources.getColoredDrawableWithColor(R.drawable.ic_phone_huge, if (isBlackAndWhiteTheme()) Color.BLACK else Color.WHITE) dialpad_call_button.setImageDrawable(callIcon) dialpad_call_button.background.applyColorFilter(getAdjustedPrimaryColor()) } 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 f882d3c3..a25b59d1 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 @@ -568,15 +568,19 @@ class EditContactActivity : ContactActivity() { } private fun setupContactSource() { - contact_source.text = getPublicContactSource(contact!!.source) originalContactSource = contact!!.source + getPublicContactSource(contact!!.source) { + contact_source.text = it + } } private fun setupNewContact() { supportActionBar?.title = resources.getString(R.string.new_contact) originalContactSource = if (hasContactPermissions()) config.lastUsedContactSource else SMT_PRIVATE contact = getEmptyContact() - contact_source.text = getPublicContactSource(contact!!.source) + getPublicContactSource(contact!!.source) { + contact_source.text = it + } } private fun setupTypePickers() { @@ -831,7 +835,9 @@ class EditContactActivity : ContactActivity() { private fun showSelectContactSourceDialog() { showContactSourcePicker(contact!!.source) { contact!!.source = if (it == getString(R.string.phone_storage_hidden)) SMT_PRIVATE else it - contact_source.text = getPublicContactSource(it) + getPublicContactSource(it) { + contact_source.text = it + } } } 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 ec08ce56..9740e609 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 @@ -191,7 +191,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { menu.apply { findItem(R.id.search).isVisible = currentFragment != groups_fragment && currentFragment != recents_fragment findItem(R.id.sort).isVisible = currentFragment != groups_fragment && currentFragment != recents_fragment - findItem(R.id.filter).isVisible = currentFragment != groups_fragment + findItem(R.id.filter).isVisible = currentFragment != groups_fragment && currentFragment != recents_fragment } setupSearch(menu) return true @@ -495,7 +495,8 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { val faqItems = arrayListOf( FAQItem(R.string.faq_1_title, R.string.faq_1_text), - FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons) + FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons), + FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons) ) startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true) @@ -585,6 +586,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { add(Release(31, R.string.release_31)) add(Release(32, R.string.release_32)) add(Release(34, R.string.release_34)) + add(Release(39, R.string.release_39)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } 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 63ac285a..0ff042c7 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,6 +6,7 @@ import android.content.Intent import android.os.Build import android.telecom.TelecomManager import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.helpers.KEY_PHONE import com.simplemobiletools.contacts.pro.helpers.REQUEST_CODE_SET_DEFAULT_DIALER @@ -54,7 +55,12 @@ open class SimpleActivity : BaseSimpleActivity() { @TargetApi(Build.VERSION_CODES.M) protected fun launchSetDefaultDialerIntent() { - val intent = Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER).putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, packageName) - startActivityForResult(intent, REQUEST_CODE_SET_DEFAULT_DIALER) + Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER).putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, packageName).apply { + if (resolveActivity(packageManager) != null) { + startActivityForResult(this, REQUEST_CODE_SET_DEFAULT_DIALER) + } else { + toast(R.string.no_app_found) + } + } } } 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 b1ef1744..84fe9fea 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 @@ -446,11 +446,12 @@ class ViewContactActivity : ContactActivity() { private fun setupContactSource() { if (showFields and SHOW_CONTACT_SOURCE_FIELD != 0) { - val contactSourceValue = getPublicContactSource(contact!!.source) - contact_source.text = contactSourceValue + getPublicContactSource(contact!!.source) { + contact_source.text = it + contact_source.copyOnLongClick(it) + } contact_source_image.beVisible() contact_source.beVisible() - contact_source.copyOnLongClick(contactSourceValue) } else { contact_source_image.beGone() contact_source.beGone() 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 9af1c7e7..c125072d 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 @@ -62,7 +62,7 @@ class FilterContactSourcesAdapter(val activity: SimpleActivity, private val cont 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.text = contactSource.name + 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/RecentCallsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/RecentCallsAdapter.kt index 41b24af4..72a13c33 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/RecentCallsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/RecentCallsAdapter.kt @@ -13,6 +13,7 @@ import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.extensions.addBlockedNumber import com.simplemobiletools.contacts.pro.extensions.config +import com.simplemobiletools.contacts.pro.extensions.startCallIntent import com.simplemobiletools.contacts.pro.helpers.ContactsHelper import com.simplemobiletools.contacts.pro.helpers.RECENTS_TAB_MASK import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener @@ -31,9 +32,15 @@ class RecentCallsAdapter(activity: SimpleActivity, var recentCalls: ArrayList callNumber() R.id.cab_select_all -> selectAll() R.id.cab_delete -> askConfirmDelete() R.id.cab_block_number -> blockNumber() @@ -76,6 +84,10 @@ class RecentCallsAdapter(activity: SimpleActivity, var recentCalls: ArrayList() if (activity.config.localAccountName.isNotEmpty()) { - contactSources.add(ContactSource(activity.config.localAccountName, activity.config.localAccountType)) + val localAccountName = activity.config.localAccountName + contactSources.add(ContactSource(localAccountName, activity.config.localAccountType, localAccountName)) } ContactsHelper(activity).getContactSources { - it.filter { it.type.contains("google", true) }.mapTo(contactSources, { ContactSource(it.name, it.type) }) - contactSources.add(ContactSource(activity.getString(R.string.phone_storage_hidden), SMT_PRIVATE)) + it.filter { it.type.contains("google", true) }.mapTo(contactSources) { ContactSource(it.name, it.type, it.name) } + val phoneSecret = activity.getString(R.string.phone_storage_hidden) + contactSources.add(ContactSource(phoneSecret, SMT_PRIVATE, phoneSecret)) val items = ArrayList() contactSources.forEachIndexed { index, contactSource -> diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/FilterContactSourcesDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/FilterContactSourcesDialog.kt index 6fe2413f..3e1b7d4d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/FilterContactSourcesDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/FilterContactSourcesDialog.kt @@ -41,12 +41,12 @@ class FilterContactSourcesDialog(val activity: SimpleActivity, private val callb private fun confirmEventTypes() { val selectedContactSources = (view.filter_contact_sources_list.adapter as FilterContactSourcesAdapter).getSelectedContactSources() - val ignoredContactSourceNames = contactSources.filter { !selectedContactSources.contains(it) }.map { - if (it.type == SMT_PRIVATE) SMT_PRIVATE else it.name + val ignoredContactSources = contactSources.filter { !selectedContactSources.contains(it) }.map { + if (it.type == SMT_PRIVATE) SMT_PRIVATE else it.getFullIdentifier() }.toHashSet() - if (activity.getVisibleContactSources() != ignoredContactSourceNames) { - activity.config.ignoredContactSources = ignoredContactSourceNames + if (activity.getVisibleContactSources() != ignoredContactSources) { + activity.config.ignoredContactSources = ignoredContactSources callback() } dialog?.dismiss() diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ImportContactsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ImportContactsDialog.kt index 6ece8edb..131070d3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ImportContactsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ImportContactsDialog.kt @@ -20,11 +20,16 @@ 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.config.lastUsedContactSource - import_contacts_title.text = activity.getPublicContactSource(targetContactSource) + activity.getPublicContactSource(targetContactSource) { + import_contacts_title.text = it + } + import_contacts_title.setOnClickListener { activity.showContactSourcePicker(targetContactSource) { targetContactSource = if (it == activity.getString(R.string.phone_storage_hidden)) SMT_PRIVATE else it - import_contacts_title.text = activity.getPublicContactSource(it) + activity.getPublicContactSource(it) { + import_contacts_title.text = it + } } } } 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 cda4b77a..8f416c21 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 @@ -65,8 +65,11 @@ fun SimpleActivity.showContactSourcePicker(currentSource: String, callback: (new ) val items = ArrayList() - val sources = it.filter { !ignoredTypes.contains(it.type) }.map { it.name } - var currentSourceIndex = -1 + val filteredSources = it.filter { !ignoredTypes.contains(it.type) } + var sources = filteredSources.map { it.name } + var currentSourceIndex = sources.indexOfFirst { it == currentSource } + sources = filteredSources.map { it.publicName } + sources.forEachIndexed { index, account -> var publicAccount = account if (account == config.localAccountName) { @@ -74,16 +77,14 @@ fun SimpleActivity.showContactSourcePicker(currentSource: String, callback: (new } items.add(RadioItem(index, publicAccount)) - if (account == currentSource) { - currentSourceIndex = index - } else if (currentSource == SMT_PRIVATE && account == getString(R.string.phone_storage_hidden)) { + if (currentSource == SMT_PRIVATE && account == getString(R.string.phone_storage_hidden)) { currentSourceIndex = index } } runOnUiThread { RadioGroupDialog(this, items, currentSourceIndex) { - callback(sources[it as Int]) + callback(filteredSources[it as Int].name) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt index 0b42a0aa..7cd82aad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt @@ -7,6 +7,8 @@ import android.content.Intent import android.database.Cursor import android.net.Uri import android.os.Build +import android.os.Handler +import android.os.Looper import android.provider.BlockedNumberContract import android.provider.BlockedNumberContract.BlockedNumbers import android.provider.ContactsContract @@ -15,6 +17,7 @@ import androidx.core.content.FileProvider import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CONTACTS +import com.simplemobiletools.commons.helpers.isMarshmallowPlus import com.simplemobiletools.commons.helpers.isNougatPlus import com.simplemobiletools.contacts.pro.BuildConfig import com.simplemobiletools.contacts.pro.R @@ -192,11 +195,26 @@ fun Context.getPhotoThumbnailSize(): Int { fun Context.hasContactPermissions() = hasPermission(PERMISSION_READ_CONTACTS) && hasPermission(PERMISSION_WRITE_CONTACTS) -fun Context.getPublicContactSource(source: String): String { - return when (source) { - config.localAccountName -> getString(R.string.phone_storage) - SMT_PRIVATE -> getString(R.string.phone_storage_hidden) - else -> source +fun Context.getPublicContactSource(source: String, callback: (String) -> Unit) { + when (source) { + config.localAccountName -> callback(getString(R.string.phone_storage)) + SMT_PRIVATE -> callback(getString(R.string.phone_storage_hidden)) + else -> { + Thread { + ContactsHelper(this).getContactSources { + var newSource = source + for (contactSource in it) { + if (contactSource.name == source && contactSource.type == TELEGRAM_PACKAGE) { + newSource += " (${getString(R.string.telegram)})" + break + } + } + Handler(Looper.getMainLooper()).post { + callback(newSource) + } + } + }.start() + } } } @@ -288,9 +306,11 @@ fun Context.getContactPublicUri(contact: Contact): Uri { fun Context.getVisibleContactSources(): ArrayList { val sources = ContactsHelper(this).getDeviceContactSources() - sources.add(ContactSource(getString(R.string.phone_storage_hidden), SMT_PRIVATE)) - val sourceNames = ArrayList(sources).map { if (it.type == SMT_PRIVATE) SMT_PRIVATE else it.name }.toMutableList() as ArrayList - sourceNames.removeAll(config.ignoredContactSources) + val phoneSecret = getString(R.string.phone_storage_hidden) + sources.add(ContactSource(phoneSecret, SMT_PRIVATE, phoneSecret)) + val ignoredContactSources = config.ignoredContactSources + val sourceNames = ArrayList(sources).filter { !ignoredContactSources.contains(it.getFullIdentifier()) } + .map { if (it.type == SMT_PRIVATE) SMT_PRIVATE else it.name }.toMutableList() as ArrayList return sourceNames } @@ -331,7 +351,11 @@ fun Context.getBlockedNumbers(): ArrayList { fun Context.addBlockedNumber(number: String) { ContentValues().apply { put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, number) - contentResolver.insert(BlockedNumbers.CONTENT_URI, this) + try { + contentResolver.insert(BlockedNumbers.CONTENT_URI, this) + } catch (e: Exception) { + showErrorToast(e) + } } } @@ -344,4 +368,4 @@ fun Context.deleteBlockedNumber(number: String) { } @TargetApi(Build.VERSION_CODES.M) -fun Context.isDefaultDialer() = telecomManager.defaultDialerPackage == packageName +fun Context.isDefaultDialer() = isMarshmallowPlus() && telecomManager.defaultDialerPackage == packageName 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 8826a543..1e2786de 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 @@ -7,7 +7,7 @@ import com.simplemobiletools.contacts.pro.models.LocalContact const val SHOW_CONTACT_THUMBNAILS = "show_contact_thumbnails" const val SHOW_PHONE_NUMBERS = "show_phone_numbers" const val SHOW_ONLY_CONTACTS_WITH_NUMBERS = "show_only_contacts_with_numbers" -const val IGNORED_CONTACT_SOURCES = "ignored_contact_sources" +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_NAME = "local_account_name" 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 8a14f930..a4e69bf3 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 @@ -108,7 +108,12 @@ class ContactsHelper(val context: Context) { do { val name = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME) ?: "" val type = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_TYPE) ?: "" - val source = ContactSource(name, type) + var publicName = name + if (type == TELEGRAM_PACKAGE) { + publicName += " (${context.getString(R.string.telegram)})" + } + + val source = ContactSource(name, type, publicName) sources.add(source) } while (cursor.moveToNext()) } @@ -125,10 +130,12 @@ class ContactsHelper(val context: Context) { return } + val ignoredSources = context.config.ignoredContactSources val uri = ContactsContract.Data.CONTENT_URI val projection = getContactProjection() - val selection = getSourcesSelection(true) - val selectionArgs = getSourcesSelectionArgs(CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) + + val selection = "${ContactsContract.Data.MIMETYPE} = ?" + val selectionArgs = arrayOf(CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) val sortOrder = getSortString() var cursor: Cursor? = null @@ -136,6 +143,12 @@ class ContactsHelper(val context: Context) { cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, sortOrder) if (cursor?.moveToFirst() == true) { do { + val accountName = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME) ?: "" + val accountType = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_TYPE) ?: "" + if (ignoredSources.contains("$accountName:$accountType")) { + continue + } + val id = cursor.getIntValue(ContactsContract.Data.RAW_CONTACT_ID) val prefix = cursor.getStringValue(CommonDataKinds.StructuredName.PREFIX) ?: "" val firstName = cursor.getStringValue(CommonDataKinds.StructuredName.GIVEN_NAME) ?: "" @@ -148,7 +161,6 @@ class ContactsHelper(val context: Context) { val emails = ArrayList() val addresses = ArrayList
() val events = ArrayList() - val accountName = cursor.getStringValue(ContactsContract.RawContacts.ACCOUNT_NAME) ?: "" val starred = cursor.getIntValue(CommonDataKinds.StructuredName.STARRED) val contactId = cursor.getIntValue(ContactsContract.Data.CONTACT_ID) val thumbnailUri = cursor.getStringValue(CommonDataKinds.StructuredName.PHOTO_THUMBNAIL_URI) ?: "" @@ -825,7 +837,8 @@ class ContactsHelper(val context: Context) { private fun getContactSourcesSync(): ArrayList { val sources = getDeviceContactSources() - sources.add(ContactSource(context.getString(R.string.phone_storage_hidden), SMT_PRIVATE)) + val phoneSecret = context.getString(R.string.phone_storage_hidden) + sources.add(ContactSource(phoneSecret, SMT_PRIVATE, phoneSecret)) return ArrayList(sources) } @@ -838,10 +851,11 @@ class ContactsHelper(val context: Context) { val accounts = AccountManager.get(context).accounts accounts.forEach { if (ContentResolver.getIsSyncable(it, ContactsContract.AUTHORITY) == 1) { - val contactSource = ContactSource(it.name, it.type) + var publicName = it.name if (it.type == TELEGRAM_PACKAGE) { - contactSource.name += " (${context.getString(R.string.telegram)})" + publicName += " (${context.getString(R.string.telegram)})" } + val contactSource = ContactSource(it.name, it.type, publicName) sources.add(contactSource) } } @@ -852,7 +866,7 @@ class ContactsHelper(val context: Context) { sources.addAll(contentResolverAccounts) if (sources.isEmpty() && context.config.localAccountName.isEmpty() && context.config.localAccountType.isEmpty()) { - sources.add(ContactSource("", "")) + sources.add(ContactSource("", "", "")) } return sources @@ -871,7 +885,8 @@ class ContactsHelper(val context: Context) { CommonDataKinds.StructuredName.PHOTO_URI, CommonDataKinds.StructuredName.PHOTO_THUMBNAIL_URI, CommonDataKinds.StructuredName.STARRED, - ContactsContract.RawContacts.ACCOUNT_NAME + ContactsContract.RawContacts.ACCOUNT_NAME, + ContactsContract.RawContacts.ACCOUNT_TYPE ) private fun getSortString(): String { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt index 7eb0d57e..c3851d83 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/Contact.kt @@ -119,7 +119,7 @@ data class Contact(var id: Int, var prefix: String, var firstName: String, var m fun getHashToCompare() = getStringToCompare().hashCode() - fun getFullCompany(): String { + private fun getFullCompany(): String { var fullOrganization = if (organization.company.isEmpty()) "" else "${organization.company}, " fullOrganization += organization.jobPosition return fullOrganization.trim().trimEnd(',') diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/ContactSource.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/ContactSource.kt index f1a4ba0b..a5f55e30 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/ContactSource.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/ContactSource.kt @@ -1,3 +1,13 @@ package com.simplemobiletools.contacts.pro.models -data class ContactSource(var name: String, var type: String) +import com.simplemobiletools.contacts.pro.helpers.SMT_PRIVATE + +data class ContactSource(var name: String, var type: String, var publicName: String) { + fun getFullIdentifier(): String { + return if (type == SMT_PRIVATE) { + type + } else { + "$name:$type" + } + } +} diff --git a/app/src/main/res/drawable-hdpi/ic_phone.png b/app/src/main/res/drawable-hdpi/ic_phone.png new file mode 100644 index 00000000..3421fffe Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_phone.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_phone_big.png b/app/src/main/res/drawable-hdpi/ic_phone_huge.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_phone_big.png rename to app/src/main/res/drawable-hdpi/ic_phone_huge.png diff --git a/app/src/main/res/drawable-xhdpi/ic_phone.png b/app/src/main/res/drawable-xhdpi/ic_phone.png new file mode 100644 index 00000000..685efe22 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_phone.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_phone_big.png b/app/src/main/res/drawable-xhdpi/ic_phone_huge.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_phone_big.png rename to app/src/main/res/drawable-xhdpi/ic_phone_huge.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_phone.png b/app/src/main/res/drawable-xxhdpi/ic_phone.png new file mode 100644 index 00000000..61d59bd4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_phone.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_phone_big.png b/app/src/main/res/drawable-xxhdpi/ic_phone_huge.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_phone_big.png rename to app/src/main/res/drawable-xxhdpi/ic_phone_huge.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_phone.png b/app/src/main/res/drawable-xxxhdpi/ic_phone.png new file mode 100644 index 00000000..3aae5d70 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_phone.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_phone_big.png b/app/src/main/res/drawable-xxxhdpi/ic_phone_huge.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/ic_phone_big.png rename to app/src/main/res/drawable-xxxhdpi/ic_phone_huge.png diff --git a/app/src/main/res/layout/activity_dialpad.xml b/app/src/main/res/layout/activity_dialpad.xml index 96aa5f19..6d06a8b4 100644 --- a/app/src/main/res/layout/activity_dialpad.xml +++ b/app/src/main/res/layout/activity_dialpad.xml @@ -238,7 +238,7 @@ android:background="@drawable/circle_background" android:elevation="@dimen/medium_margin" android:padding="@dimen/normal_margin" - android:src="@drawable/ic_phone_big" + android:src="@drawable/ic_phone_huge" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"/> diff --git a/app/src/main/res/layout/activity_edit_contact.xml b/app/src/main/res/layout/activity_edit_contact.xml index 304a7a52..c98394fd 100644 --- a/app/src/main/res/layout/activity_edit_contact.xml +++ b/app/src/main/res/layout/activity_edit_contact.xml @@ -64,7 +64,7 @@ android:paddingLeft="@dimen/activity_margin" android:paddingRight="@dimen/activity_margin" android:scaleType="center" - android:src="@drawable/ic_phone"/> + android:src="@drawable/ic_phone_big"/> + android:src="@drawable/ic_phone_big"/> + android:src="@drawable/ic_phone_big"/> + android:src="@drawable/ic_phone_big"/> + android:src="@drawable/ic_phone_huge"/> diff --git a/app/src/main/res/menu/cab_recent_calls.xml b/app/src/main/res/menu/cab_recent_calls.xml index f5e7c4ba..d26f3097 100644 --- a/app/src/main/res/menu/cab_recent_calls.xml +++ b/app/src/main/res/menu/cab_recent_calls.xml @@ -2,9 +2,9 @@ + diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index fd4f43b3..d68968bd 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -19,6 +19,7 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number No contacts found diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d031d5b3..38dd24d5 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -17,14 +17,15 @@ Benötigte Berechtigungen anfordern Neuen Kontakt erstellen Zu einem existierenden Kontakt hinzufügen - You have to make this app the default dialer app to make use of blocked numbers. - Set to default + Du musst diese App als Standardtelefonie-App einstellen, um Nummern blockieren zu können. + Als Standard auswählen + Call number Keine Kontakte gefunden Keine Kontakte mit E-Mailadressen gefunden Keine Kontakte mit Telefonnummern gefunden - No recent calls found + Keine kürzlichen Anrufe gefunden Neuer Kontakt Kontakt bearbeiten @@ -55,7 +56,7 @@ Namen mit Nachnamen beginnen Telefonnummern im Hauptmenü zeigen Vorschaubilder der Kontakte zeigen - Show a dialpad button on the main screen + Eine Wählfehldschaltfläche auf dem Hauptbildschirm anzeigen Beim Klicken auf den Kontakt Kontakt anrufen Kontaktdetails anzeigen @@ -113,13 +114,13 @@ Dialer - Calling - Incoming call - Incoming call from… - Ongoing call - Disconnected - Decline - Answer + Anrufaufbau + Eingehender Anruf + Eingehender Anruf von… + Laufender Anruf + Getrennt + Ablehnen + Antworten Sichtbare Felder auswählen @@ -137,12 +138,12 @@ Instant messaging (IM) - Manage blocked numbers - You are not blocking anyone. - Add a blocked number - Block number - Block numbers - Blocked numbers + Blockierte Nummern verwalten + Du blockierst niemanden. + Eine blockierte Nummer hinzufügen + Nummer blockieren + Nummern blockieren + Blockierte Nummern Ich möchte die sichtbaren Kontaktfelder ändern. Kann ich das machen? diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index b18b448e..f60781f4 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -19,6 +19,7 @@ Προσθήκη σε μια υπάρχουσα Επαφή You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number No contacts found diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml index da6af990..60459584 100644 --- a/app/src/main/res/values-eu/strings.xml +++ b/app/src/main/res/values-eu/strings.xml @@ -19,6 +19,7 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number No contacts found diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 093f665a..ffc399f6 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -19,6 +19,7 @@ Ajouter à un contact existant You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number Aucun contact n\'a été trouvé @@ -139,10 +140,10 @@ Manage blocked numbers You are not blocking anyone. - Add a blocked number - Block number - Block numbers - Blocked numbers + Ajouter un numéro bloqué + Numéro bloquer + Numéros bloquer + Numéros bloquer Je veux modifier les champs affichés sur les fiches de mes contacts. Puis-je le faire ? @@ -152,12 +153,12 @@ Une application répertoire pour gérer vos contacts sans publicité. - Un outil simple pour créer et gérer vos contacts depuis n\'importe quelle source. Les contacts peuvent être stockés sur votre appareil mais aussi synchronisés via votre compte Google ou d\'autres comptes. Vous pouvez afficher vos contacts favoris dans une liste séparée. - - Vous pouvez l\'utiliser pour gérer les adresses de courriels et les événements de vos contacts. Cet outil permet de trier/filtrer à l\'aide de multiples paramètres, par exemple : afficher le surnom en premier. - - L\'application ne contient ni publicité, ni autorisation inutile. Elle est totalement opensource et est également fournie avec des couleurs personnalisables. - + Un outil simple pour créer et gérer vos contacts depuis n\'importe quelle source. Les contacts peuvent être stockés sur votre appareil mais aussi synchronisés via votre compte Google ou d\'autres comptes. Vous pouvez afficher vos contacts favoris dans une liste séparée. + + Vous pouvez l\'utiliser pour gérer les adresses de courriels et les événements de vos contacts. Cet outil permet de trier/filtrer à l\'aide de multiples paramètres, par exemple : afficher le surnom en premier. + + L\'application ne contient ni publicité, ni autorisation inutile. Elle est totalement opensource et est également fournie avec des couleurs personnalisables. + Cette application fait partie d\'une plus grande suite. Vous pouvez trouver les autres applications sur https://www.simplemobiletools.com diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 22a6d639..e2c6801b 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -19,6 +19,7 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number No contacts found diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 49dde94e..38778643 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1,12 +1,12 @@ - Simple Contacts + Semplice Contatti Contatti Indirizzo Inserimento in corso… Aggiornamento in corso… Memoria del telefono Memoria del telefono (non visibile alle altre applicazioni) - Compagnia + Società Posizione lavorativa Sito web Invia un SMS ai contatti @@ -16,9 +16,10 @@ Chiama %s Richiedi le permissioni necessarie Crea un nuovo contatto - Aggiungi ad un contatto esistente + Aggiungi a un contatto esistente È necessario impostare quest\'app come predefinita per utilizzare i numeri bloccati. Imposta come predefinita + Call number Nessun contatto trovato @@ -47,25 +48,25 @@ Crea un gruppo con un account - Scatta un foto + Scatta una foto Scegli una foto - Rimuovi foto + Rimuovi la foto Prima il nome poi il cognome Mostra i numeri di telefono nella schermata principale Mostra le anteprime dei contatti - Mostra il pulante per la tastiera nello schermo principale - Al click sul contatto + Mostra il pulante per il tastierino nello schermo principale + Alla pressione sul contatto Chiama contatto Visualizza i dettagli del contatto Gestisci i campi mostrati - Prova a filtrare i contatti duplicati + Unisci i contatti duplicati Gestisci le schede mostrate Contatti Preferiti Chiamate recenti - Mostra un dialogo di conferma prima di iniziare una chiamata + Mostra un messaggio di conferma prima di iniziare una chiamata Mostra solamente i contatti con almeno un numero telefonico @@ -88,11 +89,11 @@ Anniversario - Sembra che ancora non si ha nessun contatto preferito. + Non si ha ancora nessun contatto preferito. Aggiungi preferito Aggiungi ai preferiti Rimuovi dai preferiti - Devi stare nella schermata di modifica per modificare un contatto + Si deve stare nella schermata di modifica per modificare un contatto Cerca contatti @@ -138,7 +139,7 @@ Gestisci i numeri bloccati - Non si sta blocccando alcun numero. + Nessun numero bloccato. Aggiungi un numero da bloccare Blocca numero Blocca numeri @@ -146,19 +147,19 @@ Voglio cambiare i campi visibili ai contatti. Come posso fare? - Puoi farlo andando in Impostazioni -> Gestisci i campi mostrati. Qui puoi selezionare i campi che saranno visibili. Alcuni sono anche disabilitati in maniera predefinita, quindi potresti trovare qualche nuovo campo. + Si può farlo andando in Impostazioni -> Gestisci i campi mostrati. Qui si possono selezionare i campi che saranno visibili, alcuni sono disabilitati in maniera predefinita, quindi si possono trovare campi aggiuntivi. Un\'applicazioni contatti per gestire i propri contatti senza pubblicità. - Una semplice applicazione per creare o gestire i propri contatti da qualsiasi provenienza. I contatti saranno salvati solamente nel dispositivo, ma possono essere sincronizzati con Google, o con altri servizi. Si possono visualizzare i contatti preferiti in una list separata. + Una semplice applicazione per creare o gestire i propri contatti di qualsiasi tipo. I contatti saranno salvati nel dispositivo, ma possono essere eventualmente sincronizzati con Google o con altri servizi. Si possono visualizzare i contatti preferiti in una lista separata. - Si può utilizzare l\'applicazione anche per gestire le email e gli eventi. Può ordinare e filtrare per parametri multipli, ed opzionalmente visualizzare il cognome come nome + Si può utilizzare l\'applicazione anche per gestire l\'email e gli eventi. Si possono ordinare e filtrare per diversi criteri, opzionalmente si può visualizzare il cognome come nome. - Non contiene pubblicità nè chiede permessi non necessari. È completamente open source ed offre colori personalizzabili. + L\'applicazione non contiene pubblicità o permessi non necessari; è completamente opensource e la si può personalizzare con i propri colori preferiti. - Quest\'app fa parte di una serie più grande. Puoi trovare le altre su https://www.simplemobiletools.com + Questa è solamente una delle tante applicazioni della serie Simple Mobile Tools. Si possono trovare le altre su https://www.simplemobiletools.com 連絡先が見つかりません diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 38dc1ab2..d2359f17 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -19,6 +19,7 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number No contacts found diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 471adfb6..f0796ff2 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -19,6 +19,7 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number No contacts found diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d185d0fd..9c101b23 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -17,8 +17,9 @@ Pedir a permissão necessária Criar novo contacto Adicionar a contacto existente - You have to make this app the default dialer app to make use of blocked numbers. - Set to default + Tem que tornar esta a aplicação padrão para poder bloquear números. + Definir como padrão + Call number Não existem contactos @@ -104,7 +105,7 @@ Importar contactos de um ficheiro .vcf Exportar contactos para um ficheiro .vcf Destino da origem do contacto - Incluir fontes dos contactos + Incluir fonte dos contactos Nome do ficheiro (sem .vcf) @@ -137,12 +138,12 @@ Mensagem instantânea (IM) - Manage blocked numbers - You are not blocking anyone. - Add a blocked number - Block number - Block numbers - Blocked numbers + Gerir números bloqueados + Não existem números bloqueados + Adicionar um número a bloquear + Bloquear número + Bloquear números + Números bloqueados I want to change what fields are visible at contacts. Can I do it? diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2bbceacf..aec2596e 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -19,6 +19,7 @@ Добавить к существующему контакту Вы должны сделать \"Simple Contacts\" приложением по умолчанию для набора номера для использования блокировки номеров. Сделать по умолчанию + Call number Контакты не найдены diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 614febb0..45688330 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -19,6 +19,7 @@ Pridať k existujúcemu kontaktu Pre použitie blokovania čísel musíte nastaviť aplikáciu ako predvolenú pre správu hovorov. Nastaviť ako predvolenú + Zavolať číslo Nenašli sa žiadne kontakty diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 43dba3f3..d8962334 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -19,6 +19,7 @@ Lägg till i en befintlig kontakt You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number Inga kontakter hittades diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 15d9bf3d..346cea74 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -19,6 +19,7 @@ Mevcut bir kişiye ekle You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number Kişi bulunamadı diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 9be3d686..83e143a7 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -19,6 +19,7 @@ 添加至已存在的聯絡人 你必須將這應用程式設為預設的撥號程式來使用黑名單。 設為預設 + Call number 未發現聯絡人 diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 7cc00924..309ad8d7 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -13,6 +13,7 @@ Telegram + Changed the way contacts are fetched, please reset your filters. Added new options for toggling 24 hour time format and showing only contacts with phone numbers Added a simple dialpad, dialer will come soon diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index af52d0b9..b4d12bc0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,6 +19,7 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default + Call number No contacts found diff --git a/build.gradle b/build.gradle index 85c5b5af..266ccd46 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.10' + ext.kotlin_version = '1.3.11' repositories { google()