Merge pull request #361 from Naveen3Singh/address_space_glitch
Fix address separator glitch
This commit is contained in:
commit
4a3520553f
|
@ -65,7 +65,7 @@ dependencies {
|
|||
implementation 'com.github.SimpleMobileTools:Simple-Commons:faa6a972c2'
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
||||
implementation 'com.github.tibbi:android-smsmms:9162ca7456'
|
||||
implementation 'com.github.tibbi:android-smsmms:a9ca153fbf'
|
||||
implementation "me.leolin:ShortcutBadger:1.1.22"
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
|
||||
|
|
|
@ -61,15 +61,14 @@ class NewConversationActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
fetchContacts()
|
||||
new_conversation_address.onTextChangeListener {
|
||||
val searchString = it
|
||||
new_conversation_address.onTextChangeListener { searchString ->
|
||||
val filteredContacts = ArrayList<SimpleContact>()
|
||||
allContacts.forEach {
|
||||
if (it.phoneNumbers.any { it.normalizedNumber.contains(searchString, true) } ||
|
||||
it.name.contains(searchString, true) ||
|
||||
it.name.contains(searchString.normalizeString(), true) ||
|
||||
it.name.normalizeString().contains(searchString, true)) {
|
||||
filteredContacts.add(it)
|
||||
allContacts.forEach { contact ->
|
||||
if (contact.phoneNumbers.any { it.normalizedNumber.contains(searchString, true) } ||
|
||||
contact.name.contains(searchString, true) ||
|
||||
contact.name.contains(searchString.normalizeString(), true) ||
|
||||
contact.name.normalizeString().contains(searchString, true)) {
|
||||
filteredContacts.add(contact)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -432,8 +432,8 @@ class ThreadActivity : SimpleActivity() {
|
|||
thread_add_contacts.beGone()
|
||||
|
||||
val numbers = HashSet<String>()
|
||||
participants.forEach {
|
||||
it.phoneNumbers.forEach {
|
||||
participants.forEach { contact ->
|
||||
contact.phoneNumbers.forEach {
|
||||
numbers.add(it.normalizedNumber)
|
||||
}
|
||||
}
|
||||
|
@ -465,8 +465,8 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun setupAttachmentSizes() {
|
||||
messages.filter { it.attachment != null }.forEach {
|
||||
it.attachment!!.attachments.forEach {
|
||||
messages.filter { it.attachment != null }.forEach { message ->
|
||||
message.attachment!!.attachments.forEach {
|
||||
try {
|
||||
if (it.mimetype.startsWith("image/")) {
|
||||
val fileOptions = BitmapFactory.Options()
|
||||
|
@ -527,8 +527,8 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
val numbers = ArrayList<String>()
|
||||
participants.forEach {
|
||||
it.phoneNumbers.forEach {
|
||||
participants.forEach { contact ->
|
||||
contact.phoneNumbers.forEach {
|
||||
numbers.add(it.normalizedNumber)
|
||||
}
|
||||
}
|
||||
|
@ -612,8 +612,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
val properPrimaryColor = getProperPrimaryColor()
|
||||
|
||||
val views = ArrayList<View>()
|
||||
participants.forEach {
|
||||
val contact = it
|
||||
participants.forEach { contact ->
|
||||
layoutInflater.inflate(R.layout.item_selected_contact, null).apply {
|
||||
val selectedContactBg = resources.getDrawable(R.drawable.item_selected_contact_background)
|
||||
(selectedContactBg as LayerDrawable).findDrawableByLayerId(R.id.selected_contact_bg).applyColorFilter(properPrimaryColor)
|
||||
|
@ -843,8 +842,8 @@ class ThreadActivity : SimpleActivity() {
|
|||
msg = removeDiacriticsIfNeeded(msg)
|
||||
|
||||
val numbers = ArrayList<String>()
|
||||
participants.forEach {
|
||||
it.phoneNumbers.forEach {
|
||||
participants.forEach { contact ->
|
||||
contact.phoneNumbers.forEach {
|
||||
numbers.add(it.normalizedNumber)
|
||||
}
|
||||
}
|
||||
|
@ -1047,7 +1046,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
messages.filter { !it.isReceivedMessage() && it.id > lastMaxId }.forEach { latestMessage ->
|
||||
// subscriptionIds seem to be not filled out at sending with multiple SIM cards, so fill it manually
|
||||
if (SubscriptionManager.from(this).activeSubscriptionInfoList?.size ?: 0 > 1) {
|
||||
if ((SubscriptionManager.from(this).activeSubscriptionInfoList?.size ?: 0) > 1) {
|
||||
val SIMId = availableSIMCards.getOrNull(currentSIMCardIndex)?.subscriptionId
|
||||
if (SIMId != null) {
|
||||
updateMessageSubscriptionId(latestMessage.id, SIMId)
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.text.TextUtils
|
|||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.RemoteInput
|
||||
import com.klinker.android.send_message.Settings
|
||||
import com.klinker.android.send_message.Transaction.getAddressSeparator
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.PhoneNumber
|
||||
|
@ -104,7 +105,7 @@ fun Context.getMessages(threadId: Long, getImageResolutions: Boolean, dateFrom:
|
|||
val thread = cursor.getLongValue(Sms.THREAD_ID)
|
||||
val subscriptionId = cursor.getIntValue(Sms.SUBSCRIPTION_ID)
|
||||
val status = cursor.getIntValue(Sms.STATUS)
|
||||
val participants = senderNumber.split(" ").map { number ->
|
||||
val participants = senderNumber.split(getAddressSeparator().toRegex()).map { number ->
|
||||
val phoneNumber = PhoneNumber(number, 0, "", number)
|
||||
val participantPhoto = getNameAndPhotoFromPhoneNumber(number)
|
||||
SimpleContact(0, 0, participantPhoto.name, photoUri, arrayListOf(phoneNumber), ArrayList(), ArrayList())
|
||||
|
@ -813,7 +814,12 @@ fun Context.showMessageNotification(address: String, body: String, threadId: Lon
|
|||
notificationManager.notify(threadId.hashCode(), builder.build())
|
||||
}
|
||||
|
||||
private fun Context.getMessagesStyle(notificationManager: NotificationManager, threadId: Long, sender: String, body: String): NotificationCompat.MessagingStyle {
|
||||
private fun Context.getMessagesStyle(
|
||||
notificationManager: NotificationManager,
|
||||
threadId: Long,
|
||||
sender: String,
|
||||
body: String
|
||||
): NotificationCompat.MessagingStyle {
|
||||
val oldMessages = getOldMessages(notificationManager, threadId)
|
||||
val messages = NotificationCompat.MessagingStyle(getString(R.string.me))
|
||||
oldMessages.forEach {
|
||||
|
|
|
@ -27,7 +27,7 @@ class DirectReplyReceiver : BroadcastReceiver() {
|
|||
val settings = context.getSendMessageSettings()
|
||||
if (address != null) {
|
||||
val availableSIMs = SubscriptionManager.from(context).activeSubscriptionInfoList
|
||||
if (availableSIMs?.size ?: 0 > 1) {
|
||||
if ((availableSIMs?.size ?: 0) > 1) {
|
||||
val currentSIMCardIndex = context.config.getUseSIMIdAtNumber(address)
|
||||
val wantedId = availableSIMs.getOrNull(currentSIMCardIndex)
|
||||
if (wantedId != null) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.simplemobiletools.smsmessenger.R
|
|||
import com.simplemobiletools.smsmessenger.extensions.*
|
||||
import com.simplemobiletools.smsmessenger.helpers.refreshMessages
|
||||
import com.simplemobiletools.smsmessenger.models.Message
|
||||
import kotlin.math.min
|
||||
|
||||
class SmsReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
|
@ -42,7 +43,7 @@ class SmsReceiver : BroadcastReceiver() {
|
|||
subject = it.pseudoSubject
|
||||
status = it.status
|
||||
body += it.messageBody
|
||||
date = Math.min(it.timestampMillis, System.currentTimeMillis())
|
||||
date = min(it.timestampMillis, System.currentTimeMillis())
|
||||
threadId = context.getThreadId(address)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue