diff --git a/CHANGELOG.md b/CHANGELOG.md index cf703665..146e6931 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ Changelog ========== +Version 5.3.0 *(2020-05-31)* +---------------------------- + + * Try harder at fetching names at the Call Log + * Make subsequent calls from the same number at the call log optional + * Allow toggling name start with surname + * Show the other ends number at the call screen + * Some other UI and translation improvements + Version 5.2.2 *(2020-05-23)* ---------------------------- diff --git a/app/build.gradle b/app/build.gradle index b0156352..fda2e39e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "com.simplemobiletools.dialer" minSdkVersion 23 targetSdkVersion 29 - versionCode 9 - versionName "5.2.2" + versionCode 10 + versionName "5.3.0" setProperty("archivesBaseName", "dialer") } @@ -56,6 +56,6 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.28.21' + implementation 'com.simplemobiletools:commons:5.28.27' implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a' } diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/activities/CallActivity.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/activities/CallActivity.kt index 08cac7ad..5989de58 100644 --- a/app/src/main/kotlin/com/simplemobiletools/dialer/activities/CallActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/dialer/activities/CallActivity.kt @@ -190,6 +190,11 @@ class CallActivity : SimpleActivity() { } caller_name_label.text = if (callContact!!.name.isNotEmpty()) callContact!!.name else getString(R.string.unknown_caller) + if (callContact!!.number.isNotEmpty() && callContact!!.number != callContact!!.name) { + caller_number_label.text = callContact!!.number + } else { + caller_number_label.beGone() + } if (callContactAvatar != null) { caller_avatar.setImageBitmap(callContactAvatar) diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/activities/SettingsActivity.kt index 84b557a2..a1c4d66a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/dialer/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/dialer/activities/SettingsActivity.kt @@ -35,6 +35,8 @@ class SettingsActivity : SimpleActivity() { setupChangeDateTimeFormat() setupFontSize() setupDefaultTab() + setupGroupSubsequentCalls() + setupStartNameWithSurname() updateTextColors(settings_holder) invalidateOptionsMenu() } @@ -123,4 +125,20 @@ class SettingsActivity : SimpleActivity() { TAB_CALL_HISTORY -> R.string.call_history_tab else -> R.string.last_used_tab }) + + private fun setupGroupSubsequentCalls() { + settings_group_subsequent_calls.isChecked = config.groupSubsequentCalls + settings_group_subsequent_calls_holder.setOnClickListener { + settings_group_subsequent_calls.toggle() + config.groupSubsequentCalls = settings_group_subsequent_calls.isChecked + } + } + + private fun setupStartNameWithSurname() { + settings_start_with_surname.isChecked = config.startNameWithSurname + settings_start_with_surname_holder.setOnClickListener { + settings_start_with_surname.toggle() + config.startNameWithSurname = settings_start_with_surname.isChecked + } + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/Config.kt index 12042116..db34d935 100644 --- a/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/Config.kt @@ -35,4 +35,8 @@ class Config(context: Context) : BaseConfig(context) { } fun getCustomSIM(number: String) = prefs.getString(REMEMBER_SIM_PREFIX + number, "") + + var groupSubsequentCalls: Boolean + get() = prefs.getBoolean(GROUP_SUBSEQUENT_CALLS, true) + set(groupSubsequentCalls) = prefs.edit().putBoolean(GROUP_SUBSEQUENT_CALLS, groupSubsequentCalls).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/Constants.kt index 16dcd003..63a42763 100644 --- a/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/Constants.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.dialer.helpers // shared prefs const val SPEED_DIAL = "speed_dial" const val REMEMBER_SIM_PREFIX = "remember_sim_" +const val GROUP_SUBSEQUENT_CALLS = "group_subsequent_calls" const val CONTACTS_TAB_MASK = 1 const val FAVORITES_TAB_MASK = 2 diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/RecentsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/RecentsHelper.kt index 0bb73e0d..3b9b3575 100644 --- a/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/RecentsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/RecentsHelper.kt @@ -4,76 +4,110 @@ import android.annotation.SuppressLint import android.content.Context import android.provider.CallLog.Calls import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALL_LOG -import com.simplemobiletools.commons.helpers.ensureBackgroundThread -import com.simplemobiletools.commons.helpers.getQuestionMarks +import com.simplemobiletools.commons.helpers.* +import com.simplemobiletools.commons.models.SimpleContact import com.simplemobiletools.dialer.extensions.config import com.simplemobiletools.dialer.extensions.getAvailableSIMCardLabels import com.simplemobiletools.dialer.models.RecentCall class RecentsHelper(private val context: Context) { + private val COMPARABLE_PHONE_NUMBER_LENGTH = 9 + @SuppressLint("MissingPermission") fun getRecentCalls(callback: (ArrayList) -> Unit) { + val privateCursor = context.getMyContactsContentProviderCursorLoader().loadInBackground() ensureBackgroundThread { - var recentCalls = ArrayList() if (!context.hasPermission(PERMISSION_READ_CALL_LOG)) { - callback(recentCalls) + callback(ArrayList()) return@ensureBackgroundThread } - val uri = Calls.CONTENT_URI - val projection = arrayOf( - Calls._ID, - Calls.NUMBER, - Calls.CACHED_NAME, - Calls.CACHED_PHOTO_URI, - Calls.DATE, - Calls.DURATION, - Calls.TYPE, - "phone_account_address" - ) - - val numberToSimIDMap = HashMap() - context.getAvailableSIMCardLabels().forEach { - numberToSimIDMap[it.phoneNumber] = it.id - } - - val sortOrder = "${Calls._ID} DESC LIMIT 100" - - var previousRecentCallFrom = "" - context.queryCursor(uri, projection, sortOrder = sortOrder, showErrors = true) { cursor -> - val id = cursor.getIntValue(Calls._ID) - val number = cursor.getStringValue(Calls.NUMBER) - var name = cursor.getStringValue(Calls.CACHED_NAME) - if (name == null || name.isEmpty()) { - name = number + SimpleContactsHelper(context).getAvailableContacts(false) { contacts -> + val privateContacts = MyContactsContentProvider.getSimpleContacts(context, privateCursor) + if (privateContacts.isNotEmpty()) { + contacts.addAll(privateContacts) } - val photoUri = cursor.getStringValue(Calls.CACHED_PHOTO_URI) ?: "" - val startTS = (cursor.getLongValue(Calls.DATE) / 1000L).toInt() - val duration = cursor.getIntValue(Calls.DURATION) - val type = cursor.getIntValue(Calls.TYPE) - val accountAddress = cursor.getStringValue("phone_account_address") - val simID = numberToSimIDMap[accountAddress] ?: 1 - val neighbourIDs = ArrayList() - val recentCall = RecentCall(id, number, name, photoUri, startTS, duration, type, neighbourIDs, simID) - - // if we have 3 missed calls from the same number, show it just once - if ("$number$name" != previousRecentCallFrom) { - recentCalls.add(recentCall) - } else { - recentCalls.lastOrNull()?.neighbourIDs?.add(id) - } - - previousRecentCallFrom = "$number$name" + getRecents(contacts, callback) } - - val blockedNumbers = context.getBlockedNumbers() - recentCalls = recentCalls.filter { !context.isNumberBlocked(it.phoneNumber, blockedNumbers) }.toMutableList() as ArrayList - callback(recentCalls) } } + private fun getRecents(contacts: ArrayList, callback: (ArrayList) -> Unit) { + var recentCalls = ArrayList() + var previousRecentCallFrom = "" + val contactsNumbersMap = HashMap() + val groupSubsequentCalls = context.config.groupSubsequentCalls + val uri = Calls.CONTENT_URI + val projection = arrayOf( + Calls._ID, + Calls.NUMBER, + Calls.CACHED_NAME, + Calls.CACHED_PHOTO_URI, + Calls.DATE, + Calls.DURATION, + Calls.TYPE, + "phone_account_address" + ) + + val numberToSimIDMap = HashMap() + context.getAvailableSIMCardLabels().forEach { + numberToSimIDMap[it.phoneNumber] = it.id + } + + val sortOrder = "${Calls._ID} DESC LIMIT 100" + context.queryCursor(uri, projection, sortOrder = sortOrder, showErrors = true) { cursor -> + val id = cursor.getIntValue(Calls._ID) + val number = cursor.getStringValue(Calls.NUMBER) + var name = cursor.getStringValue(Calls.CACHED_NAME) + if (name == null || name.isEmpty()) { + name = number + } + + if (name == number) { + if (contactsNumbersMap.containsKey(number)) { + name = contactsNumbersMap[number]!! + } else { + val normalizedNumber = number.normalizePhoneNumber() + if (normalizedNumber!!.length >= COMPARABLE_PHONE_NUMBER_LENGTH) { + name = contacts.firstOrNull { contact -> + val curNumber = contact.phoneNumber.normalizePhoneNumber() + if (curNumber!!.length >= COMPARABLE_PHONE_NUMBER_LENGTH) { + if (curNumber.substring(curNumber.length - COMPARABLE_PHONE_NUMBER_LENGTH) == normalizedNumber.substring(normalizedNumber.length - COMPARABLE_PHONE_NUMBER_LENGTH)) { + contactsNumbersMap[number] = contact.name + return@firstOrNull true + } + } + false + }?.name ?: number + } + } + } + + val photoUri = cursor.getStringValue(Calls.CACHED_PHOTO_URI) ?: "" + val startTS = (cursor.getLongValue(Calls.DATE) / 1000L).toInt() + val duration = cursor.getIntValue(Calls.DURATION) + val type = cursor.getIntValue(Calls.TYPE) + val accountAddress = cursor.getStringValue("phone_account_address") + val simID = numberToSimIDMap[accountAddress] ?: 1 + val neighbourIDs = ArrayList() + val recentCall = RecentCall(id, number, name, photoUri, startTS, duration, type, neighbourIDs, simID) + + // if we have multiple missed calls from the same number, show it just once + if (!groupSubsequentCalls || "$number$name" != previousRecentCallFrom) { + recentCalls.add(recentCall) + } else { + recentCalls.lastOrNull()?.neighbourIDs?.add(id) + } + + previousRecentCallFrom = "$number$name" + } + + val blockedNumbers = context.getBlockedNumbers() + recentCalls = recentCalls.filter { !context.isNumberBlocked(it.phoneNumber, blockedNumbers) }.toMutableList() as ArrayList + callback(recentCalls) + } + @SuppressLint("MissingPermission") fun removeRecentCalls(ids: ArrayList, callback: () -> Unit) { ensureBackgroundThread { diff --git a/app/src/main/res/layout/activity_call.xml b/app/src/main/res/layout/activity_call.xml index 1b7cf4d1..6cd89d7b 100644 --- a/app/src/main/res/layout/activity_call.xml +++ b/app/src/main/res/layout/activity_call.xml @@ -30,6 +30,18 @@ app:layout_constraintTop_toBottomOf="@+id/caller_avatar" tools:text="Caller name" /> + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/dialpad.xml b/app/src/main/res/layout/dialpad.xml index e6235d65..28561ddf 100644 --- a/app/src/main/res/layout/dialpad.xml +++ b/app/src/main/res/layout/dialpad.xml @@ -7,7 +7,6 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:focusableInTouchMode="true" - android:paddingBottom="@dimen/normal_margin" tools:ignore="HardcodedText"> Kurzwahlnummern verwalten klicke auf eine Zahl um einen Kontakt zuzuweisen. Danach kannst du den Kontakt schnell durch langes drücken der entsprechenden Zahl anrufen + + Group subsequent calls with the same number at the call log + Schlichtes Telefon diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 80bfcc47..f352e697 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -32,6 +32,9 @@ Διαχείριση ταχείας κλήσης Κάντε κλικ σε έναν αριθμό για να αντιστοιχίσετε μια επαφή σε αυτόν. Στη συνέχεια, μπορείτε να καλέσετε γρήγορα τη δεδομένη επαφή πατώντας τον αριθμό αυτόν. + + Group subsequent calls with the same number at the call log + Απλή κλήση - Διαχειριστείτε εύκολα τις κλήσεις σας diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 20bd5036..8a3f9b4f 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -32,6 +32,9 @@ Snelkiezer bewerken Klik op een cijfer om er een contact aan te koppelen. Vervolgens kan deze persoon direct gebeld worden door in de kiezer lang op het gekoppelde cijfer te drukken. + + Oproepgeschiedenis: opeenvolgende items van hetzelfde nummer groeperen + Eenvoudige Telefoon - Beheer gesprekken met gemak diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index a9ddbcd8..52c60d18 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -32,6 +32,9 @@ Gerir ligações rápidas Clique no número para atribuir um contacto à ligação rápida. Posteriormente, poderá ligar diretamente ao contacto através da tecla de ligação rápida. + + Group subsequent calls with the same number at the call log + Simple Dialer - Gestão de chamadas diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 151bdd7e..9cb6589a 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -32,6 +32,9 @@ Spravovať rýchle vytáčanie Pre priradenie kontaktu kliknite na číslo. Následne viete daný kontakt rýchlo vytočiť dlhým podržaním čísla na číselníku. + + Zoskupiť susedné volania s rovnakým číslom v histórií volaní + Jednoduchý telefón - Spravujte hovory jednoducho diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 1b4e284d..d7ed565c 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -32,6 +32,9 @@ 管理快速拨号 点击一个数字来分配一个联系人。之后你可以在拨号盘长按指定的号码来快速呼叫指定的联系人。 + + Group subsequent calls with the same number at the call log + 简易拨号器 - 轻松管理你的手机通话 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d4c35a65..449b6ed8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -32,6 +32,9 @@ Manage speed dial Click on a number to assign a contact to it. You can then quickly call the given contact by long pressing the given number at the dialer. + + Group subsequent calls with the same number at the call log + Simple Dialer - Manage your phone calls easily diff --git a/fastlane/metadata/android/en-US/changelogs/10.txt b/fastlane/metadata/android/en-US/changelogs/10.txt new file mode 100644 index 00000000..62fb1182 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/10.txt @@ -0,0 +1,5 @@ + * Try harder at fetching names at the Call Log + * Make subsequent calls from the same number at the call log optional + * Allow toggling name start with surname + * Show the other ends number at the call screen + * Some other UI and translation improvements diff --git a/fastlane/metadata/android/zh-rCN/full_description.txt b/fastlane/metadata/android/zh-rCN/full_description.txt new file mode 100644 index 00000000..b9422db9 --- /dev/null +++ b/fastlane/metadata/android/zh-rCN/full_description.txt @@ -0,0 +1,22 @@ +A lightweight app for handling your calls, no matter where are you. Comes with a handy call log for easy call initiation. + +There is a quick dialpad at your service too, with smart contact suggestions. It supports letters too. + +You can easily block phone numbers to avoid unwanted incoming calls. + +Supported Speed dialing makes calling your favorite contacts with this true phone a breeze. + +To help you manage your calls quickly the Phone app also supports favorite contacts and creating shortcuts of any contact on the home screen. + +It comes with material design and dark theme by default, provides great user experience for easy usage. The lack of internet access gives you more privacy, security and stability than other apps. + +不包含广告及非必要的权限,而且完全开放源代码,并提供自定义颜色。 + +于此查看简易工具系列全套: +https://www.simplemobiletools.com + +Facebook: +https://www.facebook.com/simplemobiletools + +Reddit: +https://www.reddit.com/r/SimpleMobileTools diff --git a/fastlane/metadata/android/zh-rCN/short_description.txt b/fastlane/metadata/android/zh-rCN/short_description.txt new file mode 100644 index 00000000..23fbcb4a --- /dev/null +++ b/fastlane/metadata/android/zh-rCN/short_description.txt @@ -0,0 +1 @@ +易于上手的通话管理器,包含电话本、号码阻止和多 SIM 卡支持 diff --git a/fastlane/metadata/android/zh-rCN/title.txt b/fastlane/metadata/android/zh-rCN/title.txt new file mode 100644 index 00000000..71deb16a --- /dev/null +++ b/fastlane/metadata/android/zh-rCN/title.txt @@ -0,0 +1 @@ +简易拨号器 - 轻松管理你的手机通话