Merge branch 'master' into fix-186

This commit is contained in:
Naveen Singh
2025-01-12 18:44:27 +05:30
committed by GitHub
5 changed files with 29 additions and 6 deletions

View File

@@ -117,7 +117,7 @@ class CallActivity : SimpleActivity() {
val callState = CallManager.getState()
if (callState == Call.STATE_CONNECTING || callState == Call.STATE_DIALING) {
endCall()
toast(R.string.call_is_being_connected)
}
}

View File

@@ -271,8 +271,10 @@ class DialpadActivity : SimpleActivity() {
(binding.dialpadList.adapter as? ContactsAdapter)?.finishActMode()
val filtered = allContacts.filter {
var convertedName = PhoneNumberUtils.convertKeypadLettersToDigits(it.name.normalizeString())
val filtered = allContacts.filter { contact ->
var convertedName = PhoneNumberUtils.convertKeypadLettersToDigits(
contact.name.normalizeString()
).filterNot { it.isWhitespace() }
if (hasRussianLocale) {
var currConvertedName = ""
@@ -283,7 +285,7 @@ class DialpadActivity : SimpleActivity() {
convertedName = currConvertedName
}
it.doesContainPhoneNumber(text) || (convertedName.contains(text, true))
contact.doesContainPhoneNumber(text) || (convertedName.contains(text, true))
}.sortedWith(compareBy {
!it.doesContainPhoneNumber(text)
}).toMutableList() as ArrayList<Contact>

View File

@@ -557,6 +557,7 @@ class MainActivity : SimpleActivity() {
val faqItems = arrayListOf(
FAQItem(R.string.faq_1_title, R.string.faq_1_text),
FAQItem(R.string.faq_2_title, R.string.faq_2_text),
FAQItem(R.string.faq_9_title_commons, R.string.faq_9_text_commons)
)

View File

@@ -5,6 +5,7 @@ import android.content.Intent
import android.content.pm.ShortcutInfo
import android.graphics.drawable.Icon
import android.net.Uri
import android.telephony.PhoneNumberUtils
import android.text.TextUtils
import android.util.TypedValue
import android.view.*
@@ -364,11 +365,26 @@ class ContactsAdapter(
setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize)
val name = contact.getNameToDisplay()
text = if (textToHighlight.isEmpty()) name else {
text = if (textToHighlight.isEmpty()) {
name
} else {
if (name.contains(textToHighlight, true)) {
name.highlightTextPart(textToHighlight, properPrimaryColor)
} else {
name.highlightTextFromNumbers(textToHighlight, properPrimaryColor)
var spacedTextToHighlight = textToHighlight
val strippedName = name.filterNot { it.isWhitespace() }
val strippedDigits = PhoneNumberUtils.convertKeypadLettersToDigits(strippedName)
val startIndex = strippedDigits.indexOf(textToHighlight)
if (strippedDigits.contains(textToHighlight)) {
for (i in 0..spacedTextToHighlight.length) {
if (name[startIndex + i].isWhitespace()) {
spacedTextToHighlight = spacedTextToHighlight.replaceRange(i, i, " ")
}
}
}
name.highlightTextFromNumbers(spacedTextToHighlight, properPrimaryColor)
}
}
}

View File

@@ -64,6 +64,7 @@
<string name="audio_route_wired_or_earpiece">Wired or Earpiece</string>
<string name="choose_audio_route">Choose audio route</string>
<string name="calling_blocked_number">The number you are calling is blocked</string>
<string name="call_is_being_connected">Your call is being connected…</string>
<!-- Speed dial -->
<string name="speed_dial">Speed dial</string>
@@ -84,6 +85,9 @@
<string name="faq_1_title">I hear incoming calls, but the screen doesn\'t turn on. What can I do?</string>
<string name="faq_1_text">Such issues can have many device and system specific reasons, hard to say in general. You should look around in your device settings and make sure that the app is allowed to pop up when in background and allow displaying over other apps.</string>
<string name="faq_2_title">Why emergency calls don\'t work properly?</string>
<string name="faq_2_text">Due to system restrictions, emergency calls can only be made through your system\'s default dialer or phone app. To ensure emergency calls work properly, you need to keep the system app installed and enabled.</string>
<!--
Haven't found some strings? There's more at
https://github.com/FossifyOrg/Commons/tree/master/commons/src/main/res