Merge pull request #1 from SimpleMobileTools/master

Update from upstream
This commit is contained in:
Tommy He
2020-05-31 20:14:45 +08:00
committed by GitHub
21 changed files with 235 additions and 57 deletions

View File

@@ -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)*
----------------------------

View File

@@ -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'
}

View File

@@ -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)

View File

@@ -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
}
}
}

View File

@@ -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()
}

View File

@@ -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

View File

@@ -4,23 +4,40 @@ 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<RecentCall>) -> Unit) {
val privateCursor = context.getMyContactsContentProviderCursorLoader().loadInBackground()
ensureBackgroundThread {
var recentCalls = ArrayList<RecentCall>()
if (!context.hasPermission(PERMISSION_READ_CALL_LOG)) {
callback(recentCalls)
callback(ArrayList())
return@ensureBackgroundThread
}
SimpleContactsHelper(context).getAvailableContacts(false) { contacts ->
val privateContacts = MyContactsContentProvider.getSimpleContacts(context, privateCursor)
if (privateContacts.isNotEmpty()) {
contacts.addAll(privateContacts)
}
getRecents(contacts, callback)
}
}
}
private fun getRecents(contacts: ArrayList<SimpleContact>, callback: (ArrayList<RecentCall>) -> Unit) {
var recentCalls = ArrayList<RecentCall>()
var previousRecentCallFrom = ""
val contactsNumbersMap = HashMap<String, String>()
val groupSubsequentCalls = context.config.groupSubsequentCalls
val uri = Calls.CONTENT_URI
val projection = arrayOf(
Calls._ID,
@@ -39,8 +56,6 @@ class RecentsHelper(private val context: Context) {
}
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)
@@ -49,6 +64,26 @@ class RecentsHelper(private val context: Context) {
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)
@@ -58,8 +93,8 @@ class RecentsHelper(private val context: Context) {
val neighbourIDs = ArrayList<Int>()
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) {
// 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)
@@ -72,7 +107,6 @@ class RecentsHelper(private val context: Context) {
recentCalls = recentCalls.filter { !context.isNumberBlocked(it.phoneNumber, blockedNumbers) }.toMutableList() as ArrayList<RecentCall>
callback(recentCalls)
}
}
@SuppressLint("MissingPermission")
fun removeRecentCalls(ids: ArrayList<Int>, callback: () -> Unit) {

View File

@@ -30,6 +30,18 @@
app:layout_constraintTop_toBottomOf="@+id/caller_avatar"
tools:text="Caller name" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/caller_number_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/normal_margin"
android:gravity="center_horizontal"
android:textSize="@dimen/call_status_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/caller_name_label"
tools:text="0912 345 678" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/call_status_label"
android:layout_width="wrap_content"
@@ -39,7 +51,7 @@
android:textSize="@dimen/call_status_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/caller_name_label"
app:layout_constraintTop_toBottomOf="@+id/caller_number_label"
tools:text="Is Calling" />
<ImageView

View File

@@ -181,5 +181,51 @@
android:clickable="false" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_group_subsequent_calls_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_group_subsequent_calls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:text="@string/group_subsequent_calls"
app:switchPadding="@dimen/medium_margin" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_start_with_surname_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_start_with_surname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:text="@string/start_name_with_surname"
app:switchPadding="@dimen/medium_margin" />
</RelativeLayout>
</LinearLayout>
</ScrollView>

View File

@@ -7,7 +7,6 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:focusableInTouchMode="true"
android:paddingBottom="@dimen/normal_margin"
tools:ignore="HardcodedText">
<com.simplemobiletools.commons.views.MyTextView

View File

@@ -32,6 +32,9 @@
<string name="manage_speed_dial">Kurzwahlnummern verwalten</string>
<string name="speed_dial_label">klicke auf eine Zahl um einen Kontakt zuzuweisen. Danach kannst du den Kontakt schnell durch langes drücken der entsprechenden Zahl anrufen</string>
<!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->
<string name="app_title">Schlichtes Telefon</string>

View File

@@ -32,6 +32,9 @@
<string name="manage_speed_dial">Διαχείριση ταχείας κλήσης</string>
<string name="speed_dial_label">Κάντε κλικ σε έναν αριθμό για να αντιστοιχίσετε μια επαφή σε αυτόν. Στη συνέχεια, μπορείτε να καλέσετε γρήγορα τη δεδομένη επαφή πατώντας τον αριθμό αυτόν.</string>
<!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->
<string name="app_title">Απλή κλήση - Διαχειριστείτε εύκολα τις κλήσεις σας</string>

View File

@@ -32,6 +32,9 @@
<string name="manage_speed_dial">Snelkiezer bewerken</string>
<string name="speed_dial_label">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.</string>
<!-- Settings -->
<string name="group_subsequent_calls">Oproepgeschiedenis: opeenvolgende items van hetzelfde nummer groeperen</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->
<string name="app_title">Eenvoudige Telefoon - Beheer gesprekken met gemak</string>

View File

@@ -32,6 +32,9 @@
<string name="manage_speed_dial">Gerir ligações rápidas</string>
<string name="speed_dial_label">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.</string>
<!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->
<string name="app_title">Simple Dialer - Gestão de chamadas</string>

View File

@@ -32,6 +32,9 @@
<string name="manage_speed_dial">Spravovať rýchle vytáčanie</string>
<string name="speed_dial_label">Pre priradenie kontaktu kliknite na číslo. Následne viete daný kontakt rýchlo vytočiť dlhým podržaním čísla na číselníku.</string>
<!-- Settings -->
<string name="group_subsequent_calls">Zoskupiť susedné volania s rovnakým číslom v histórií volaní</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->
<string name="app_title">Jednoduchý telefón - Spravujte hovory jednoducho</string>

View File

@@ -32,6 +32,9 @@
<string name="manage_speed_dial">管理快速拨号</string>
<string name="speed_dial_label">点击一个数字来分配一个联系人。之后你可以在拨号盘长按指定的号码来快速呼叫指定的联系人。</string>
<!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->
<string name="app_title">简易拨号器 - 轻松管理你的手机通话</string>

View File

@@ -32,6 +32,9 @@
<string name="manage_speed_dial">Manage speed dial</string>
<string name="speed_dial_label">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.</string>
<!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->
<string name="app_title">Simple Dialer - Manage your phone calls easily</string>

View File

@@ -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

View File

@@ -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.
不包含广告及非必要的权限,而且完全开放源代码,并提供自定义颜色。
<b>于此查看简易工具系列全套:</b>
https://www.simplemobiletools.com
<b>Facebook:</b>
https://www.facebook.com/simplemobiletools
<b>Reddit:</b>
https://www.reddit.com/r/SimpleMobileTools

View File

@@ -0,0 +1 @@
易于上手的通话管理器,包含电话本、号码阻止和多 SIM 卡支持

View File

@@ -0,0 +1 @@
简易拨号器 - 轻松管理你的手机通话