Merge branch 'master' into feature/downsize-big-images

This commit is contained in:
Tibor Kaputa 2022-02-03 10:07:24 +01:00 committed by GitHub
commit d39dea0f78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 89 additions and 72 deletions

View File

@ -10,6 +10,7 @@ import android.media.MediaMetadataRetriever
import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.provider.ContactsContract
import android.provider.Telephony
import android.telephony.SubscriptionManager
import android.text.TextUtils
@ -231,6 +232,8 @@ class ThreadActivity : SimpleActivity() {
private fun setupThread() {
val privateCursor = getMyContactsCursor(false, true)?.loadInBackground()
ensureBackgroundThread {
privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
val cachedMessagesCode = messages.clone().hashCode()
messages = getMessages(threadId)
@ -240,6 +243,7 @@ class ThreadActivity : SimpleActivity() {
try {
if (participants.isNotEmpty() && messages.hashCode() == cachedMessagesCode && !hasParticipantWithoutName) {
setupAdapter()
return@ensureBackgroundThread
}
} catch (ignored: Exception) {
@ -248,7 +252,6 @@ class ThreadActivity : SimpleActivity() {
setupParticipants()
// check if no participant came from a privately stored contact in Simple Contacts
privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
if (privateContacts.isNotEmpty()) {
val senderNumbersToReplace = HashMap<String, String>()
participants.filter { it.doesHavePhoneNumber(it.name) }.forEach { participant ->
@ -903,6 +906,31 @@ class ThreadActivity : SimpleActivity() {
return participants
}
fun startContactDetailsIntent(contact: SimpleContact) {
val simpleContacts = "com.simplemobiletools.contacts.pro"
val simpleContactsDebug = "com.simplemobiletools.contacts.pro.debug"
if (contact.rawId > 1000000 && contact.contactId > 1000000 && contact.rawId == contact.contactId &&
(isPackageInstalled(simpleContacts) || isPackageInstalled(simpleContactsDebug))
) {
Intent().apply {
action = Intent.ACTION_VIEW
putExtra(CONTACT_ID, contact.rawId)
putExtra(IS_PRIVATE, true)
`package` = if (isPackageInstalled(simpleContacts)) simpleContacts else simpleContactsDebug
setDataAndType(ContactsContract.Contacts.CONTENT_LOOKUP_URI, "vnd.android.cursor.dir/person")
launchActivityIntent(this)
}
} else {
ensureBackgroundThread {
val lookupKey = SimpleContactsHelper(this).getContactLookupKey((contact).rawId.toString())
val publicUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey)
runOnUiThread {
launchViewContactIntent(publicUri)
}
}
}
}
fun saveMMS(mimeType: String, path: String) {
lastAttachmentUri = path
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {

View File

@ -32,6 +32,7 @@ import com.simplemobiletools.smsmessenger.activities.SimpleActivity
import com.simplemobiletools.smsmessenger.activities.ThreadActivity
import com.simplemobiletools.smsmessenger.dialogs.SelectTextDialog
import com.simplemobiletools.smsmessenger.extensions.deleteMessage
import com.simplemobiletools.smsmessenger.extensions.getContactFromAddress
import com.simplemobiletools.smsmessenger.extensions.updateLastConversationMessage
import com.simplemobiletools.smsmessenger.helpers.*
import com.simplemobiletools.smsmessenger.models.*
@ -234,6 +235,14 @@ class ThreadAdapter(
if (message.isReceivedMessage()) {
thread_message_sender_photo.beVisible()
thread_message_sender_photo.setOnClickListener {
val contact = message.participants.first()
context.getContactFromAddress(contact.phoneNumbers.first()) {
if (it != null) {
(activity as ThreadActivity).startContactDetailsIntent(it)
}
}
}
thread_message_body.setTextColor(textColor)
thread_message_body.setLinkTextColor(context.getAdjustedPrimaryColor())

View File

@ -684,6 +684,20 @@ fun Context.getNameFromAddress(address: String, privateCursor: Cursor?): String
return sender
}
fun Context.getContactFromAddress(address: String, callback: ((contact: SimpleContact?) -> Unit)) {
val privateCursor = getMyContactsCursor(false, true)?.loadInBackground()
SimpleContactsHelper(this).getAvailableContacts(false) {
val contact = it.firstOrNull { it.doesHavePhoneNumber(address) }
if (contact == null) {
val privateContacts = MyContactsContentProvider.getSimpleContacts(this, privateCursor)
val privateContact = privateContacts.firstOrNull { it.doesHavePhoneNumber(address) }
callback(privateContact)
} else {
callback(contact)
}
}
}
@SuppressLint("NewApi")
fun Context.showMessageNotification(address: String, body: String, threadId: Long, bitmap: Bitmap?, sender: String) {
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

View File

@ -50,7 +50,7 @@
<string name="mms_file_size_limit">Größe gesendeter MMS-Bilder ändern</string>
<string name="mms_file_size_limit_none">Keine Begrenzung</string>
<string name="outgoing_messages">Ausgehende Nachrichten</string>
<string name="group_message_mms">Send group messages as MMS</string>
<string name="group_message_mms">Gruppennachrichten als MMS versenden</string>
<!-- Export / Import -->
<string name="messages">Nachrichten</string>
<string name="export_messages">Nachrichten exportieren</string>
@ -64,8 +64,8 @@
<string name="faq_1_title">Warum benötigt die Anwendung einen Internetzugang\?</string>
<string name="faq_1_text">Leider ist dies nötig, um MMS-Anhänge zu versenden. Es wäre ein großer Nachteil gegenüber anderen Apps, wenn keine MMS versendet werden könnten, also haben wir uns für diesen Weg entschieden.
Jedoch gibt es wie immer keine Werbung, Tracking oder Analytics, der Internetzugriff wird also nur für das Versenden von MMS verwendet.</string>
<string name="faq_2_title">The other end is not receiving my MMS, is there anything I can do about it?</string>
<string name="faq_2_text">MMS size is limited by carriers, you can try setting a smaller limit in the app settings.</string>
<string name="faq_2_title">Die Gegenseite empfängt meine MMS nicht. Kann ich etwas dagegen tun\?</string>
<string name="faq_2_text">Die MMS-Größe wird von den Netzbetreibern begrenzt. Sie können versuchen, in den Anwendungseinstellungen ein kleineres Limit einzustellen.</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">Einfacher SMS-Messenger Nachrichten einfach verwalten</string>
@ -76,4 +76,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View File

@ -17,7 +17,7 @@
<string name="sending">Γίνεται αποστολή…</string>
<string name="pin_conversation">Καρφίτσωμα στην κορυφή</string>
<string name="unpin_conversation">Ξεκαρφίτσωμα</string>
<string name="forward_message">Forward</string>
<string name="forward_message">Προώθηση</string>
<string name="compress_error">Unable to compress image to selected size</string>
<!-- New conversation -->
@ -54,25 +54,25 @@
<string name="use_simple_characters">Αφαίρεση τονισμών και διακριτικών κατά την αποστολή μηνυμάτων</string>
<string name="mms_file_size_limit">Αλλαγή μεγέθους απεσταλμένων εικόνων MMS</string>
<string name="mms_file_size_limit_none">Χωρίς όριο</string>
<string name="outgoing_messages">Outgoing messages</string>
<string name="group_message_mms">Send group messages as MMS</string>
<string name="outgoing_messages">Εξερχόμενα μηνύματα</string>
<string name="group_message_mms">Αποστολή ομαδικών μηνυμάτων ως MMS</string>
<!-- Export / Import -->
<string name="messages">Μηνύματα</string>
<string name="export_messages">Εξαγωγή μηνυμάτων</string>
<string name="export_sms">Export SMS</string>
<string name="export_mms">Export MMS</string>
<string name="export_sms">Εξαγωγή SMS</string>
<string name="export_mms">Εξαγωγή MMS</string>
<string name="import_messages">Εισαγωγή μηνυμάτων</string>
<string name="import_sms">Import SMS</string>
<string name="import_mms">Import MMS</string>
<string name="import_sms">Εισαγωγή SMS</string>
<string name="import_mms">Εισαγωγή MMS</string>
<string name="no_option_selected">Πρέπει να επιλέξετε τουλάχιστον ένα στοιχείο</string>
<!-- FAQ -->
<string name="faq_1_title">Γιατί η εφαρμογή απαιτεί πρόσβαση στο Internet;</string>
<string name="faq_1_text">Δυστυχώς, απαιτείται για την αποστολή συνημμένων MMS. Το να μην είμαστε σε θέση να στείλουμε MMS θα αποτελούσε πραγματικά τεράστιο μειονέκτημα σε σύγκριση με άλλες εφαρμογές, επομένως αποφασίσαμε να ακολουθήσουμε αυτόν τον δρόμο.
Ωστόσο, όπως συνήθως, δεν υπάρχουν καθόλου διαφημίσεις, παρακολούθηση ή αναλύσεις, το διαδίκτυο χρησιμοποιείται μόνο για την αποστολή MMS.</string>
<string name="faq_2_title">The other end is not receiving my MMS, is there anything I can do about it?</string>
<string name="faq_2_text">MMS size is limited by carriers, you can try setting a smaller limit in the app settings.</string>
<string name="faq_2_title">Το άλλο άκρο δεν λαμβάνει τα MMS μου, μπορώ να κάνω κάτι γι\' αυτό;</string>
<string name="faq_2_text">Το μέγεθος των MMS περιορίζεται από τους παρόχους, μπορείτε να δοκιμάσετε να ορίσετε ένα μικρότερο όριο στις ρυθμίσεις της εφαρμογής.</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 -->

View File

@ -50,11 +50,11 @@
<string name="mms_file_size_limit">Ridimensiona le immagini MMS inviate</string>
<string name="mms_file_size_limit_none">Nessun limite</string>
<string name="outgoing_messages">Messaggi in uscita</string>
<string name="group_message_mms">Send group messages as MMS</string>
<string name="group_message_mms">Invia messaggi di gruppo come MMS</string>
<!-- Export / Import -->
<string name="messages">Messages</string>
<string name="export_messages">Export messages</string>
<string name="export_sms">Export SMS</string>
<string name="messages">Messaggi</string>
<string name="export_messages">Esporta messaggi</string>
<string name="export_sms">Esporta SMS</string>
<string name="export_mms">Esporta MMS</string>
<string name="import_messages">Import messages</string>
<string name="import_sms">Import SMS</string>
@ -64,8 +64,8 @@
<string name="faq_1_title">Perché l\'applicazione richiede l\'accesso ad internet\?</string>
<string name="faq_1_text">Purtroppo è necessario per poter inviare gli allegati degli MMS. Non essere in grado di inviare gli MMS sarebbe un grosso svantaggio in confronto ad altre applicazioni, quindi abbiamo deciso di intraprendere questa strada.
Ad ogni modo, come sempre, non ci sono pubblicità o tracciamenti, internet è utilizzato soltanto per l\'invio degli MMS.</string>
<string name="faq_2_title">The other end is not receiving my MMS, is there anything I can do about it?</string>
<string name="faq_2_text">MMS size is limited by carriers, you can try setting a smaller limit in the app settings.</string>
<string name="faq_2_title">L\'altro capo non riceve i miei MMS, c\'è qualcosa che posso fare\?</string>
<string name="faq_2_text">La dimensione degli MMS è limitata dai vettori, puoi provare a impostare un limite più piccolo nelle impostazioni dell\'app.</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">Semplice SMS Messenger gestisci facilmente i messaggi</string>
@ -76,4 +76,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View File

@ -8,7 +8,7 @@
<string name="message_sending_error">Din melding til «%s» har ikke blitt sendt</string>
<string name="add_person">Legg til person</string>
<string name="attachment">Vedlegg</string>
<string name="no_conversations_found">Ingen lagrede samtaler ble funnet</string>
<string name="no_conversations_found">Ingen lagrede samtaler er funnet</string>
<string name="start_conversation">Start en samtale</string>
<string name="reply">Svar</string>
<string name="show_character_counter">Show a character counter at writing messages</string>
@ -31,24 +31,21 @@
<string name="mark_as_unread">Marker som ulest</string>
<!-- Confirmation dialog -->
<string name="delete_whole_conversation_confirmation">Are you sure you want to delete all messages of this conversation?</string>
<!-- Are you sure you want to delete 5 conversations? -->
<plurals name="delete_conversations">
<item quantity="one">%d samtale</item>
<item quantity="other">%d samtaler</item>
</plurals>
<!-- Are you sure you want to delete 5 messages? -->
<plurals name="delete_messages">
<item quantity="one">%d melding</item>
<item quantity="other">%d meldinger</item>
</plurals>
<!-- Settings -->
<string name="lock_screen_visibility">Synlighet for låseskjermsmerknad</string>
<string name="sender_and_message">Avsender og melding</string>
<string name="sender_only">Kun avsender</string>
<string name="enable_delivery_reports">Skru på leveringsrapporter</string>
<string name="enable_delivery_reports">Aktiver leveringsrapporter</string>
<string name="use_simple_characters">Remove accents and diacritics at sending messages</string>
<string name="mms_file_size_limit">Resize sent MMS images</string>
<string name="mms_file_size_limit_none">Ingen grense</string>
@ -64,17 +61,16 @@
<string name="import_mms">Importer MMS</string>
<string name="no_option_selected">Du må velge minst ett element</string>
<!-- FAQ -->
<string name="faq_1_title">Hvorfor krever programmet tilgang til Internett\?</string>
<string name="faq_1_title">Hvorfor krever appen tilgang til internett\?</string>
<string name="faq_1_text">Sadly it is needed for sending MMS attachments. Not being able to send MMS would be a really huge disadvantage compared to other apps, so we decided to go this way.
However, as usually, there are no ads, tracking or analytics whatsoever, the internet is used only for sending MMS.</string>
<string name="faq_2_title">The other end is not receiving my MMS, is there anything I can do about it?</string>
<string name="faq_2_text">MMS size is limited by carriers, you can try setting a smaller limit in the app settings.</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">Enkel SMS håndter tekstmeldinger enkelt</string>
<!-- Short description has to have max 80 characters -->
<string name="app_short_description">En enkel og rask måte å håndtere SMS- og MMS-meldinger, uten reklame.</string>
<string name="app_short_description">En enkel og rask måte å administrere SMS- og MMS-meldinger på uten annonser.</string>
<string name="app_long_description">
A great way to stay in touch with your relatives, by sending both SMS and MMS messages. The app properly handles group messaging too, just like blocking numbers from Android 7+.
@ -95,9 +91,8 @@
<b>Reddit:</b>
https://www.reddit.com/r/SimpleMobileTools
</string>
<!--
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Simple SMS Messenger</string>
<string name="app_launcher_name">SMS Messenger</string>
<string name="type_a_message">Escrever uma mensagem…</string>
<string name="message_not_sent_short">Mensagem não enviada</string>
<string name="message_not_sent_touch_retry">Não enviada. Toque para tentar novamente.</string>
<string name="message_sending_error">A mensagem destinada a \'%s\' não foi enviada.</string>
<string name="message_sending_error">A mensagem destinada a \'%s\' não foi enviada</string>
<string name="add_person">Adicionar pessoa</string>
<string name="attachment">Anexo</string>
<string name="no_conversations_found">Não foram encontradas conversas</string>
@ -19,33 +20,27 @@
<string name="unpin_conversation">Desafixar</string>
<string name="forward_message">Reencaminhar</string>
<string name="compress_error">Unable to compress image to selected size</string>
<!-- New conversation -->
<string name="new_conversation">Nova conversa</string>
<string name="add_contact_or_number">Adicionar contacto ou número…</string>
<string name="suggestions">Sugestões</string>
<!-- Notifications -->
<string name="channel_received_sms">SMS recebida</string>
<string name="new_message">Nova mensagem</string>
<string name="mark_as_read">Marcar como lida</string>
<string name="mark_as_unread">Marcar como não lida</string>
<!-- Confirmation dialog -->
<string name="delete_whole_conversation_confirmation">Tem a certeza de que deseja apagar todas as mensagens desta conversa?</string>
<string name="delete_whole_conversation_confirmation">Tem a certeza de que pretende apagar todas as mensagens desta conversa\?</string>
<!-- Are you sure you want to delete 5 conversations? -->
<plurals name="delete_conversations">
<item quantity="one">%d conversa</item>
<item quantity="other">%d conversas</item>
</plurals>
<!-- Are you sure you want to delete 5 messages? -->
<plurals name="delete_messages">
<item quantity="one">%d mensagem</item>
<item quantity="other">%d mensagens</item>
</plurals>
<!-- Settings -->
<string name="lock_screen_visibility">Notificação no ecrã de bloqueio</string>
<string name="sender_and_message">Remetente e mensagem</string>
@ -54,9 +49,8 @@
<string name="use_simple_characters">Remover acentos e diacríticos das mensagens enviadas</string>
<string name="mms_file_size_limit">Redimensionar imagens MMS enviadas</string>
<string name="mms_file_size_limit_none">Sem limite</string>
<string name="outgoing_messages">Outgoing messages</string>
<string name="group_message_mms">Send group messages as MMS</string>
<string name="outgoing_messages">Mensagens a enviar</string>
<string name="group_message_mms">Enviar mensagens de grupo como MMS</string>
<!-- Export / Import -->
<string name="messages">Mensagens</string>
<string name="export_messages">Exportar mensagens</string>
@ -66,42 +60,19 @@
<string name="import_sms">Importar SMS</string>
<string name="import_mms">Importar MMS</string>
<string name="no_option_selected">Tem que selecionar, pelo menos, 1 item</string>
<!-- FAQ -->
<string name="faq_1_title">Porque é que a aplicação necessita de aceder à Internet?</string>
<string name="faq_1_text">Infelizmente é a única forma para poder enviar anexos MMS. A incapacidade de não conseguir enviar MMS seria uma enorme desvantagem comparativamente a outras aplicações e, por isso, tomámos esta decisão.
Mas, como habitualmente, a aplicação não tem anúncios, não rastreia os utilizadores nem recolhe dados pessoais. Esta permissão apenas é necessária para enviar as MMS.</string>
<string name="faq_2_title">The other end is not receiving my MMS, is there anything I can do about it?</string>
<string name="faq_2_text">MMS size is limited by carriers, you can try setting a smaller limit in the app settings.</string>
<string name="faq_1_title">Porque é que a aplicação requer acesso à Internet\?</string>
<string name="faq_1_text">Infelizmente é a única forma de poder enviar anexos MMS. Não ter a capacidade de enviar MMS representaria uma enorme desvantagem comparativamente a outras aplicações e foi por isso que tomámos esta decisão. Mas, como habitualmente, a aplicação não tem anúncios, não rastreia os utilizadores nem recolhe dados pessoais. Esta permissão apenas é necessária para enviar MMS.</string>
<string name="faq_2_title">O destinatário não recebe as minhas MMS, o que posso fazer\?</string>
<string name="faq_2_text">O tamanho das MMS é limitado pelas operadoras, tente estabelecer um limite inferior nas Definições da aplicação.</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 SMS Messenger - Gestão de mensagens</string>
<!-- Short description has to have max 80 characters -->
<string name="app_short_description">Aplicação simples para gerir SMS e MMS, sem anúncios.</string>
<string name="app_long_description">
Uma excelente forma para manter o contacto com os seus amigos e familiares. Também pode ser utilizada para mensagens de grupo e possibilita bloqueio de números de telefone em versões Android 7+.
Permite a utilização de vários formatos de data. Também pode alternar o formato das horas.
É uma aplicação pequena - comparada com as aplicações do mesmo género - o que torna a sua descarga muito rápida.
Disponibiliza um design atrativo e um tema escuro por omissão. A não utilização da permissão Internet providencia-lhe mais privacidade, segurança e estabilidade do que as outras aplicações.
Não contém anúncios nem permissões desnecessárias. É open source e permite a personalização de cores.
<b>Consulte o conjunto completo de aplicações Simple Tools aqui:</b>
https://www.simplemobiletools.com
<b>Facebook:</b>
https://www.facebook.com/simplemobiletools
<b>Reddit:</b>
https://www.reddit.com/r/SimpleMobileTools
</string>
<string name="app_short_description">Gestor de mensagens SMS e MMS, sem anúncios.</string>
<string name="app_long_description"> Envie mensagens SMS e MMS e mantenha o contacto com os seus amigos e familiares. Serve também para difusão de mensagens de grupo e permite ainda bloquear de números de telefone em versões Android 7+. Formate a data e a hora como preferir. Uma aplicação muito pequena comparada com outras do mesmo género. Com design material num tema escuro por definição. Acesso à Internet apenas na estrita medida do necessário (envio de MMS), salvaguardando sempre a privacidade e a segurança. Não contém anúncios nem permissões desnecessárias. É totalmente open source e permite personalização de cores a gosto. <b>Consulte a gama completa de aplicações Simple Tools aqui:</b> https://www.simplemobiletools.com<b>Facebook:</b> https://www.facebook.com/simplemobiletools <b>Reddit:</b> https://www.reddit.com/r/SimpleMobileTools </string>
<!--
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>