From ade92ac03a9a1f6553af01aad7fa3c5bcbd962ee Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sun, 19 Jan 2025 21:03:28 +1100 Subject: [PATCH 01/27] added a 'send now' button to delay sent sms. user can now long press 'send now' to send a delayed message immediately --- .../QKSMS/feature/compose/ComposeActivity.kt | 1 + .../moez/QKSMS/feature/compose/ComposeView.kt | 1 + .../QKSMS/feature/compose/ComposeViewModel.kt | 20 ++ .../QKSMS/feature/compose/MessagesAdapter.kt | 46 ++-- .../main/res/layout/message_list_item_out.xml | 244 ++++++++++-------- presentation/src/main/res/values/strings.xml | 6 + 6 files changed, 198 insertions(+), 120 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt index f5f908cb..db635fb8 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt @@ -106,6 +106,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val messagePartClickIntent: Subject by lazy { messageAdapter.partClicks } override val messagesSelectedIntent by lazy { messageAdapter.selectionChanges } override val cancelSendingIntent: Subject by lazy { messageAdapter.cancelSending } + override val sendNowIntent: Subject by lazy { messageAdapter.sendNow } override val attachmentDeletedIntent: Subject by lazy { attachmentAdapter.attachmentDeleted } override val textChangedIntent by lazy { message.textChanges() } override val attachIntent by lazy { Observable.merge(attach.clicks(), attachingBackground.clicks()) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt index 8c15d694..b32ce3b6 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt @@ -39,6 +39,7 @@ interface ComposeView : QkView { val messagePartClickIntent: Subject val messagesSelectedIntent: Observable> val cancelSendingIntent: Subject + val sendNowIntent: Subject val attachmentDeletedIntent: Subject val textChangedIntent: Observable val attachIntent: Observable diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index 77eac25a..3e17be20 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -471,6 +471,26 @@ class ComposeViewModel @Inject constructor( cancelMessage.execute(CancelDelayedMessage.Params(message.id, message.threadId)) } + // send a delayed message now + view.sendNowIntent + .mapNotNull(messageRepo::getMessage) + .autoDisposable(view.scope()) + .subscribe { message -> + cancelMessage.execute(CancelDelayedMessage.Params(message.id, message.threadId)) + val address = listOf(conversationRepo + .getConversation(threadId)?.recipients?.firstOrNull()?.address ?: message.address) + sendMessage.execute( + SendMessage.Params( + message.subId, + message.threadId, + address, + message.body, + listOf(), // sms with attachments (mms) can't be delayed so we can know attachments are empty for a 'send now' delayed sms + 0 + ) + ) + } + // Set the current conversation Observables .combineLatest( diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt index 2bbdd5a0..82b04dbd 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt @@ -33,6 +33,7 @@ import android.widget.ImageView import android.widget.ProgressBar import androidx.recyclerview.widget.RecyclerView import com.jakewharton.rxbinding2.view.clicks +import com.jakewharton.rxbinding2.view.longClicks import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.common.base.QkRealmAdapter import dev.octoshrimpy.quik.common.base.QkViewHolder @@ -68,6 +69,7 @@ import kotlinx.android.synthetic.main.message_list_item_in.status import kotlinx.android.synthetic.main.message_list_item_in.timestamp import kotlinx.android.synthetic.main.message_list_item_in.view.* import kotlinx.android.synthetic.main.message_list_item_out.* +import kotlinx.android.synthetic.main.message_list_item_out.view.cancel import java.util.* import java.util.concurrent.TimeUnit import javax.inject.Inject @@ -98,6 +100,7 @@ class MessagesAdapter @Inject constructor( val clicks: Subject = PublishSubject.create() val partClicks: Subject = PublishSubject.create() val cancelSending: Subject = PublishSubject.create() + val sendNow: Subject = PublishSubject.create() var data: Pair>? = null set(value) { @@ -148,6 +151,7 @@ class MessagesAdapter @Inject constructor( view = layoutInflater.inflate(R.layout.message_list_item_out, parent, false) view.findViewById(R.id.cancelIcon).setTint(theme.theme) view.findViewById(R.id.cancel).setTint(theme.theme) + view.findViewById(R.id.sendNowIcon).setTint(theme.theme) } else { view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false) } @@ -194,25 +198,37 @@ class MessagesAdapter @Inject constructor( // Update the selected state holder.containerView.isActivated = isSelected(message.id) || highlight == message.id - // Bind the cancel view - holder.cancel?.let { cancel -> - val isCancellable = message.isSending() && message.date > System.currentTimeMillis() - cancel.setVisible(isCancellable) - cancel.clicks().subscribe { cancelSending.onNext(message.id) } - cancel.progress = 2 + // Bind the cancelFrame (cancel button) view + if (holder.cancelFrame != null) { + holder.cancelFrame.let { cancelFrame -> + val isCancellable = message.isSending() && message.date > System.currentTimeMillis() + cancelFrame.visibility = if (isCancellable) View.VISIBLE else View.GONE + cancelFrame.clicks().subscribe { cancelSending.onNext(message.id) } + cancelFrame.cancel.progress = 2 - if (isCancellable) { - val delay = when (prefs.sendDelay.get()) { - Preferences.SEND_DELAY_SHORT -> 3000 - Preferences.SEND_DELAY_MEDIUM -> 5000 - Preferences.SEND_DELAY_LONG -> 10000 - else -> 0 - } - val progress = (1 - (message.date - System.currentTimeMillis()) / delay.toFloat()) * 100 + if (isCancellable) { + val delay = when (prefs.sendDelay.get()) { + Preferences.SEND_DELAY_SHORT -> 3000 + Preferences.SEND_DELAY_MEDIUM -> 5000 + Preferences.SEND_DELAY_LONG -> 10000 + else -> 0 + } + val progress = + (1 - (message.date - System.currentTimeMillis()) / delay.toFloat()) * 100 - ObjectAnimator.ofInt(cancel, "progress", progress.toInt(), 100) + ObjectAnimator.ofInt(cancelFrame.cancel, "progress", progress.toInt(), 100) .setDuration(message.date - System.currentTimeMillis()) .start() + } + } + } + + // Bind the send now icon view + if (holder.sendNowIcon != null) { + holder.sendNowIcon.let { sendNowIcon -> + val isCancellable = message.isSending() && message.date > System.currentTimeMillis() + sendNowIcon.visibility = if (isCancellable) View.VISIBLE else View.GONE + sendNowIcon.longClicks().subscribe { sendNow.onNext(message.id) } } } diff --git a/presentation/src/main/res/layout/message_list_item_out.xml b/presentation/src/main/res/layout/message_list_item_out.xml index 649e57d8..92a6071b 100644 --- a/presentation/src/main/res/layout/message_list_item_out.xml +++ b/presentation/src/main/res/layout/message_list_item_out.xml @@ -17,133 +17,167 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:orientation="vertical"> - + android:background="?attr/selectableItemBackground" + android:contentDescription="@string/compose_message_item"> - + - + + + + + + + + + android:clipToPadding="false" + android:orientation="horizontal" + app:layout_constraintBottom_toBottomOf="parent"> - + - + - + - + + + + + + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 386e4a84..62615823 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -148,6 +148,12 @@ %s selected, change SIM card Send message + Cancel + Send now + SIM number + Message item + Attachment + Sending… Delivered %s Failed to send. Tap to try again From 76cefc1a84a8b89c52b882ca15ee4a6cb555d9c3 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sun, 19 Jan 2025 21:23:02 +1100 Subject: [PATCH 02/27] fixed not properly rendering selection background of updated message_list_item_out view --- presentation/src/main/res/layout/message_list_item_out.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/res/layout/message_list_item_out.xml b/presentation/src/main/res/layout/message_list_item_out.xml index 92a6071b..d34c67b8 100644 --- a/presentation/src/main/res/layout/message_list_item_out.xml +++ b/presentation/src/main/res/layout/message_list_item_out.xml @@ -22,13 +22,13 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" android:orientation="vertical"> Date: Fri, 24 Jan 2025 23:55:25 +0100 Subject: [PATCH 03/27] Update strings.xml --- .../src/main/res/values-fr/strings.xml | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/presentation/src/main/res/values-fr/strings.xml b/presentation/src/main/res/values-fr/strings.xml index 919801bc..b1f8b61e 100644 --- a/presentation/src/main/res/values-fr/strings.xml +++ b/presentation/src/main/res/values-fr/strings.xml @@ -68,9 +68,9 @@ Faire de QUIK votre application SMS par défaut Changer Autorisation requise - QUIK a besoin de l\'autorisation d’envoyer et de consulter des messages SMS + QUIK a besoin de l\'autorisation d\’envoyer et de consulter les messages SMS QUIK a besoin de l\'autorisation d\'accéder aux contacts - QUIK needs permission to display notifications + QUIK a besoin de l\'autorisation d\'afficher des notifications Autoriser Boite de réception @@ -86,14 +86,14 @@ Débloquer les nouvelles fonctions sensationnelles et soutenir le développement Vous aimez QUIK? - Partagez un peu d’amour et évaluez-nous sur le Play Store ! - OK ! + Partagez un peu d\’amour et évaluez-nous sur le Play Store! + OK! ANNULER Supprimer - Êtes-vous sûr de vouloir supprimer cette conversation ? - Êtes-vous sûr de vouloir supprimer %d conversations ? + Êtes-vous sûr de vouloir supprimer cette conversation? + Êtes-vous sûr de vouloir supprimer %d conversations? Êtes-vous sûr de vouloir supprimer ce message? @@ -114,10 +114,10 @@ %1$d sur %2$d résultats Envoyer en tant que message groupé Les destinataires et les réponses seront visibles par tout le monde - C\'est le début de votre conversation. Dites quelque chose de sympa ! + C\'est le début de votre conversation. Dites quelque chose de sympa! Fiche du contact Programmé pour - Le moment choisi doit être dans le futur ! + Le moment choisi doit être dans le futur! Vous devez déverrouiller QUIK+ pour utiliser la programmation de message Ajouté aux messages programmés Écrire un message… @@ -130,16 +130,16 @@ Suivant Effacer Détails du message - Type : %s - De : %s - À : %s - Objet : %s - Priorité : %s - Taille : %s - Envoyé : %s - Reçu : %s - Délivré : %s - Code erreur : %d + Type: %s + De: %s + À: %s + Objet: %s + Priorité: %s + Taille: %s + Envoyé: %s + Reçu: %s + Délivré: %s + Code erreur: %d Ajouter une pièce jointe Joindre une photo Prendre une photo @@ -174,8 +174,8 @@ Restaurer à partir d\'une sauvegarde Chargement… Jamais - Backup location - Set folder + Emplacement de sauvegarde + Définir le dossier Restauration Sélectionner une sauvegarde Déverrouillez QUIK+ pour utiliser la sauvegarde et la restauration @@ -184,8 +184,8 @@ Restaurer à partir d’une sauvegarde Arrêter la restauration Les messages qui ont déjà été restaurés resteront sur votre appareil - Select backup location - Please select a folder to save your backups to + Sélectionnez l\'emplacement de sauvegarde + Veuillez sélectionner un dossier dans lequel enregistrer vos sauvegardes %1$s\n%2$d messages Erreur Impossible de lire le fichier de sauvegarde @@ -193,7 +193,7 @@ Sauvegardes /QUIK/Backups Aucune sauvegarde trouvée - Actuellement, seulement la sauvegarde et la restauration des SMS sont pris en charge. Les MMS et les sauvegardes planifiées arriveront bientôt ! + Actuellement, seulement la sauvegarde et la restauration des SMS sont pris en charge. Les MMS et les sauvegardes planifiées arriveront bientôt! Sauvegarder maintenant Analyse de la sauvegarde… %d/%d messages @@ -204,9 +204,9 @@ Programmé Envoyer automatiquement un message, au moment précis que vous souhaitez - Hé ! Quand était votre anniversaire déjà ? + Hé! Quand était votre anniversaire déjà ? C’est le 23 décembre - Joyeux anniversaire ! Regarde le grand ami que je suis, je me souviens de ton anniversaire + Joyeux anniversaire! Regarde le grand ami que je suis, je me souviens de ton anniversaire Envoyé le 23 décembre  Programmer un message @@ -339,7 +339,7 @@ Liste des modifications Contact Licence - Droits d’auteur + Droits d\’auteur Soutenir le développement, tout déverrouiller Vous pouvez sauver un développeur affamé pour seulement %s @@ -350,7 +350,7 @@ One-time purchase of %1$s %2$s Déverrouiller + faire un don pour %1$s %2$s - Merci de soutenir QUIK ! + Merci de soutenir QUIK! Vous avez maintenant accès à toutes les fonctionnalités de QUIK+ Une erreur s\'est produite. Merci de réessayer. QUIK + est gratuit pour les utilisateurs de F-Droid ! Si vous souhaitez soutenir le développement, n’hésitez pas à faire un don. @@ -375,7 +375,7 @@ Réponse automatique Répondre automatiquement aux messages entrants avec une réponse prédéfinie Plus - QUIK est en cours de développement actif, et votre achat comprendra toutes les futures fonctionnalités QUIK + ! + QUIK est en cours de développement actif, et votre achat comprendra toutes les futures fonctionnalités QUIK +! Chargement… Afficher plus de conversations @@ -500,7 +500,7 @@ J\'arrive Merci Ça a l\'air bien - Quoi de neuf ? + Quoi de neuf? D\'accord Non Je t\'aime From 343ddf46120a90b357efb499df492165f8bc0c51 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sun, 26 Jan 2025 16:52:26 +1100 Subject: [PATCH 04/27] build fix. fix incorrect tag in fr strings. changed to --- presentation/src/main/res/values-fr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/res/values-fr/strings.xml b/presentation/src/main/res/values-fr/strings.xml index 919801bc..cef531f3 100644 --- a/presentation/src/main/res/values-fr/strings.xml +++ b/presentation/src/main/res/values-fr/strings.xml @@ -430,7 +430,7 @@ Annuler Copié - Conversation archivée + Conversation archivée Conversation archivée %d Conversations archivées From 314704a61a20c094ea9cacd39f7f005686de4b44 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sun, 26 Jan 2025 16:57:36 +1100 Subject: [PATCH 05/27] changes to allow attaching any type of file. mainly for video and audio attachments but nothing to stop any type of file being attached --- .../mms/transaction/RetryScheduler.java | 5 + .../src/main/res/values/strings.xml | 1 + data/src/main/AndroidManifest.xml | 1 + .../moez/QKSMS/extensions/UriExtensions.kt | 36 ++++++ .../QKSMS/repository/MessageRepositoryImpl.kt | 58 ++++----- .../QKSMS/interactor/SendScheduledMessage.kt | 2 +- .../java/com/moez/QKSMS/model/Attachment.kt | 115 +++++++++++++---- .../main/java/com/moez/QKSMS/model/MmsPart.kt | 6 +- presentation/src/main/AndroidManifest.xml | 14 +-- .../feature/compose/AttachmentAdapter.kt | 117 +++++++++++++----- .../QKSMS/feature/compose/ComposeActivity.kt | 57 +++++---- .../feature/compose/ComposeActivityModule.kt | 16 +-- .../moez/QKSMS/feature/compose/ComposeView.kt | 16 ++- .../QKSMS/feature/compose/ComposeViewModel.kt | 53 ++++---- .../ScheduledMessageAttachmentAdapter.kt | 98 +++++++++++++-- .../res/drawable/ic_round_volume_up_24.xml | 5 + ...item.xml => attachment_file_list_item.xml} | 12 +- .../src/main/res/layout/compose_activity.xml | 57 +++++++-- .../scheduled_message_image_list_item.xml | 15 ++- .../src/main/res/values-el/strings.xml | 2 +- .../src/main/res/values-gd/strings.xml | 2 +- .../src/main/res/values-lt/strings.xml | 2 +- .../src/main/res/values-ne/strings.xml | 2 +- .../src/main/res/values-ta/strings.xml | 2 +- .../src/main/res/values-tl/strings.xml | 2 +- .../src/main/res/values-ur/strings.xml | 2 +- presentation/src/main/res/values/strings.xml | 4 +- 27 files changed, 505 insertions(+), 197 deletions(-) create mode 100644 data/src/main/java/com/moez/QKSMS/extensions/UriExtensions.kt create mode 100644 presentation/src/main/res/drawable/ic_round_volume_up_24.xml rename presentation/src/main/res/layout/{attachment_image_list_item.xml => attachment_file_list_item.xml} (82%) diff --git a/android-smsmms/src/main/java/com/android/mms/transaction/RetryScheduler.java b/android-smsmms/src/main/java/com/android/mms/transaction/RetryScheduler.java index 414f14e7..a107f3ba 100755 --- a/android-smsmms/src/main/java/com/android/mms/transaction/RetryScheduler.java +++ b/android-smsmms/src/main/java/com/android/mms/transaction/RetryScheduler.java @@ -143,6 +143,11 @@ public class RetryScheduler implements Observer { case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND: errorString = R.string.service_message_not_found; break; + case PduHeaders.RESPONSE_STATUS_ERROR_CONTENT_NOT_ACCEPTED: + case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED: + errorString = R.string.service_message_content_not_accepted; + break; + } if (errorString != 0) { DownloadManager.init(mContext.getApplicationContext()); diff --git a/android-smsmms/src/main/res/values/strings.xml b/android-smsmms/src/main/res/values/strings.xml index c48bc4b8..edcfd758 100755 --- a/android-smsmms/src/main/res/values/strings.xml +++ b/android-smsmms/src/main/res/values/strings.xml @@ -20,6 +20,7 @@ limitations under the License. Invalid destination address. Service not activated on network. Message expired or not available. + Message content is not accepted. Couldn\'t send due to network problem. Currently can\'t send your message. It will be sent when the service becomes available. Can\'t download right now. Try again later. diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml index b1ca12fe..a65cc645 100644 --- a/data/src/main/AndroidManifest.xml +++ b/data/src/main/AndroidManifest.xml @@ -19,4 +19,5 @@ + diff --git a/data/src/main/java/com/moez/QKSMS/extensions/UriExtensions.kt b/data/src/main/java/com/moez/QKSMS/extensions/UriExtensions.kt new file mode 100644 index 00000000..7ebe330a --- /dev/null +++ b/data/src/main/java/com/moez/QKSMS/extensions/UriExtensions.kt @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2017 Moez Bhatti + * + * This file is part of QKSMS. + * + * QKSMS is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QKSMS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QKSMS. If not, see . + */ +package dev.octoshrimpy.quik.extensions + +import android.content.Context +import android.net.Uri + +fun Uri.resourceExists(context: Context): Boolean { + // check if resource at uri still exists + try { + return context.contentResolver.query( + this, null, null, null, null + )?.use { + it.moveToFirst() + } ?: false + } + catch (e: Exception) { /* nothing */ } + + return false +} diff --git a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt index e776c705..c4741436 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt @@ -25,7 +25,6 @@ import android.content.ContentValues import android.content.Context import android.content.Intent import android.graphics.BitmapFactory -import android.media.MediaScannerConnection import android.net.Uri import android.os.Build import android.os.Environment @@ -65,14 +64,7 @@ import io.realm.Case import io.realm.Realm import io.realm.RealmResults import io.realm.Sort -import okio.buffer -import okio.source import timber.log.Timber -import java.io.File -import java.io.FileNotFoundException -import java.io.FileOutputStream -import java.io.IOException -import java.util.* import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Singleton @@ -376,27 +368,37 @@ class MessageRepositoryImpl @Inject constructor( parts += MMSPart("text", ContentType.TEXT_PLAIN, bytes) } - // Attach contacts + // Attach those that can't be compressed (ie. everything but not images) parts += attachments - .mapNotNull { attachment -> attachment as? Attachment.Contact } - .map { attachment -> attachment.vCard.toByteArray() } - .map { vCard -> - remainingBytes -= vCard.size - MMSPart("contact", ContentType.TEXT_VCARD, vCard) - } + // filter out images + .filter { !it.isImage(context) } + // filter out items that have no data available (ie user may have deleted + // the file from storage) + .filter { it.getResourceBytes(context).isNotEmpty() } + .map { + remainingBytes -= it.getResourceBytes(context).size + MMSPart( + it.getName(context), + it.getType(context), + it.getResourceBytes(context) + ) + } val imageBytesByAttachment = attachments - .mapNotNull { attachment -> attachment as? Attachment.Image } - .associateWith { attachment -> - val uri = attachment.getUri() ?: return@associateWith byteArrayOf() - when (attachment.isGif(context)) { - true -> ImageUtils.getScaledGif(context, uri, maxWidth, maxHeight) - false -> ImageUtils.getScaledImage(context, uri, maxWidth, maxHeight) - } + // filter out non-images + .filter { it.isImage(context) } + // filter out items that have no data available (ie user may have deleted + // the file from storage) + .filter { it.getResourceBytes(context).isNotEmpty() } + .associateWith { + when (it.getType(context) == "image/gif") { + true -> ImageUtils.getScaledGif(context, it.getUri(), maxWidth, maxHeight) + false -> ImageUtils.getScaledImage(context, it.getUri(), maxWidth, maxHeight) } - .toMutableMap() + } + .toMutableMap() - val imageByteCount = imageBytesByAttachment.values.sumBy { byteArray -> byteArray.size } + val imageByteCount = imageBytesByAttachment.values.sumOf { it.size } if (imageByteCount > remainingBytes) { imageBytesByAttachment.forEach { (attachment, originalBytes) -> val uri = attachment.getUri() ?: return@forEach @@ -426,9 +428,9 @@ class MessageRepositoryImpl @Inject constructor( val newHeight = (newWidth / aspectRatio).toInt() attempts++ - scaledBytes = when (attachment.isGif(context)) { - true -> ImageUtils.getScaledGif(context, uri, newWidth, newHeight, 80) - false -> ImageUtils.getScaledImage(context, uri, newWidth, newHeight, 80) + scaledBytes = when (attachment.getType(context) == "image/gif") { + true -> ImageUtils.getScaledGif(context, attachment.getUri(), maxWidth, maxHeight) + false -> ImageUtils.getScaledImage(context, attachment.getUri(), maxWidth, maxHeight) } Timber.d("Compression attempt $attempts: ${scaledBytes.size / 1024}/${maxBytes.toInt() / 1024}Kb ($width*$height -> $newWidth*$newHeight)") @@ -440,7 +442,7 @@ class MessageRepositoryImpl @Inject constructor( } imageBytesByAttachment.forEach { (attachment, bytes) -> - parts += when (attachment.isGif(context)) { + parts += when (attachment.getType(context) == "image/gif") { true -> MMSPart("image", ContentType.IMAGE_GIF, bytes) false -> MMSPart("image", ContentType.IMAGE_JPEG, bytes) } diff --git a/domain/src/main/java/com/moez/QKSMS/interactor/SendScheduledMessage.kt b/domain/src/main/java/com/moez/QKSMS/interactor/SendScheduledMessage.kt index 8b76318b..0047fdd8 100644 --- a/domain/src/main/java/com/moez/QKSMS/interactor/SendScheduledMessage.kt +++ b/domain/src/main/java/com/moez/QKSMS/interactor/SendScheduledMessage.kt @@ -47,7 +47,7 @@ class SendScheduledMessage @Inject constructor( } .map { message -> val threadId = TelephonyCompat.getOrCreateThreadId(context, message.recipients) - val attachments = message.attachments.mapNotNull(Uri::parse).map { Attachment.Image(it) } + val attachments = message.attachments.mapNotNull(Uri::parse).map { Attachment(it) } SendMessage.Params(message.subId, threadId, message.recipients, message.body, attachments) } .flatMap(sendMessage::buildObservable) diff --git a/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt b/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt index c354f60f..bb25625e 100644 --- a/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt +++ b/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt @@ -21,33 +21,106 @@ package dev.octoshrimpy.quik.model import android.content.Context import android.net.Uri import android.os.Build +import android.provider.OpenableColumns import androidx.core.view.inputmethod.InputContentInfoCompat -sealed class Attachment { - data class Image( - private val uri: Uri? = null, - private val inputContent: InputContentInfoCompat? = null - ) : Attachment() { +class Attachment( + private val uri: Uri? = null, + private val inputContent: InputContentInfoCompat? = null +) { + private var resourceBytes: ByteArray? = null - fun getUri(): Uri? { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { - inputContent?.contentUri ?: uri - } else { - uri - } - } - - fun isGif(context: Context): Boolean { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && inputContent != null) { - inputContent.description.hasMimeType("image/gif") - } else { - uri?.let(context.contentResolver::getType) == "image/gif" - } - } + fun getUri(): Uri { + return ( + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) + inputContent?.contentUri ?: uri ?: Uri.EMPTY + else uri ?: Uri.EMPTY + ) } - data class Contact(val vCard: String) : Attachment() + fun getType(context: Context): String { + return context.contentResolver.getType(getUri()) ?: "application/octect-stream" + } + + fun getName(context: Context): String { + try { + context.contentResolver.query( + getUri(), + arrayOf(OpenableColumns.DISPLAY_NAME), + null, + null, + null + ) + ?.use { cursor -> + val nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME) + if (nameIndex == -1) + return "unknown" + cursor.moveToFirst() + return cursor.getString(nameIndex) ?: "unknown" + } + } + catch (e: Exception) { /* nothing*/ } + + return "unknown" + } + + fun isVCard(context: Context): Boolean { + return (getType(context) == "text/x-vcard") + } + + fun hasDisplayableImage(context: Context): Boolean { + val mimeType = getType(context) + return (mimeType.startsWith("image/") || mimeType.startsWith("video/")) + } + + fun isAudio(context: Context): Boolean { + val mimeType = getType(context) + return (mimeType.startsWith("audio/")) + } + + fun isImage(context: Context): Boolean { + val mimeType = getType(context) + return (mimeType.startsWith("image/")) + } + + fun getSize(context: Context): Long { + try { + context.contentResolver.query( + getUri(), + arrayOf(OpenableColumns.SIZE), + null, + null, + null + ) + ?.use { + val sizeIndex = it.getColumnIndex(OpenableColumns.SIZE) + if (sizeIndex == -1) + return -1 + it.moveToFirst() + return it.getLong(sizeIndex) + } + } + catch (e: Exception) { /* nothing */ } + + return -1 + } + + fun getResourceBytes(context: Context): ByteArray { + if (resourceBytes != null) + return resourceBytes!! + + resourceBytes = ByteArray(0) + + try { + context.contentResolver.openInputStream(getUri())?.use { + resourceBytes = it.readBytes() + } + } catch (e: Exception) { + } + + return resourceBytes!! + } } diff --git a/domain/src/main/java/com/moez/QKSMS/model/MmsPart.kt b/domain/src/main/java/com/moez/QKSMS/model/MmsPart.kt index f9b62eb4..0afb53b1 100644 --- a/domain/src/main/java/com/moez/QKSMS/model/MmsPart.kt +++ b/domain/src/main/java/com/moez/QKSMS/model/MmsPart.kt @@ -40,11 +40,13 @@ open class MmsPart : RealmObject() { fun getUri() = "content://mms/part/$id".toUri() fun getSummary(): String? = when { + type == "application/smil" -> null type == "text/plain" -> text - type == "text/x-vCard" -> "Contact card" + type == "text/x-vcard" -> "Contact card" type.startsWith("image") -> "Photo" type.startsWith("video") -> "Video" - else -> null + type.startsWith("audio") -> "Audio" + else -> type.substring(type.indexOf('/') + 1) } } \ No newline at end of file diff --git a/presentation/src/main/AndroidManifest.xml b/presentation/src/main/AndroidManifest.xml index 4153b2c3..7b1c55ab 100644 --- a/presentation/src/main/AndroidManifest.xml +++ b/presentation/src/main/AndroidManifest.xml @@ -88,22 +88,12 @@ - - - - - - + - - - - - - + () { companion object { - private const val VIEW_TYPE_IMAGE = 0 + private const val VIEW_TYPE_FILE = 0 private const val VIEW_TYPE_CONTACT = 1 } @@ -53,14 +54,13 @@ class AttachmentAdapter @Inject constructor( override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder { val inflater = LayoutInflater.from(parent.context) - val view = when (viewType) { - VIEW_TYPE_IMAGE -> inflater.inflate(R.layout.attachment_image_list_item, parent, false) - .apply { thumbnailBounds.clipToOutline = true } - VIEW_TYPE_CONTACT -> inflater.inflate(R.layout.attachment_contact_list_item, parent, false) - - else -> null!! // Impossible - } + val view = inflater.inflate( + if (viewType == VIEW_TYPE_CONTACT) R.layout.attachment_contact_list_item + else R.layout.attachment_file_list_item, + parent, + false + ) return QkViewHolder(view).apply { view.setOnClickListener { @@ -73,26 +73,81 @@ class AttachmentAdapter @Inject constructor( override fun onBindViewHolder(holder: QkViewHolder, position: Int) { val attachment = getItem(position) - when (attachment) { - is Attachment.Image -> Glide.with(context) - .load(attachment.getUri()) - .into(holder.thumbnail) - - is Attachment.Contact -> Observable.just(attachment.vCard) - .mapNotNull { vCard -> Ezvcard.parse(vCard).first() } - .map { vcard -> vcard.getDisplayName() ?: "" } - .subscribeOn(Schedulers.computation()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe { displayName -> - holder.name?.text = displayName - holder.name?.isVisible = displayName.isNotEmpty() - } + if (attachment.isVCard(context)) { + val displayName = Ezvcard.parse( + String(attachment.getResourceBytes(context)) + ).first().getDisplayName() ?: "" + holder.name.text = displayName + holder.name.isVisible = displayName.isNotEmpty() + return } + + // if attachment uri is missing + if (!attachment.getUri().resourceExists(context)) { + holder.thumbnail.setImageResource(android.R.drawable.ic_delete) + holder.fileName.text = context.getString(R.string.attachment_missing) + holder.fileName.visibility = View.VISIBLE + return + } + + val uri = attachment.getUri() + val mimeType = attachment.getType(context) + + // if attachment mime type is image/* or video/*, use image/frame + if (attachment.hasDisplayableImage(context)) { + Glide + .with(context) + .load(uri) + .into(holder.thumbnail) + return + } + + // if audio mime type, try and use embedded image if one exists + if (attachment.isAudio(context)) { + val metaDataRetriever = MediaMetadataRetriever() + metaDataRetriever.setDataSource(context, uri) + val embeddedPicture = metaDataRetriever.embeddedPicture + if (embeddedPicture != null) { + Glide + .with(context) + .load(embeddedPicture) + .into(holder.thumbnail) + return + } + } + + // try and use icon from default app for type + val intent = Intent(Intent.ACTION_VIEW).setDataAndType(uri, mimeType) + val appIcon = context + .packageManager + .resolveActivity(intent, MATCH_DEFAULT) + ?.loadIcon(context.packageManager) + if (appIcon != null) + Glide + .with(context) + .load(appIcon) + .into(holder.thumbnail) + else if (mimeType?.startsWith("audio/") == true) + // else, if audio, use default local audio icon + Glide + .with(context) + .load(R.drawable.ic_round_volume_up_24) + .into(holder.thumbnail) + else + // else, use default attachment icon + Glide + .with(context) + .load(R.drawable.ic_attachment_black_24dp) + .into(holder.thumbnail) + + // else, show file name + holder.fileName.text = attachment.getName(context) + holder.fileName.visibility = View.VISIBLE } - override fun getItemViewType(position: Int) = when (getItem(position)) { - is Attachment.Image -> VIEW_TYPE_IMAGE - is Attachment.Contact -> VIEW_TYPE_CONTACT + override fun getItemViewType(position: Int) = when (getItem(position).isVCard(context)) { + true -> VIEW_TYPE_CONTACT + else -> VIEW_TYPE_FILE } } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt index ace8d547..c76ad421 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt @@ -82,15 +82,6 @@ import javax.inject.Inject class ComposeActivity : QkThemedActivity(), ComposeView { - companion object { - private const val SelectContactRequestCode = 0 - private const val TakePhotoRequestCode = 1 - private const val AttachPhotoRequestCode = 2 - private const val AttachContactRequestCode = 3 - - private const val CameraDestinationKey = "camera_destination" - } - @Inject lateinit var attachmentAdapter: AttachmentAdapter @Inject lateinit var chipsAdapter: ChipsAdapter @Inject lateinit var dateFormatter: DateFormatter @@ -112,10 +103,11 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val textChangedIntent by lazy { message.textChanges() } override val attachIntent by lazy { Observable.merge(attach.clicks(), attachingBackground.clicks()) } override val cameraIntent by lazy { Observable.merge(camera.clicks(), cameraLabel.clicks()) } - override val galleryIntent by lazy { Observable.merge(gallery.clicks(), galleryLabel.clicks()) } + override val attachImageFileIntent by lazy { Observable.merge(gallery.clicks(), galleryLabel.clicks()) } + override val attachAnyFileIntent by lazy { Observable.merge(attachAFileIcon.clicks(), attachAFileLabel.clicks()) } override val scheduleIntent by lazy { Observable.merge(schedule.clicks(), scheduleLabel.clicks()) } override val attachContactIntent by lazy { Observable.merge(contact.clicks(), contactLabel.clicks()) } - override val attachmentSelectedIntent: Subject = PublishSubject.create() + override val attachAnyFileSelectedIntent: Subject = PublishSubject.create() override val contactSelectedIntent: Subject = PublishSubject.create() override val inputContentIntent by lazy { message.inputContentSelected } override val scheduleSelectedIntent: Subject = PublishSubject.create() @@ -386,7 +378,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { val intent = Intent(Intent.ACTION_PICK) .setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE) - startActivityForResult(Intent.createChooser(intent, null), AttachContactRequestCode) + startActivityForResult(Intent.createChooser(intent, null), ComposeView.AttachContactRequestCode) } override fun showContacts(sharing: Boolean, chips: List) { @@ -395,7 +387,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { val intent = Intent(this, ContactsActivity::class.java) .putExtra(ContactsActivity.SharingKey, sharing) .putExtra(ContactsActivity.ChipsKey, serialized) - startActivityForResult(intent, SelectContactRequestCode) + startActivityForResult(intent, ComposeView.SelectContactRequestCode) } override fun themeChanged() { @@ -415,17 +407,17 @@ class ComposeActivity : QkThemedActivity(), ComposeView { val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) .putExtra(MediaStore.EXTRA_OUTPUT, cameraDestination) - startActivityForResult(Intent.createChooser(intent, null), TakePhotoRequestCode) + startActivityForResult(Intent.createChooser(intent, null), ComposeView.TakePhotoRequestCode) } - override fun requestGallery() { + override fun requestGallery(mimeType: String, requestCode: Int) { val intent = Intent(Intent.ACTION_PICK) .putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true) .addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION) .putExtra(Intent.EXTRA_LOCAL_ONLY, false) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - .setType("image/*") - startActivityForResult(Intent.createChooser(intent, null), AttachPhotoRequestCode) + .setType(mimeType) + startActivityForResult(Intent.createChooser(intent, null), requestCode) } override fun setDraft(draft: String) { @@ -473,36 +465,43 @@ class ComposeActivity : QkThemedActivity(), ComposeView { } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - when { - requestCode == SelectContactRequestCode -> { + if (resultCode != Activity.RESULT_OK) + return + + when (requestCode) { + ComposeView.SelectContactRequestCode -> { chipsSelectedIntent.onNext(data?.getSerializableExtra(ContactsActivity.ChipsKey) ?.let { serializable -> serializable as? HashMap } ?: hashMapOf()) } - requestCode == TakePhotoRequestCode && resultCode == Activity.RESULT_OK -> { - cameraDestination?.let(attachmentSelectedIntent::onNext) + + ComposeView.TakePhotoRequestCode -> { + cameraDestination?.let(attachAnyFileSelectedIntent::onNext) } - requestCode == AttachPhotoRequestCode && resultCode == Activity.RESULT_OK -> { + + ComposeView.AttachAFileRequestCode -> { data?.clipData?.itemCount - ?.let { count -> 0 until count } - ?.mapNotNull { i -> data.clipData?.getItemAt(i)?.uri } - ?.forEach(attachmentSelectedIntent::onNext) - ?: data?.data?.let(attachmentSelectedIntent::onNext) + ?.let { count -> 0 until count } + ?.mapNotNull { i -> data.clipData?.getItemAt(i)?.uri } + ?.forEach(attachAnyFileSelectedIntent::onNext) + ?: data?.data?.let(attachAnyFileSelectedIntent::onNext) } - requestCode == AttachContactRequestCode && resultCode == Activity.RESULT_OK -> { + + ComposeView.AttachContactRequestCode -> { data?.data?.let(contactSelectedIntent::onNext) } + else -> super.onActivityResult(requestCode, resultCode, data) } } override fun onSaveInstanceState(outState: Bundle) { - outState.putParcelable(CameraDestinationKey, cameraDestination) + outState.putParcelable(ComposeView.CameraDestinationKey, cameraDestination) super.onSaveInstanceState(outState) } override fun onRestoreInstanceState(savedInstanceState: Bundle) { - cameraDestination = savedInstanceState.getParcelable(CameraDestinationKey) + cameraDestination = savedInstanceState.getParcelable(ComposeView.CameraDestinationKey) super.onRestoreInstanceState(savedInstanceState) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivityModule.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivityModule.kt index 209680be..8580cb49 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivityModule.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivityModule.kt @@ -78,22 +78,8 @@ class ComposeActivityModule { val uris = mutableListOf() activity.intent.getParcelableExtra(Intent.EXTRA_STREAM)?.run(uris::add) activity.intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM)?.run(uris::addAll) - return Attachments(uris.mapNotNull { uri -> - val mimeType = activity.contentResolver.getType(uri) - when { - ContentType.isImageType(mimeType) -> { - Attachment.Image(uri) - } - ContentType.TEXT_VCARD.equals(mimeType, true) -> { - val inputStream = activity.contentResolver.openInputStream(uri) - val text = inputStream?.reader(Charset.forName("utf-8"))?.readText() - text?.let(Attachment::Contact) - } - - else -> null - } - }) + return Attachments(uris.mapNotNull { Attachment(it) }) } @Provides diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt index af37016d..7d4f3d2e 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt @@ -29,6 +29,15 @@ import io.reactivex.subjects.Subject interface ComposeView : QkView { + companion object { + const val SelectContactRequestCode = 0 + const val TakePhotoRequestCode = 1 + const val AttachAFileRequestCode = 4 + const val AttachContactRequestCode = 3 + + const val CameraDestinationKey = "camera_destination" + } + val activityVisibleIntent: Observable val chipsSelectedIntent: Subject> val chipDeletedIntent: Subject @@ -43,10 +52,11 @@ interface ComposeView : QkView { val textChangedIntent: Observable val attachIntent: Observable val cameraIntent: Observable<*> - val galleryIntent: Observable<*> + val attachAnyFileIntent: Observable<*> + val attachImageFileIntent: Observable<*> val scheduleIntent: Observable<*> val attachContactIntent: Observable<*> - val attachmentSelectedIntent: Observable + val attachAnyFileSelectedIntent: Observable val contactSelectedIntent: Observable val inputContentIntent: Observable val scheduleSelectedIntent: Observable @@ -68,7 +78,7 @@ interface ComposeView : QkView { fun themeChanged() fun showKeyboard() fun requestCamera() - fun requestGallery() + fun requestGallery(mimeType: String, requestCode: Int) fun requestDatePicker() fun requestContact() fun setDraft(draft: String) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index bf65a224..aa6b27ec 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -536,11 +536,17 @@ class ComposeViewModel @Inject constructor( } } - // Attach a photo from gallery - view.galleryIntent - .doOnNext { newState { copy(attaching = false) } } - .autoDisposable(view.scope()) - .subscribe { view.requestGallery() } + // pick a photo (specifically) from image provider apps + view.attachImageFileIntent + .doOnNext { newState { copy(attaching = false) } } + .autoDisposable(view.scope()) + .subscribe { view.requestGallery("image/*", ComposeView.AttachAFileRequestCode) } + + // pick any file from any provider apps + view.attachAnyFileIntent + .doOnNext { newState { copy(attaching = false) } } + .autoDisposable(view.scope()) + .subscribe { view.requestGallery("*/*", ComposeView.AttachAFileRequestCode) } // Choose a time to schedule the message view.scheduleIntent @@ -552,15 +558,15 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { view.requestDatePicker() } - // A photo was selected + // a file, photo or otherwise, was picked by the user Observable.merge( - view.attachmentSelectedIntent.map { uri -> Attachment.Image(uri) }, - view.inputContentIntent.map { inputContent -> Attachment.Image(inputContent = inputContent) }) - .withLatestFrom(attachments) { attachment, attachments -> attachments + attachment } - .doOnNext(attachments::onNext) - .autoDisposable(view.scope()) - .subscribe { newState { copy(attaching = false) } } - + view.attachAnyFileSelectedIntent.map { uri -> Attachment(uri) }, + view.inputContentIntent.map { inputContent -> Attachment(inputContent = inputContent) } + ) + .withLatestFrom(attachments) { attachment, attachments -> attachments + attachment } + .doOnNext(attachments::onNext) + .autoDisposable(view.scope()) + .subscribe { newState { copy(attaching = false) } } // Set the scheduled time view.scheduleSelectedIntent .filter { scheduled -> @@ -579,7 +585,7 @@ class ComposeViewModel @Inject constructor( // Contact was selected for attachment view.contactSelectedIntent - .map { uri -> Attachment.Contact(getVCard(uri)!!) } + .map { uri -> Attachment(getFullVCardUri(uri)) } .withLatestFrom(attachments) { attachment, attachments -> attachments + attachment } .subscribeOn(Schedulers.io()) .autoDisposable(view.scope()) @@ -704,7 +710,6 @@ class ComposeViewModel @Inject constructor( state.scheduled != 0L -> { newState { copy(scheduled = 0) } val uris = attachments - .mapNotNull { it as? Attachment.Image } .map { it.getUri() } .map { it.toString() } val params = AddScheduledMessage @@ -784,17 +789,17 @@ class ComposeViewModel @Inject constructor( } - private fun getVCard(contactData: Uri): String? { - val lookupKey = context.contentResolver.query(contactData, null, null, null, null)?.use { cursor -> - cursor.moveToFirst() - cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY)) + private fun getFullVCardUri(contactData: Uri): Uri { + val lookupKey = context.contentResolver.query(contactData, null, null, null, null)?.use { + it.moveToFirst() + val index = it.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY) + if (index >= 0) + it.getString(index) + else + "" } - val vCardUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey) - return context.contentResolver.openAssetFileDescriptor(vCardUri, "r") - ?.createInputStream() - ?.readBytes() - ?.let { bytes -> String(bytes) } + return Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey) } } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledMessageAttachmentAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledMessageAttachmentAdapter.kt index 96a10ffc..e5f3e1b4 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledMessageAttachmentAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledMessageAttachmentAdapter.kt @@ -19,32 +19,112 @@ package dev.octoshrimpy.quik.feature.scheduled import android.content.Context +import android.content.Intent +import android.media.MediaMetadataRetriever import android.net.Uri +import android.provider.MediaStore.MATCH_DEFAULT +import android.provider.OpenableColumns import android.view.LayoutInflater +import android.view.View import android.view.ViewGroup +import com.bumptech.glide.Glide import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.common.base.QkAdapter import dev.octoshrimpy.quik.common.base.QkViewHolder -import dev.octoshrimpy.quik.util.GlideApp -import kotlinx.android.synthetic.main.attachment_image_list_item.view.* -import kotlinx.android.synthetic.main.scheduled_message_image_list_item.* +import dev.octoshrimpy.quik.extensions.resourceExists +import kotlinx.android.synthetic.main.scheduled_message_image_list_item.fileName +import kotlinx.android.synthetic.main.scheduled_message_image_list_item.thumbnail import javax.inject.Inject + class ScheduledMessageAttachmentAdapter @Inject constructor( private val context: Context ) : QkAdapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder { - val view = LayoutInflater.from(parent.context).inflate(R.layout.scheduled_message_image_list_item, parent, false) - view.thumbnail.clipToOutline = true - - return QkViewHolder(view) + return QkViewHolder( + LayoutInflater + .from(parent.context) + .inflate(R.layout.scheduled_message_image_list_item, parent, false) + ) } override fun onBindViewHolder(holder: QkViewHolder, position: Int) { - val attachment = getItem(position) + val uri = getItem(position) - GlideApp.with(context).load(attachment).into(holder.thumbnail) + // if uri target doesn't exist anymore + if (!uri.resourceExists(context)) { + holder.thumbnail.setImageResource(android.R.drawable.ic_delete) + holder.fileName.text = context.getString(R.string.attachment_missing) + holder.fileName.visibility = View.VISIBLE + return + } + + val mimeType = context.contentResolver.getType(uri) + + // if attachment mime type is image/* or video/*, use image/video-frame + if ((mimeType?.startsWith("image/") == true) || + (mimeType?.startsWith("video/") == true) + ) { + Glide + .with(context) + .load(uri) + .into(holder.thumbnail) + return + } + + // if audio mime type, try and use embedded image if one exists + if (mimeType?.startsWith("audio/") == true) { + val metaDataRetriever = MediaMetadataRetriever() + metaDataRetriever.setDataSource(context, uri) + val embeddedPicture = metaDataRetriever.embeddedPicture + if (embeddedPicture != null) { + Glide + .with(context) + .load(embeddedPicture) + .into(holder.thumbnail) + return + } + } + + // try and use icon from default app for type + val intent = Intent(Intent.ACTION_VIEW).setDataAndType(uri, mimeType) + val appIcon = context + .packageManager + .resolveActivity(intent, MATCH_DEFAULT) + ?.loadIcon(context.packageManager) + if (appIcon != null) + Glide + .with(context) + .load(appIcon) + .into(holder.thumbnail) + else if (mimeType?.startsWith("audio/") == true) + // else, if audio, use default local audio icon + Glide + .with(context) + .load(R.drawable.ic_round_volume_up_24) + .into(holder.thumbnail) + else + // else, use default attachment icon + Glide + .with(context) + .load(R.drawable.ic_attachment_black_24dp) + .into(holder.thumbnail) + + // else, show file name + val cursor = context.contentResolver.query( + uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null + ) + cursor?.use { + try { + cursor.moveToFirst() + holder.fileName.text = cursor.getString( + cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME) ?: 0 + ) + holder.fileName.visibility = View.VISIBLE + } catch (e: Exception) { + } + } } } diff --git a/presentation/src/main/res/drawable/ic_round_volume_up_24.xml b/presentation/src/main/res/drawable/ic_round_volume_up_24.xml new file mode 100644 index 00000000..cb631566 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_round_volume_up_24.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/presentation/src/main/res/layout/attachment_image_list_item.xml b/presentation/src/main/res/layout/attachment_file_list_item.xml similarity index 82% rename from presentation/src/main/res/layout/attachment_image_list_item.xml rename to presentation/src/main/res/layout/attachment_file_list_item.xml index ff757f03..b14e7827 100644 --- a/presentation/src/main/res/layout/attachment_image_list_item.xml +++ b/presentation/src/main/res/layout/attachment_file_list_item.xml @@ -37,7 +37,17 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" - tools:src="@tools:sample/avatars" /> + tools:src="@tools:sample/backgrounds/scenic[0]" /> + + diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index eac3add4..c8cf1ea5 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -204,7 +204,7 @@ android:layout_height="56dp" android:padding="10dp" android:src="@drawable/ic_cancel_black_24dp" - android:tint="?android:attr/textColorSecondary" + app:tint="?android:attr/textColorSecondary" app:layout_constraintBottom_toTopOf="@id/scheduledSeparator" app:layout_constraintEnd_toEndOf="@id/messageBackground" /> @@ -230,7 +230,7 @@ app:layout_constraintBottom_toTopOf="@id/message" app:layout_constraintEnd_toEndOf="@id/messageBackground" app:layout_constraintStart_toStartOf="@id/messageBackground" - tools:listitem="@layout/attachment_image_list_item" /> + tools:listitem="@layout/attachment_file_list_item" /> @@ -304,7 +304,7 @@ android:contentDescription="@string/compose_send_cd" android:padding="10dp" android:src="@drawable/ic_send_black_24dp" - android:tint="?android:textColorSecondary" + app:tint="?android:textColorSecondary" app:layout_constraintBottom_toBottomOf="@id/messageBackground" app:layout_constraintEnd_toEndOf="parent" /> @@ -371,7 +371,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" - app:constraint_referenced_ids="contact,contactLabel,schedule,scheduleLabel,gallery,galleryLabel,camera,cameraLabel,attachingBackground" /> + app:constraint_referenced_ids="contact,contactLabel,schedule,scheduleLabel,gallery,galleryLabel,attachAFileIcon,attachAFileLabel,camera,cameraLabel,attachingBackground" /> @@ -452,6 +452,43 @@ app:layout_constraintStart_toEndOf="@id/schedule" app:layout_constraintTop_toTopOf="@id/schedule" /> + + + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/values-el/strings.xml b/presentation/src/main/res/values-el/strings.xml index 9e8a538b..06ac0917 100644 --- a/presentation/src/main/res/values-el/strings.xml +++ b/presentation/src/main/res/values-el/strings.xml @@ -250,7 +250,7 @@ Send long messages as MMS If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply - Auto-compress MMS attachments + Auto-compress MMS image attachments Συγχρονισμός μηνυμάτων Επανασυγχρονισμός μηνυμάτων με τη βάση δεδομένων SMS του Android Σχετικά με το QUIK diff --git a/presentation/src/main/res/values-gd/strings.xml b/presentation/src/main/res/values-gd/strings.xml index e9e43c73..8c790a8e 100644 --- a/presentation/src/main/res/values-gd/strings.xml +++ b/presentation/src/main/res/values-gd/strings.xml @@ -254,7 +254,7 @@ Send long messages as MMS If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply - Auto-compress MMS attachments + Auto-compress MMS image attachments Sync messages Re-sync your messages with the native Android SMS database About QUIK diff --git a/presentation/src/main/res/values-lt/strings.xml b/presentation/src/main/res/values-lt/strings.xml index 22e2c9a0..ab1559e0 100644 --- a/presentation/src/main/res/values-lt/strings.xml +++ b/presentation/src/main/res/values-lt/strings.xml @@ -254,7 +254,7 @@ Send long messages as MMS If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply - Auto-compress MMS attachments + Auto-compress MMS image attachments Sinchronizuoti pranešimus Iš naujo sinchronizuoti Android pranešimų duomenų bazę Apie QUIK diff --git a/presentation/src/main/res/values-ne/strings.xml b/presentation/src/main/res/values-ne/strings.xml index 5921fd84..cad960c0 100644 --- a/presentation/src/main/res/values-ne/strings.xml +++ b/presentation/src/main/res/values-ne/strings.xml @@ -250,7 +250,7 @@ Send long messages as MMS If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply - Auto-compress MMS attachments + Auto-compress MMS image attachments Sync messages Re-sync your messages with the native Android SMS database About QUIK diff --git a/presentation/src/main/res/values-ta/strings.xml b/presentation/src/main/res/values-ta/strings.xml index 1319f51c..75b60836 100644 --- a/presentation/src/main/res/values-ta/strings.xml +++ b/presentation/src/main/res/values-ta/strings.xml @@ -250,7 +250,7 @@ நீண்ட செய்திகளை எம்.எம்.எஸ் ஆக அனுப்பு If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply - Auto-compress MMS attachments + Auto-compress MMS image attachments தகவல்களை ஒத்திசை Re-sync your messages with the native Android SMS database QUIK பற்றி diff --git a/presentation/src/main/res/values-tl/strings.xml b/presentation/src/main/res/values-tl/strings.xml index 3940f2bc..c156eaff 100644 --- a/presentation/src/main/res/values-tl/strings.xml +++ b/presentation/src/main/res/values-tl/strings.xml @@ -250,7 +250,7 @@ Send long messages as MMS If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply - Auto-compress MMS attachments + Auto-compress MMS image attachments Sync messages Re-sync your messages with the native Android SMS database About QUIK diff --git a/presentation/src/main/res/values-ur/strings.xml b/presentation/src/main/res/values-ur/strings.xml index 731e6f6e..029c80cc 100644 --- a/presentation/src/main/res/values-ur/strings.xml +++ b/presentation/src/main/res/values-ur/strings.xml @@ -250,7 +250,7 @@ Send long messages as MMS If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply - Auto-compress MMS attachments + Auto-compress MMS image attachments Sync messages Re-sync your messages with the native Android SMS database About QUIK diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 99f8d9b6..9e61419d 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -141,6 +141,7 @@ Delivered: %s Error code: %d Add an attachment + Attach any file Attach a photo Take a photo Schedule message @@ -211,6 +212,7 @@ Sending on December 23rd  Schedule a message Scheduled message + Missing Send now Copy text @@ -284,7 +286,7 @@ Send long messages as MMS If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply - Auto-compress MMS attachments + Auto-compress MMS image attachments Sync messages Re-sync your messages with the native Android SMS database About QUIK From b7a8389bf679332832d965d7b24441f60ccfafc7 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Mon, 27 Jan 2025 19:31:45 +1100 Subject: [PATCH 06/27] removed audio state maintenance from audiobinder on the compose screen into messagesadapter class. fixed other ui issues also related to state loss in audiobinder and re-use of viewholders --- .../com/moez/QKSMS/common/QkMediaPlayer.kt | 1 + .../common/util/extensions/ViewExtensions.kt | 23 +- .../QKSMS/feature/compose/MessagesAdapter.kt | 13 +- .../QKSMS/feature/compose/part/AudioBinder.kt | 262 +++++++++++------- .../feature/compose/part/PartsAdapter.kt | 23 +- .../res/drawable/audio_preview_foreground.png | Bin 54307 -> 53429 bytes .../layout/mms_audio_preview_list_item.xml | 2 +- 7 files changed, 211 insertions(+), 113 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/QkMediaPlayer.kt b/presentation/src/main/java/com/moez/QKSMS/common/QkMediaPlayer.kt index a28d98e6..623bd519 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/QkMediaPlayer.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/QkMediaPlayer.kt @@ -9,6 +9,7 @@ object QkMediaPlayer : MediaPlayer() { private var onCompletionListener: OnCompletionListener? = null enum class PlayingState { + None, Stopped, Playing, Paused diff --git a/presentation/src/main/java/com/moez/QKSMS/common/util/extensions/ViewExtensions.kt b/presentation/src/main/java/com/moez/QKSMS/common/util/extensions/ViewExtensions.kt index dbb98d11..526126a8 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/util/extensions/ViewExtensions.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/util/extensions/ViewExtensions.kt @@ -53,20 +53,29 @@ fun EditText.hideKeyboard() { imm.hideSoftInputFromWindow(windowToken, 0) } -fun ImageView.setTint(color: Int) { - imageTintList = ColorStateList.valueOf(color) +fun ImageView.setTint(color: Int?) { + imageTintList = + if (color == null) null + else ColorStateList.valueOf(color) } -fun ProgressBar.setTint(color: Int) { - indeterminateTintList = ColorStateList.valueOf(color) - progressTintList = ColorStateList.valueOf(color) +fun ProgressBar.setTint(color: Int?) { + indeterminateTintList = + if (color == null) null + else ColorStateList.valueOf(color) + progressTintList = + if (color == null) null + else ColorStateList.valueOf(color) + } -fun View.setBackgroundTint(color: Int) { +fun View.setBackgroundTint(color: Int?) { // API 21 doesn't support this - backgroundTintList = ColorStateList.valueOf(color) + backgroundTintList = + if (color == null) null + else ColorStateList.valueOf(color) } fun View.setPadding(left: Int? = null, top: Int? = null, right: Int? = null, bottom: Int? = null) { diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt index d8dd5061..7c9db537 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt @@ -32,6 +32,7 @@ import android.widget.ImageView import android.widget.ProgressBar import androidx.recyclerview.widget.RecyclerView import com.jakewharton.rxbinding2.view.clicks +import com.moez.QKSMS.common.QkMediaPlayer import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.common.base.QkRealmAdapter import dev.octoshrimpy.quik.common.base.QkViewHolder @@ -55,6 +56,7 @@ import dev.octoshrimpy.quik.model.Message import dev.octoshrimpy.quik.model.Recipient import dev.octoshrimpy.quik.util.PhoneNumberUtils import dev.octoshrimpy.quik.util.Preferences +import io.reactivex.disposables.Disposable import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.Subject import io.realm.RealmResults @@ -83,6 +85,13 @@ class MessagesAdapter @Inject constructor( private val textViewStyler: TextViewStyler ) : QkRealmAdapter() { + class AudioState( + var partId: Long = -1, + var state: QkMediaPlayer.PlayingState = QkMediaPlayer.PlayingState.Stopped, + var seekBarUpdater: Disposable? = null, + var viewHolder: QkViewHolder? = null + ) + companion object { private const val VIEW_TYPE_MESSAGE_IN = 0 private const val VIEW_TYPE_MESSAGE_OUT = 1 @@ -132,6 +141,8 @@ class MessagesAdapter @Inject constructor( var theme: Colors.Theme = colors.theme() + private val audioState = AudioState() + /** * If the viewType is negative, then the viewHolder has an attachment. We'll consider * this a unique viewType even though it uses the same view, so that regular messages @@ -283,7 +294,7 @@ class MessagesAdapter @Inject constructor( // Bind the attachments val partsAdapter = holder.attachments.adapter as PartsAdapter partsAdapter.theme = theme - partsAdapter.setData(message, previous, next, holder) + partsAdapter.setData(message, previous, next, holder, audioState) } private fun bindStatus(holder: QkViewHolder, message: Message, next: Message?) { diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt index c956deeb..0ab8ad63 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt @@ -33,16 +33,14 @@ import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint import dev.octoshrimpy.quik.common.util.extensions.setTint import dev.octoshrimpy.quik.common.widget.BubbleImageView import dev.octoshrimpy.quik.extensions.isAudio +import dev.octoshrimpy.quik.feature.compose.MessagesAdapter import dev.octoshrimpy.quik.model.Message import dev.octoshrimpy.quik.model.MmsPart import dev.octoshrimpy.quik.util.GlideApp import io.reactivex.Observable import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.disposables.Disposable import io.reactivex.schedulers.Schedulers import kotlinx.android.synthetic.main.mms_audio_preview_list_item.* -import kotlinx.android.synthetic.main.mms_audio_preview_list_item.view.playPause -import kotlinx.android.synthetic.main.mms_audio_preview_list_item.view.seekBar import kotlinx.android.synthetic.main.mms_image_preview_list_item.thumbnail import java.util.concurrent.TimeUnit import javax.inject.Inject @@ -53,91 +51,130 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte override val partLayout = R.layout.mms_audio_preview_list_item override var theme = colors.theme() - private var thisPlayingState = QkMediaPlayer.PlayingState.Stopped override fun canBindPart(part: MmsPart) = part.isAudio() + var audioState = MessagesAdapter.AudioState(-1, QkMediaPlayer.PlayingState.Stopped) + + private fun startSeekBarUpdateTimer() { + audioState.apply { + seekBarUpdater?.dispose() + seekBarUpdater = Observable.interval(500, TimeUnit.MILLISECONDS) + .subscribeOn(Schedulers.single()) + .observeOn(AndroidSchedulers.mainThread()) + .doOnNext { + viewHolder?.seekBar?.progress = QkMediaPlayer.currentPosition + } + .subscribe() + } + } + + private fun uiToPlaying(viewHolder: QkViewHolder) { + viewHolder.seekBar.max = QkMediaPlayer.duration + viewHolder.seekBar.isEnabled = true + viewHolder.seekBar.progress = QkMediaPlayer.currentPosition + viewHolder.playPause.setImageResource(R.drawable.exo_icon_pause) + viewHolder.playPause.tag = QkMediaPlayer.PlayingState.Playing + viewHolder.metadataTitle.isSelected = true // start marquee + } + + private fun uiToPaused(viewHolder: QkViewHolder) { + viewHolder.playPause.setImageResource(R.drawable.exo_icon_play) + viewHolder.playPause.tag = QkMediaPlayer.PlayingState.Paused + } + + private fun uiToStopped(viewHolder: QkViewHolder) { + viewHolder.seekBar.progress = 0 + viewHolder.seekBar.max = 0 + viewHolder.seekBar.isEnabled = false + viewHolder.playPause.setImageResource(R.drawable.exo_icon_play) + viewHolder.playPause.tag = QkMediaPlayer.PlayingState.Stopped + viewHolder.metadataTitle.isSelected = false // stop marquee + } + override fun bindPart( holder: QkViewHolder, part: MmsPart, message: Message, canGroupWithPrevious: Boolean, - canGroupWithNext: Boolean + canGroupWithNext: Boolean, ) { // play/pause button click handling - holder.playPause.setOnClickListener { view -> - var seekBarUpdater: Disposable? = null + holder.playPause.setOnClickListener { + when (holder.playPause.tag) { + QkMediaPlayer.PlayingState.Playing -> { + if (audioState.partId == part.id) { + QkMediaPlayer.pause() + uiToPaused(holder) + audioState.state = QkMediaPlayer.PlayingState.Paused - when (thisPlayingState) { - QkMediaPlayer.PlayingState.Stopped -> { - QkMediaPlayer.apply { - reset() // make sure reset before trying to (re-)use - - setAudioAttributes( - AudioAttributes.Builder() - .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) // music, maybe?? could be voice. don't want to use CONTENT_TYPE_UNKNOWN though - .setUsage(AudioAttributes.USAGE_MEDIA) - .build() - ) - - setDataSource(context, part.getUri()) - - setOnPreparedListener { - // start timer to update seek bar - seekBarUpdater = Observable.interval(500, TimeUnit.MILLISECONDS) - .subscribeOn(Schedulers.single()) - .observeOn(AndroidSchedulers.mainThread()) - .map { System.nanoTime() } - .doOnNext { holder.seekBar.progress = QkMediaPlayer.currentPosition } - .subscribe() - - // set seek bar max value - holder.seekBar.max = QkMediaPlayer.duration - - start() - - thisPlayingState = QkMediaPlayer.PlayingState.Playing - view.playPause.setImageResource(R.drawable.exo_icon_pause) - holder.containerView.seekBar.isEnabled = true - holder.metadataTitle.isSelected = true - } - - setOnCompletionListener { // also called on error because we don't have an onerrorlistener - seekBarUpdater?.dispose() // stop timer - - thisPlayingState = QkMediaPlayer.PlayingState.Stopped - holder.containerView.seekBar.seekBar.isEnabled = false - holder.containerView.seekBar.seekBar.progress = 0 - view.playPause.setImageResource(R.drawable.exo_icon_play) - holder.metadataTitle.isSelected = false - } - - // prepare to play - prepareAsync() + // stop progress bar update timer + audioState.seekBarUpdater?.dispose() } } - QkMediaPlayer.PlayingState.Playing -> { - QkMediaPlayer.pause() - view.playPause.setImageResource(R.drawable.exo_icon_play) - thisPlayingState = QkMediaPlayer.PlayingState.Paused - } QkMediaPlayer.PlayingState.Paused -> { - QkMediaPlayer.start() - view.playPause.setImageResource(R.drawable.exo_icon_pause) - thisPlayingState = QkMediaPlayer.PlayingState.Playing + if (audioState.partId == part.id) { + QkMediaPlayer.start() + uiToPlaying(holder) + audioState.state = QkMediaPlayer.PlayingState.Playing + + // start progress bar update timer + startSeekBarUpdateTimer() + } + } + else -> { + QkMediaPlayer.reset() // make sure reset before trying to (re-)use + + QkMediaPlayer.setOnPreparedListener { + // start media playing + QkMediaPlayer.start() + + uiToPlaying(holder) + + // set current view holder and part as active + audioState.apply { + audioState.state = QkMediaPlayer.PlayingState.Playing + partId = part.id + viewHolder = holder + } + + // start progress bar update timer + startSeekBarUpdateTimer() + } + + QkMediaPlayer.setOnCompletionListener { // also called on error because we don't have an onerrorlistener + audioState.apply { + // if this part is currently active, set it to stopped and inactive + if ((partId == part.id) && (viewHolder != null)) + uiToStopped(viewHolder!!) + + state = QkMediaPlayer.PlayingState.Stopped + partId = -1 + viewHolder = null + } + } + + // start the media player play sequence + QkMediaPlayer.setAudioAttributes( + AudioAttributes.Builder() + .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) // music, maybe?? could be voice. don't want to use CONTENT_TYPE_UNKNOWN though + .setUsage(AudioAttributes.USAGE_MEDIA) + .build() + ) + + QkMediaPlayer.setDataSource(context, part.getUri()) + + QkMediaPlayer.prepareAsync() } } } - holder.thumbnail.bubbleStyle = when { - !canGroupWithPrevious && canGroupWithNext -> - if (message.isMe()) BubbleImageView.Style.OUT_FIRST else BubbleImageView.Style.IN_FIRST - canGroupWithPrevious && canGroupWithNext -> - if (message.isMe()) BubbleImageView.Style.OUT_MIDDLE else BubbleImageView.Style.IN_MIDDLE - canGroupWithPrevious && !canGroupWithNext -> - if (message.isMe()) BubbleImageView.Style.OUT_LAST else BubbleImageView.Style.IN_LAST - else -> BubbleImageView.Style.ONLY - } + // if this item is the active active audio item update the active view holder + if (audioState.partId == part.id) + audioState.viewHolder = holder + // else, this is not the active item so ensure the stored view holder is not this one + else if (audioState.viewHolder == holder) + audioState.viewHolder = null // tint colours val secondaryColor = @@ -151,9 +188,6 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte else holder.containerView.context.resolveThemeColor(android.R.attr.textColorPrimary) - val metaDataRetriever = MediaMetadataRetriever() - metaDataRetriever.setDataSource(context, part.getUri()) - // sound wave holder.soundWave.setTint(primaryColor) @@ -161,11 +195,11 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte holder.seekBar.apply { setTint(secondaryColor) thumbTintList = ColorStateList.valueOf(secondaryColor) - max = 0 - isEnabled = false + setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { override fun onProgressChanged(p0: SeekBar?, progress: Int, fromUser: Boolean) { - if ((thisPlayingState != QkMediaPlayer.PlayingState.Stopped) && fromUser) + // if seek was initiated by the user and this part is currently playing + if (fromUser) QkMediaPlayer.seekTo(progress) } override fun onStartTrackingTouch(p0: SeekBar?) { /* nothing */ } @@ -175,35 +209,65 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte // playPause button holder.playPause. apply { + if ((audioState.partId == part.id) && + (audioState.state == QkMediaPlayer.PlayingState.Playing)) + uiToPlaying(holder) + else if ((audioState.partId == part.id) && + (audioState.state == QkMediaPlayer.PlayingState.Paused)) + uiToPaused(holder) + else + uiToStopped(holder) + setTint(secondaryColor) setBackgroundTint(primaryColor) } - holder.metadataTitle.apply { - // metadata title - text = metaDataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE) ?: "" + MediaMetadataRetriever().use { + it.setDataSource(context, part.getUri()) - if (text == "") - visibility = View.GONE - else { - setTextColor(primaryColor) - setBackgroundTint(0xccffffff.toInt() and secondaryColor) // hex value is alpha + // metadata title + holder.metadataTitle.apply { + text = it.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE) + + if (text.isEmpty()) + visibility = View.GONE + else { + visibility = View.VISIBLE + setTextColor(primaryColor) + setBackgroundTint(0xccffffff.toInt() and secondaryColor) // hex value is alpha + } + } + + // bubble / embedded image + holder.thumbnail.apply { + bubbleStyle = when { + !canGroupWithPrevious && canGroupWithNext -> + if (message.isMe()) BubbleImageView.Style.OUT_FIRST else BubbleImageView.Style.IN_FIRST + canGroupWithPrevious && canGroupWithNext -> + if (message.isMe()) BubbleImageView.Style.OUT_MIDDLE else BubbleImageView.Style.IN_MIDDLE + canGroupWithPrevious && !canGroupWithNext -> + if (message.isMe()) BubbleImageView.Style.OUT_LAST else BubbleImageView.Style.IN_LAST + else -> BubbleImageView.Style.ONLY + } + + val embeddedPicture = it.embeddedPicture + if (embeddedPicture == null) { + holder.frame.layoutParams.height = (holder.frame.layoutParams.width / 2) + setTint(secondaryColor) + setImageResource(R.drawable.rectangle) + } else { + holder.frame.layoutParams.height = holder.frame.layoutParams.width + setTint(null) + GlideApp.with(context) + .asBitmap() + .load(embeddedPicture) + .override( + holder.frame.layoutParams.width, + holder.frame.layoutParams.height + ) + .into(this) + } } } - - // embedded image - val embeddedPicture = metaDataRetriever.embeddedPicture - if (embeddedPicture == null) { - holder.thumbnail.setTint(secondaryColor) - holder.frame.layoutParams.height /= 2 - holder.thumbnail.requestLayout() - } else { - GlideApp.with(context) - .asBitmap() - .load(embeddedPicture) - .into(holder.thumbnail) - } - - metaDataRetriever.close() } } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/PartsAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/PartsAdapter.kt index 68d26a1c..7449616c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/PartsAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/PartsAdapter.kt @@ -28,6 +28,7 @@ import dev.octoshrimpy.quik.common.util.extensions.forwardTouches import dev.octoshrimpy.quik.extensions.isSmil import dev.octoshrimpy.quik.extensions.isText import dev.octoshrimpy.quik.feature.compose.BubbleUtils.canGroup +import dev.octoshrimpy.quik.feature.compose.MessagesAdapter import dev.octoshrimpy.quik.model.Message import dev.octoshrimpy.quik.model.MmsPart import io.reactivex.Observable @@ -39,7 +40,7 @@ class PartsAdapter @Inject constructor( fileBinder: FileBinder, imageBinder: ImageBinder, audioBinder: AudioBinder, - vCardBinder: VCardBinder + vCardBinder: VCardBinder, ) : QkAdapter() { private val partBinders = listOf(audioBinder, imageBinder, vCardBinder, fileBinder) @@ -57,14 +58,22 @@ class PartsAdapter @Inject constructor( private var next: Message? = null private var holder: QkViewHolder? = null private var bodyVisible: Boolean = true + private var audioState: MessagesAdapter.AudioState? = null - fun setData(message: Message, previous: Message?, next: Message?, holder: QkViewHolder) { + fun setData( + message: Message, + previous: Message?, + next: Message?, + holder: QkViewHolder, + audioState: MessagesAdapter.AudioState? + ) { this.message = message this.previous = previous this.next = next this.holder = holder this.bodyVisible = holder.body.visibility == View.VISIBLE this.data = message.parts.filter { !it.isSmil() && !it.isText() } + this.audioState = audioState } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder { @@ -80,9 +89,13 @@ class PartsAdapter @Inject constructor( val canGroupWithPrevious = canGroup(message, previous) || position > 0 val canGroupWithNext = canGroup(message, next) || position < itemCount - 1 || bodyVisible - partBinders - .firstOrNull { it.canBindPart(part) } - ?.bindPart(holder, part, message, canGroupWithPrevious, canGroupWithNext) + val binder = partBinders.firstOrNull { it.canBindPart(part) } + + // if audioState is set and binder is audio type, set audioState into it + if ((audioState != null) && (binder is AudioBinder)) + binder.audioState = audioState!! + + binder?.bindPart(holder, part, message, canGroupWithPrevious, canGroupWithNext) } override fun getItemViewType(position: Int): Int { diff --git a/presentation/src/main/res/drawable/audio_preview_foreground.png b/presentation/src/main/res/drawable/audio_preview_foreground.png index bf87f59e47c86776bd99261e2ed3870398f0c361..21a7354815936d47c2d56d3b4334f2eedcdfd881 100644 GIT binary patch delta 24302 zcmXtSgf3K?0y{`viX9*=X*u74?o0mUDH6L_5dO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nkdK zw)B;z%SL-!#S(Liu`|Gmendz3U?IuXxd1+)#KV0}r9g}fsL2z?lf#k*_^ zKHmu2N4K=jV!_+i+oFwGiRNwvt^Nlxb{y`B-fqd9+o7d`%>Tm From 580ad9d02da02acedd04568763eb61afc553048e Mon Sep 17 00:00:00 2001 From: gavine99 Date: Mon, 27 Jan 2025 20:35:33 +1100 Subject: [PATCH 07/27] added onclick listener to audiobinder. removed recycledviewpool from parts adapter because it was recycling too fast and messing with attachment/part selection --- .../main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt | 2 -- .../java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt index 7c9db537..9e92bb2d 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt @@ -136,7 +136,6 @@ class MessagesAdapter @Inject constructor( private val contactCache = ContactCache() private val expanded = HashMap() - private val partsViewPool = RecyclerView.RecycledViewPool() private val subs = subscriptionManager.activeSubscriptionInfoList var theme: Colors.Theme = colors.theme() @@ -167,7 +166,6 @@ class MessagesAdapter @Inject constructor( val partsAdapter = partsAdapterProvider.get() partsAdapter.clicks.subscribe(partClicks) view.attachments.adapter = partsAdapter - view.attachments.setRecycledViewPool(partsViewPool) view.body.forwardTouches(view) return QkViewHolder(view).apply { diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt index 0ab8ad63..b253185c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/AudioBinder.kt @@ -169,6 +169,8 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte } } + holder.containerView.setOnClickListener { clicks.onNext(part.id) } + // if this item is the active active audio item update the active view holder if (audioState.partId == part.id) audioState.viewHolder = holder From 119e5d035586fd703ed1dd8127cfd62aef27d4ad Mon Sep 17 00:00:00 2001 From: gavine99 Date: Tue, 28 Jan 2025 11:41:56 +1100 Subject: [PATCH 08/27] fix bug in unblock number that crashed app by attempting to execute realm transaction on main thread. moved transaction to execute on io thread. --- .../numbers/BlockedNumbersPresenter.kt | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/numbers/BlockedNumbersPresenter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/numbers/BlockedNumbersPresenter.kt index edc77098..8ada8c8a 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/numbers/BlockedNumbersPresenter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/numbers/BlockedNumbersPresenter.kt @@ -39,24 +39,26 @@ class BlockedNumbersPresenter @Inject constructor( super.bindIntents(view) view.unblockAddress() - .doOnNext { id -> - blockingRepo.getBlockedNumber(id)?.address - ?.let(conversationRepo::getThreadId) - ?.let { threadId -> markUnblocked.execute(listOf(threadId)) } - } - .doOnNext(blockingRepo::unblockNumber) - .subscribeOn(Schedulers.io()) - .autoDisposable(view.scope()) - .subscribe() + .observeOn(Schedulers.io()) + .doOnNext { id -> + blockingRepo.getBlockedNumber(id)?.address + ?.let(conversationRepo::getThreadId) + ?.let { threadId -> markUnblocked.execute(listOf(threadId)) } + } + .doOnNext(blockingRepo::unblockNumber) + .subscribeOn(Schedulers.io()) + .autoDisposable(view.scope()) + .subscribe() view.addAddress() - .autoDisposable(view.scope()) - .subscribe { view.showAddDialog() } + .autoDisposable(view.scope()) + .subscribe { view.showAddDialog() } view.saveAddress() - .subscribeOn(Schedulers.io()) - .autoDisposable(view.scope()) - .subscribe { address -> blockingRepo.blockNumber(address) } + .observeOn(Schedulers.io()) + .subscribeOn(Schedulers.io()) + .autoDisposable(view.scope()) + .subscribe { address -> blockingRepo.blockNumber(address) } } } From 76922b583e8dc53e2f6c8c78e662f58dcdcb9a58 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Tue, 28 Jan 2025 15:22:05 +1100 Subject: [PATCH 09/27] changes to make new message notifications silent if any of the recipients of the new message are not in user's contacts. new setting on settings->notifications page --- .../QKSMS/repository/ContactRepositoryImpl.kt | 9 +++++++ .../QKSMS/repository/ContactRepository.kt | 2 ++ .../java/com/moez/QKSMS/util/Preferences.kt | 1 + .../common/util/NotificationManagerImpl.kt | 24 ++++++++++++++++--- .../NotificationPrefsActivity.kt | 2 ++ .../NotificationPrefsState.kt | 1 + .../NotificationPrefsViewModel.kt | 5 ++++ .../layout/notification_prefs_activity.xml | 10 +++++++- presentation/src/main/res/values/strings.xml | 3 +++ 9 files changed, 53 insertions(+), 4 deletions(-) diff --git a/data/src/main/java/com/moez/QKSMS/repository/ContactRepositoryImpl.kt b/data/src/main/java/com/moez/QKSMS/repository/ContactRepositoryImpl.kt index f07aab19..2d48fbb0 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/ContactRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/ContactRepositoryImpl.kt @@ -82,6 +82,15 @@ class ContactRepositoryImpl @Inject constructor( } } + override fun getUnmanagedAllContacts(): List { + val realm = Realm.getDefaultInstance() + + return realm + .where(Contact::class.java) + .findAll() + .map { realm.copyFromRealm(it) } + } + override fun getUnmanagedContacts(starred: Boolean): Observable> { val realm = Realm.getDefaultInstance() diff --git a/domain/src/main/java/com/moez/QKSMS/repository/ContactRepository.kt b/domain/src/main/java/com/moez/QKSMS/repository/ContactRepository.kt index a78620a5..88341465 100644 --- a/domain/src/main/java/com/moez/QKSMS/repository/ContactRepository.kt +++ b/domain/src/main/java/com/moez/QKSMS/repository/ContactRepository.kt @@ -33,6 +33,8 @@ interface ContactRepository { fun getUnmanagedContact(lookupKey: String): Contact? + fun getUnmanagedAllContacts(): List + fun getUnmanagedContacts(starred: Boolean = false): Observable> fun getUnmanagedContactGroups(): Observable> diff --git a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt index 86a99abc..ff43a3c8 100644 --- a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt +++ b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt @@ -107,6 +107,7 @@ class Preferences @Inject constructor( val textSize = rxPrefs.getInteger("textSize", TEXT_SIZE_NORMAL) val blockingManager = rxPrefs.getInteger("blockingManager", BLOCKING_MANAGER_QKSMS) val drop = rxPrefs.getBoolean("drop", false) + val silentNotContact = rxPrefs.getBoolean("silentNotContact", false) val notifAction1 = rxPrefs.getInteger("notifAction1", NOTIFICATION_ACTION_READ) val notifAction2 = rxPrefs.getInteger("notifAction2", NOTIFICATION_ACTION_REPLY) val notifAction3 = rxPrefs.getInteger("notifAction3", NOTIFICATION_ACTION_NONE) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/util/NotificationManagerImpl.kt b/presentation/src/main/java/com/moez/QKSMS/common/util/NotificationManagerImpl.kt index f3fee9f2..ee4bb43e 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/util/NotificationManagerImpl.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/util/NotificationManagerImpl.kt @@ -52,6 +52,7 @@ import dev.octoshrimpy.quik.receiver.MarkReadReceiver import dev.octoshrimpy.quik.receiver.MarkSeenReceiver import dev.octoshrimpy.quik.receiver.RemoteMessagingReceiver import dev.octoshrimpy.quik.receiver.SpeakThreadsReceiver +import dev.octoshrimpy.quik.repository.ContactRepository import dev.octoshrimpy.quik.repository.ConversationRepository import dev.octoshrimpy.quik.repository.MessageRepository import dev.octoshrimpy.quik.util.GlideApp @@ -70,7 +71,8 @@ class NotificationManagerImpl @Inject constructor( private val prefs: Preferences, private val messageRepo: MessageRepository, private val permissions: PermissionManager, - private val phoneNumberUtils: PhoneNumberUtils + private val phoneNumberUtils: PhoneNumberUtils, + private val contactRepo: ContactRepository, ) : dev.octoshrimpy.quik.manager.NotificationManager { companion object { @@ -145,12 +147,28 @@ class NotificationManagerImpl @Inject constructor( .setAutoCancel(true) .setContentIntent(contentPI) .setDeleteIntent(seenPI) - .setSound(ringtone) .setLights(Color.WHITE, 500, 2000) .setWhen(conversation.lastMessage?.date ?: System.currentTimeMillis()) .setVibrate(if (prefs.vibration(threadId).get()) VIBRATE_PATTERN else longArrayOf(0)) - // Tell the notification if it's a group message + // if preference set to silence notifications if no recipients in contacts + if (prefs.silentNotContact.get() && run { + val msgRecipientNumbers = conversation.recipients.map { it.address } + + // true if any message recipients are in device's contacts + !contactRepo + .getUnmanagedAllContacts() + .flatMap { it.numbers } + .map { it.address } + .any { contactNumber -> + msgRecipientNumbers.any { phoneNumberUtils.compare(contactNumber, it) } + } + }) + notification.setSilent(true) + else + notification.setSound(ringtone) + + // Tell the notification if it's a group message val messagingStyle = NotificationCompat.MessagingStyle("Me") if (conversation.recipients.size >= 2) { messagingStyle.isGroupConversation = true diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsActivity.kt index 1a5d4cd2..37ecdbf5 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsActivity.kt @@ -99,6 +99,8 @@ class NotificationPrefsActivity : QkThemedActivity(), NotificationPrefsView { previews.summary = state.previewSummary previewModeDialog.adapter.selectedItem = state.previewId wake.checkbox.isChecked = state.wakeEnabled + silentNotContact.checkbox.isChecked = state.silentNotContact + silentNotContact.isVisible = state.threadId == 0L vibration.checkbox.isChecked = state.vibrationEnabled ringtone.summary = state.ringtoneName diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsState.kt b/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsState.kt index 65799cc0..85b7ca81 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsState.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsState.kt @@ -28,6 +28,7 @@ data class NotificationPrefsState( val previewSummary: String = "", val previewId: Int = Preferences.NOTIFICATION_PREVIEWS_ALL, val wakeEnabled: Boolean = false, + val silentNotContact: Boolean = false, val action1Summary: String = "", val action2Summary: String = "", val action3Summary: String = "", diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsViewModel.kt index 405d0bdf..39b531bb 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/notificationprefs/NotificationPrefsViewModel.kt @@ -79,6 +79,9 @@ class NotificationPrefsViewModel @Inject constructor( disposables += wake.asObservable() .subscribe { enabled -> newState { copy(wakeEnabled = enabled) } } + disposables += prefs.silentNotContact.asObservable() + .subscribe { enabled -> newState { copy(silentNotContact = enabled) } } + disposables += vibration.asObservable() .subscribe { enabled -> newState { copy(vibrationEnabled = enabled) } } @@ -113,6 +116,8 @@ class NotificationPrefsViewModel @Inject constructor( R.id.wake -> wake.set(!wake.get()) + R.id.silentNotContact -> prefs.silentNotContact.set(!prefs.silentNotContact.get()) + R.id.vibration -> vibration.set(!vibration.get()) R.id.ringtone -> view.showRingtonePicker(ringtone.get().takeIf { it.isNotEmpty() }?.let(Uri::parse)) diff --git a/presentation/src/main/res/layout/notification_prefs_activity.xml b/presentation/src/main/res/layout/notification_prefs_activity.xml index 2b8db770..b7266085 100644 --- a/presentation/src/main/res/layout/notification_prefs_activity.xml +++ b/presentation/src/main/res/layout/notification_prefs_activity.xml @@ -70,7 +70,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:title="@string/settings_notification_previews_title" - tools:summary="Show name and message" /> + tools:summary="@string/settings_notification_previews_summary" /> + + Button 2 Button 3 Notification previews + Show name and message Wake screen + Silent if not a contact + Silences notifications for messages without recipients in your contacts Vibration Sound None From 43b8e70a1286902e9a948c70c234c5fcb2e08f58 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sun, 19 Jan 2025 21:03:28 +1100 Subject: [PATCH 10/27] added a 'send now' button to delay sent sms. user can now long press 'send now' to send a delayed message immediately --- .../QKSMS/feature/compose/ComposeActivity.kt | 1 + .../moez/QKSMS/feature/compose/ComposeView.kt | 1 + .../QKSMS/feature/compose/ComposeViewModel.kt | 20 ++ .../QKSMS/feature/compose/MessagesAdapter.kt | 46 ++-- .../main/res/layout/message_list_item_out.xml | 244 ++++++++++-------- presentation/src/main/res/values/strings.xml | 6 + 6 files changed, 198 insertions(+), 120 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt index c76ad421..213bdd5d 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt @@ -99,6 +99,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val messagePartClickIntent: Subject by lazy { messageAdapter.partClicks } override val messagesSelectedIntent by lazy { messageAdapter.selectionChanges } override val cancelSendingIntent: Subject by lazy { messageAdapter.cancelSending } + override val sendNowIntent: Subject by lazy { messageAdapter.sendNow } override val attachmentDeletedIntent: Subject by lazy { attachmentAdapter.attachmentDeleted } override val textChangedIntent by lazy { message.textChanges() } override val attachIntent by lazy { Observable.merge(attach.clicks(), attachingBackground.clicks()) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt index 7d4f3d2e..14c2e28e 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt @@ -48,6 +48,7 @@ interface ComposeView : QkView { val messagePartClickIntent: Subject val messagesSelectedIntent: Observable> val cancelSendingIntent: Subject + val sendNowIntent: Subject val attachmentDeletedIntent: Subject val textChangedIntent: Observable val attachIntent: Observable diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index aa6b27ec..095db3e4 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -487,6 +487,26 @@ class ComposeViewModel @Inject constructor( cancelMessage.execute(CancelDelayedMessage.Params(message.id, message.threadId)) } + // send a delayed message now + view.sendNowIntent + .mapNotNull(messageRepo::getMessage) + .autoDisposable(view.scope()) + .subscribe { message -> + cancelMessage.execute(CancelDelayedMessage.Params(message.id, message.threadId)) + val address = listOf(conversationRepo + .getConversation(threadId)?.recipients?.firstOrNull()?.address ?: message.address) + sendMessage.execute( + SendMessage.Params( + message.subId, + message.threadId, + address, + message.body, + listOf(), // sms with attachments (mms) can't be delayed so we can know attachments are empty for a 'send now' delayed sms + 0 + ) + ) + } + // Set the current conversation Observables .combineLatest( diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt index 9e92bb2d..58cdbd58 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt @@ -32,6 +32,7 @@ import android.widget.ImageView import android.widget.ProgressBar import androidx.recyclerview.widget.RecyclerView import com.jakewharton.rxbinding2.view.clicks +import com.jakewharton.rxbinding2.view.longClicks import com.moez.QKSMS.common.QkMediaPlayer import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.common.base.QkRealmAdapter @@ -69,6 +70,7 @@ import kotlinx.android.synthetic.main.message_list_item_in.status import kotlinx.android.synthetic.main.message_list_item_in.timestamp import kotlinx.android.synthetic.main.message_list_item_in.view.* import kotlinx.android.synthetic.main.message_list_item_out.* +import kotlinx.android.synthetic.main.message_list_item_out.view.cancel import java.util.* import java.util.concurrent.TimeUnit import javax.inject.Inject @@ -106,6 +108,7 @@ class MessagesAdapter @Inject constructor( val clicks: Subject = PublishSubject.create() val partClicks: Subject = PublishSubject.create() val cancelSending: Subject = PublishSubject.create() + val sendNow: Subject = PublishSubject.create() var data: Pair>? = null set(value) { @@ -157,6 +160,7 @@ class MessagesAdapter @Inject constructor( view = layoutInflater.inflate(R.layout.message_list_item_out, parent, false) view.findViewById(R.id.cancelIcon).setTint(theme.theme) view.findViewById(R.id.cancel).setTint(theme.theme) + view.findViewById(R.id.sendNowIcon).setTint(theme.theme) } else { view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false) } @@ -202,25 +206,37 @@ class MessagesAdapter @Inject constructor( // Update the selected state holder.containerView.isActivated = isSelected(message.id) || highlight == message.id - // Bind the cancel view - holder.cancel?.let { cancel -> - val isCancellable = message.isSending() && message.date > System.currentTimeMillis() - cancel.setVisible(isCancellable) - cancel.clicks().subscribe { cancelSending.onNext(message.id) } - cancel.progress = 2 + // Bind the cancelFrame (cancel button) view + if (holder.cancelFrame != null) { + holder.cancelFrame.let { cancelFrame -> + val isCancellable = message.isSending() && message.date > System.currentTimeMillis() + cancelFrame.visibility = if (isCancellable) View.VISIBLE else View.GONE + cancelFrame.clicks().subscribe { cancelSending.onNext(message.id) } + cancelFrame.cancel.progress = 2 - if (isCancellable) { - val delay = when (prefs.sendDelay.get()) { - Preferences.SEND_DELAY_SHORT -> 3000 - Preferences.SEND_DELAY_MEDIUM -> 5000 - Preferences.SEND_DELAY_LONG -> 10000 - else -> 0 - } - val progress = (1 - (message.date - System.currentTimeMillis()) / delay.toFloat()) * 100 + if (isCancellable) { + val delay = when (prefs.sendDelay.get()) { + Preferences.SEND_DELAY_SHORT -> 3000 + Preferences.SEND_DELAY_MEDIUM -> 5000 + Preferences.SEND_DELAY_LONG -> 10000 + else -> 0 + } + val progress = + (1 - (message.date - System.currentTimeMillis()) / delay.toFloat()) * 100 - ObjectAnimator.ofInt(cancel, "progress", progress.toInt(), 100) + ObjectAnimator.ofInt(cancelFrame.cancel, "progress", progress.toInt(), 100) .setDuration(message.date - System.currentTimeMillis()) .start() + } + } + } + + // Bind the send now icon view + if (holder.sendNowIcon != null) { + holder.sendNowIcon.let { sendNowIcon -> + val isCancellable = message.isSending() && message.date > System.currentTimeMillis() + sendNowIcon.visibility = if (isCancellable) View.VISIBLE else View.GONE + sendNowIcon.longClicks().subscribe { sendNow.onNext(message.id) } } } diff --git a/presentation/src/main/res/layout/message_list_item_out.xml b/presentation/src/main/res/layout/message_list_item_out.xml index b2942b2d..92a6071b 100644 --- a/presentation/src/main/res/layout/message_list_item_out.xml +++ b/presentation/src/main/res/layout/message_list_item_out.xml @@ -17,133 +17,167 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:orientation="vertical"> - + android:background="?attr/selectableItemBackground" + android:contentDescription="@string/compose_message_item"> - + - + + + + + + + + + android:clipToPadding="false" + android:orientation="horizontal" + app:layout_constraintBottom_toBottomOf="parent"> - + - + - + - + + + + + + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 9e61419d..3a132b5e 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -152,6 +152,12 @@ %s selected, change SIM card Send message + Cancel + Send now + SIM number + Message item + Attachment + Sending… Delivered %s Failed to send. Tap to try again From 1113ed6bc05c008b04d2ec66a30444b9aca85567 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sun, 19 Jan 2025 21:23:02 +1100 Subject: [PATCH 11/27] fixed not properly rendering selection background of updated message_list_item_out view --- presentation/src/main/res/layout/message_list_item_out.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/res/layout/message_list_item_out.xml b/presentation/src/main/res/layout/message_list_item_out.xml index 92a6071b..d34c67b8 100644 --- a/presentation/src/main/res/layout/message_list_item_out.xml +++ b/presentation/src/main/res/layout/message_list_item_out.xml @@ -22,13 +22,13 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" android:orientation="vertical"> Date: Tue, 28 Jan 2025 16:38:00 +1100 Subject: [PATCH 12/27] rebased to master. moved send now button to rhs. changed send now button long press to short/normal press --- .../QKSMS/feature/compose/MessagesAdapter.kt | 2 +- .../main/res/layout/message_list_item_out.xml | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt index 58cdbd58..37f7513d 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt @@ -236,7 +236,7 @@ class MessagesAdapter @Inject constructor( holder.sendNowIcon.let { sendNowIcon -> val isCancellable = message.isSending() && message.date > System.currentTimeMillis() sendNowIcon.visibility = if (isCancellable) View.VISIBLE else View.GONE - sendNowIcon.longClicks().subscribe { sendNow.onNext(message.id) } + sendNowIcon.clicks().subscribe { sendNow.onNext(message.id) } } } diff --git a/presentation/src/main/res/layout/message_list_item_out.xml b/presentation/src/main/res/layout/message_list_item_out.xml index d34c67b8..33e4fe38 100644 --- a/presentation/src/main/res/layout/message_list_item_out.xml +++ b/presentation/src/main/res/layout/message_list_item_out.xml @@ -138,17 +138,6 @@ android:layout_height="match_parent" android:layout_weight="1" /> - - + + Date: Tue, 28 Jan 2025 08:48:03 -0700 Subject: [PATCH 13/27] Update short_description.txt makes it fit within 80 char --- metadata/fr-FR/short_description.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata/fr-FR/short_description.txt b/metadata/fr-FR/short_description.txt index 8033a13c..c0d7a188 100644 --- a/metadata/fr-FR/short_description.txt +++ b/metadata/fr-FR/short_description.txt @@ -1 +1 @@ -Remplacement open source de l'application SMS d'origine d'Android. Renaissance de QKSMS. +Remplacement open source de l'appli SMS Android. Renaissance de QKSMS. From 49fdc967ded5b4aada609e156fa40d034b160fcd Mon Sep 17 00:00:00 2001 From: octoshrimpy Date: Tue, 28 Jan 2025 08:54:52 -0700 Subject: [PATCH 14/27] Update build.gradle --- presentation/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/presentation/build.gradle b/presentation/build.gradle index f8e3ca3c..fef473a5 100644 --- a/presentation/build.gradle +++ b/presentation/build.gradle @@ -30,13 +30,13 @@ android { applicationId 'dev.octoshrimpy.quik' minSdkVersion 23 targetSdkVersion 33 - versionCode 2225 - versionName '4.0.8' + versionCode 2226 + versionName '4.0.9' setProperty("archivesBaseName", "QUIK-v${versionName}") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" setProperty("archivesBaseName", "QUIK-v${versionName}") - versionNameSuffix '-alpha' + versionNameSuffix '-beta' } signingConfigs { From 8c17e4592da6e03eabfd18e58e960b87e247480f Mon Sep 17 00:00:00 2001 From: octoshrimpy Date: Tue, 28 Jan 2025 08:59:44 -0700 Subject: [PATCH 15/27] Update changelog.json --- data/src/main/assets/changelog.json | 33 ++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/data/src/main/assets/changelog.json b/data/src/main/assets/changelog.json index a29c646e..7927b623 100644 --- a/data/src/main/assets/changelog.json +++ b/data/src/main/assets/changelog.json @@ -1,5 +1,36 @@ -[ { +[ + { + "versionCode": 2226, + "versionName": "4.0.9", + "added": [ + "Basic speech to text for compose (and qkreply)", + "Text to speech", + "Add 'super' font size setting", + "Basic speech to text for compose (and qkreply) take 2", + "Make unread conversations float at the top of conversation lists", + "Select and copy a text part", + "Add 'super' font size setting - take 2", + "Main widget launch appropriate app activities", + "Change convo name from main convo activity", + "Play audio attachments", + "Select all on conversations and compose screens. New compose 'show status' option", + "Build on pull request", + "Update French translation", + "Changes to allow attaching *any* type of file", + "Update French translation" + ], + "fixed": [ + "Bug fix for motion events being used after recycled", + "Disable reply ability to non-replyable messages/conversations", + "Sort blocked messages by lastmessage.date desc", + "Fix fr strings from pr 226. Fixes build", + "Fix pr 225 render issue", + "Fix unblock number bug", + "Silent notifications if no recipients are a contact" + ] + }, + { "versionCode": 2225, "versionName": "4.0.8", "fixed": [ From 862faec98e2e2a4e6868ce563a6343066762de7a Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Tue, 28 Jan 2025 11:01:16 -0800 Subject: [PATCH 16/27] Update Attachment.kt Fix indentation. --- domain/src/main/java/com/moez/QKSMS/model/Attachment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt b/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt index bb25625e..5b1cdaaa 100644 --- a/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt +++ b/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt @@ -110,7 +110,7 @@ class Attachment( if (resourceBytes != null) return resourceBytes!! - resourceBytes = ByteArray(0) + resourceBytes = ByteArray(0) try { context.contentResolver.openInputStream(getUri())?.use { From b8104daf2d627f52146e5983d1433305d42e309b Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 29 Jan 2025 12:30:54 +1100 Subject: [PATCH 17/27] change layouts for delayed send send now and cancel buttons. remove button shadows. make buttons float bottom --- .../src/main/res/layout/compose_activity.xml | 2 - .../main/res/layout/message_list_item_in.xml | 167 ++++++++++-------- .../main/res/layout/message_list_item_out.xml | 112 ++++++------ 3 files changed, 148 insertions(+), 133 deletions(-) diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index c8cf1ea5..9da2deb6 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -32,8 +32,6 @@ android:layout_width="0dp" android:layout_height="0dp" android:layout_marginBottom="12dp" - android:clipChildren="false" - android:clipToPadding="false" android:paddingTop="8dp" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_constraintBottom_toTopOf="@id/messageBackground" diff --git a/presentation/src/main/res/layout/message_list_item_in.xml b/presentation/src/main/res/layout/message_list_item_in.xml index fe7b9403..5dd6eea9 100644 --- a/presentation/src/main/res/layout/message_list_item_in.xml +++ b/presentation/src/main/res/layout/message_list_item_in.xml @@ -17,96 +17,107 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:layout_marginEnd="36dp" + android:background="?attr/selectableItemBackground" + android:orientation="vertical"> - + android:background="?attr/selectableItemBackground"> - + - + - + + + + + android:orientation="horizontal" + app:layout_constraintBottom_toBottomOf="parent"> - + - + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/presentation/src/main/res/layout/message_list_item_out.xml b/presentation/src/main/res/layout/message_list_item_out.xml index 33e4fe38..eebf3117 100644 --- a/presentation/src/main/res/layout/message_list_item_out.xml +++ b/presentation/src/main/res/layout/message_list_item_out.xml @@ -22,6 +22,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginStart="36dp" + android:layout_marginEnd="12dp" android:background="?attr/selectableItemBackground" android:orientation="vertical"> @@ -69,41 +71,35 @@ app:textSize="tertiary" tools:text="1" /> - - - + android:layout_gravity="end" + android:layout_marginBottom="2dp" + android:gravity="end" + android:nestedScrollingEnabled="false" + android:orientation="vertical" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + tools:itemCount="1" + tools:listitem="@layout/mms_image_preview_list_item" /> + + + android:visibility="gone" + tools:visibility="visible"> + tools:progressTint="@color/tools_theme" + tools:visibility="visible" /> - - - + android:layout_toStartOf="@id/sendNowIcon" + android:layout_toEndOf="@id/cancelFrame" + android:orientation="horizontal"> + + + + + - + android:visibility="gone" + tools:tint="@color/tools_theme" + tools:visibility="visible" /> + + - \ No newline at end of file From a4b0db56ca1e36fea157a1d9f5db913c78bdd266 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 29 Jan 2025 14:28:52 +1100 Subject: [PATCH 18/27] removed runtime check for WRITE_EXTERNAL_STORAGE at 'take a phot' time which is not required for taking a photo --- .../com/moez/QKSMS/feature/compose/ComposeViewModel.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index aa6b27ec..ddbc32ac 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -528,12 +528,8 @@ class ComposeViewModel @Inject constructor( view.cameraIntent .autoDisposable(view.scope()) .subscribe { - if (permissionManager.hasStorage()) { - newState { copy(attaching = false) } - view.requestCamera() - } else { - view.requestStoragePermission() - } + newState { copy(attaching = false) } + view.requestCamera() } // pick a photo (specifically) from image provider apps From ac26088e6c7013eb2e317d1074ffdd339e21738d Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 29 Jan 2025 15:36:46 +1100 Subject: [PATCH 19/27] enabled WRITE_EXTERNAL_STORAGE permission in app manifest which is required to save mms attachments to media storage. changed media storage locations from ...../QKSMS to ...../QUIK --- presentation/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/presentation/src/main/AndroidManifest.xml b/presentation/src/main/AndroidManifest.xml index 7b1c55ab..e2bddfa4 100644 --- a/presentation/src/main/AndroidManifest.xml +++ b/presentation/src/main/AndroidManifest.xml @@ -43,6 +43,7 @@ + Date: Wed, 29 Jan 2025 17:24:11 +1100 Subject: [PATCH 20/27] include forgotten MessageRepositoryImpl.kt file! --- .../java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt index c4741436..5ca9a5d7 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt @@ -181,9 +181,9 @@ class MessageRepositoryImpl @Inject constructor( if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { values.put(MediaStore.MediaColumns.IS_PENDING, 1) values.put(MediaStore.MediaColumns.RELATIVE_PATH, when { - part.isImage() -> "${Environment.DIRECTORY_PICTURES}/QKSMS" - part.isVideo() -> "${Environment.DIRECTORY_MOVIES}/QKSMS" - else -> "${Environment.DIRECTORY_DOWNLOADS}/QKSMS" + part.isImage() -> "${Environment.DIRECTORY_PICTURES}/QUIK" + part.isVideo() -> "${Environment.DIRECTORY_MOVIES}/QUIK" + else -> "${Environment.DIRECTORY_DOWNLOADS}/QUIK" }) } From 85f200ca1738c516215587b395c2ca726c63c914 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 29 Jan 2025 18:08:15 +1100 Subject: [PATCH 21/27] fix mms image compression bug not compressing --- .../java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt index c4741436..dac681e3 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt @@ -429,8 +429,8 @@ class MessageRepositoryImpl @Inject constructor( attempts++ scaledBytes = when (attachment.getType(context) == "image/gif") { - true -> ImageUtils.getScaledGif(context, attachment.getUri(), maxWidth, maxHeight) - false -> ImageUtils.getScaledImage(context, attachment.getUri(), maxWidth, maxHeight) + true -> ImageUtils.getScaledGif(context, attachment.getUri(), newWidth, newHeight) + false -> ImageUtils.getScaledImage(context, attachment.getUri(), newWidth, newHeight) } Timber.d("Compression attempt $attempts: ${scaledBytes.size / 1024}/${maxBytes.toInt() / 1024}Kb ($width*$height -> $newWidth*$newHeight)") From 34d535633d56ce79358927de5352e13ea15607b1 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Thu, 30 Jan 2025 06:11:53 +1100 Subject: [PATCH 22/27] fix only images attached to forwarded messages --- .../java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index dbb67eff..b0928282 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -59,6 +59,7 @@ import dev.octoshrimpy.quik.util.Preferences import dev.octoshrimpy.quik.util.tryOrNull import com.uber.autodispose.android.lifecycle.scope import com.uber.autodispose.autoDisposable +import dev.octoshrimpy.quik.extensions.isSmil import io.reactivex.Observable import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.rxkotlin.Observables @@ -378,8 +379,8 @@ class ComposeViewModel @Inject constructor( .filter { it == R.id.forward } .withLatestFrom(view.messagesSelectedIntent) { _, messages -> messages?.firstOrNull()?.let { messageRepo.getMessage(it) }?.let { message -> - val images = message.parts.filter { it.isImage() }.mapNotNull { it.getUri() } - navigator.showCompose(message.getText(), images) + val attachments = message.parts.filter { !it.isSmil() }.mapNotNull { it.getUri() } + navigator.showCompose(message.getText(), attachments) } } .autoDisposable(view.scope()) From b0f64916504cfa05c8ea6bc479ebf37b2c2506d8 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Thu, 30 Jan 2025 06:34:49 +1100 Subject: [PATCH 23/27] attach missed checkin file Navigator.kt - only has a parameter rename --- .../src/main/java/com/moez/QKSMS/common/Navigator.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/Navigator.kt b/presentation/src/main/java/com/moez/QKSMS/common/Navigator.kt index 15d1c359..f510cd1d 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/Navigator.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/Navigator.kt @@ -95,12 +95,12 @@ class Navigator @Inject constructor( } } - fun showCompose(body: String? = null, images: List? = null) { + fun showCompose(body: String? = null, attachments: List? = null) { val intent = Intent(context, ComposeActivity::class.java) intent.putExtra(Intent.EXTRA_TEXT, body) - images?.takeIf { it.isNotEmpty() }?.let { - intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, ArrayList(images)) + attachments?.takeIf { it.isNotEmpty() }?.let { + intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, ArrayList(attachments)) } startActivity(intent) From 6f2d47bcd760af42bf0b04f25aa05111339951cc Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sat, 1 Feb 2025 21:18:59 +1100 Subject: [PATCH 24/27] changes to enter the compose screen in 'scheduling' mode when launched from the scheduling activity. causes message scheduling to shown be shown after contact is chosen --- .../src/main/java/com/moez/QKSMS/common/Navigator.kt | 3 ++- .../com/moez/QKSMS/feature/compose/ComposeActivity.kt | 7 +++++++ .../QKSMS/feature/compose/ComposeActivityModule.kt | 6 ++++++ .../com/moez/QKSMS/feature/compose/ComposeState.kt | 1 + .../com/moez/QKSMS/feature/compose/ComposeView.kt | 1 + .../moez/QKSMS/feature/compose/ComposeViewModel.kt | 11 +++++++++++ .../QKSMS/feature/scheduled/ScheduledViewModel.kt | 2 +- 7 files changed, 29 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/Navigator.kt b/presentation/src/main/java/com/moez/QKSMS/common/Navigator.kt index 15d1c359..888ff2c7 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/Navigator.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/Navigator.kt @@ -95,9 +95,10 @@ class Navigator @Inject constructor( } } - fun showCompose(body: String? = null, images: List? = null) { + fun showCompose(body: String? = null, images: List? = null, mode: String? = null) { val intent = Intent(context, ComposeActivity::class.java) intent.putExtra(Intent.EXTRA_TEXT, body) + intent.putExtra("mode", mode) images?.takeIf { it.isNotEmpty() }?.let { intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, ArrayList(images)) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt index 213bdd5d..6ce2b9e2 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt @@ -71,10 +71,12 @@ import dev.octoshrimpy.quik.feature.contacts.ContactsActivity import dev.octoshrimpy.quik.model.Attachment import dev.octoshrimpy.quik.model.Recipient import io.reactivex.Observable +import io.reactivex.Single import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.Subject import kotlinx.android.synthetic.main.compose_activity.* import kotlinx.android.synthetic.main.main_activity.toolbar +import kotlinx.coroutines.reactive.publish import java.text.SimpleDateFormat import java.util.* import javax.inject.Inject @@ -94,6 +96,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val chipDeletedIntent: Subject by lazy { chipsAdapter.chipDeleted } override val menuReadyIntent: Observable = menu.map { Unit } override val optionsItemIntent: Subject = PublishSubject.create() + override val scheduleAction: Subject = PublishSubject.create() override val sendAsGroupIntent by lazy { sendAsGroupBackground.clicks() } override val messageClickIntent: Subject by lazy { messageAdapter.clicks } override val messagePartClickIntent: Subject by lazy { messageAdapter.partClicks } @@ -323,6 +326,10 @@ class ComposeActivity : QkThemedActivity(), ComposeView { ) constraintSet.applyTo(constraintLayout) } + + // if scheduling mode is set, show schedule dialog + if (state.scheduling) + scheduleAction.onNext(true) } override fun clearSelection() = messageAdapter.clearSelection() diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivityModule.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivityModule.kt index 8580cb49..1a599bd8 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivityModule.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivityModule.kt @@ -82,6 +82,12 @@ class ComposeActivityModule { return Attachments(uris.mapNotNull { Attachment(it) }) } + @Provides + @Named("mode") + fun provideSharedAction(activity: ComposeActivity): String { + return activity.intent.getStringExtra("mode") ?: ""; + } + @Provides @IntoMap @ViewModelKey(ComposeViewModel::class) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeState.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeState.kt index b5bf5a43..ca8f6475 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeState.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeState.kt @@ -42,6 +42,7 @@ data class ComposeState( val scheduled: Long = 0, val attachments: List = ArrayList(), val attaching: Boolean = false, + val scheduling: Boolean = false, val remaining: String = "", val subscription: SubscriptionInfoCompat? = null, val canSend: Boolean = false, diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt index 14c2e28e..e8086126 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt @@ -56,6 +56,7 @@ interface ComposeView : QkView { val attachAnyFileIntent: Observable<*> val attachImageFileIntent: Observable<*> val scheduleIntent: Observable<*> + val scheduleAction: Observable<*> val attachContactIntent: Observable<*> val attachAnyFileSelectedIntent: Observable val contactSelectedIntent: Observable diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index dbb67eff..8f11b57f 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -79,6 +79,7 @@ class ComposeViewModel @Inject constructor( @Named("addresses") private val addresses: List, @Named("text") private val sharedText: String, @Named("attachments") private val sharedAttachments: Attachments, + @Named("mode") private val mode: String, private val contactRepo: ContactRepository, private val context: Context, private val activeConversationManager: ActiveConversationManager, @@ -242,6 +243,10 @@ class ComposeViewModel @Inject constructor( val sub = if (subs.size > 1) subs.firstOrNull { it.subscriptionId == subId } ?: subs[0] else null newState { copy(subscription = sub) } }.subscribe() + + // actions + if (mode == "scheduling") + newState { copy(scheduling = true) } } override fun bindView(view: ComposeView) { @@ -574,6 +579,12 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { view.requestDatePicker() } + view.scheduleAction + .take(1) + .doOnNext{ newState { copy(scheduling = false) } } + .autoDisposable(view.scope()) + .subscribe { view.requestDatePicker() } + // a file, photo or otherwise, was picked by the user Observable.merge( view.attachAnyFileSelectedIntent.map { uri -> Attachment(uri) }, diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledViewModel.kt index 4324c6da..c2f1489b 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledViewModel.kt @@ -70,7 +70,7 @@ class ScheduledViewModel @Inject constructor( view.composeIntent .autoDisposable(view.scope()) - .subscribe { navigator.showCompose() } + .subscribe { navigator.showCompose(mode = "scheduling") } view.upgradeIntent .autoDisposable(view.scope()) From 99a24516d7a46839cf6b62c5dd7e239aff161f89 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sat, 1 Feb 2025 21:51:49 +1100 Subject: [PATCH 25/27] compose message_list_item_in/out layout changes to select full background when message selected --- .../main/res/layout/message_list_item_in.xml | 197 +++++------ .../main/res/layout/message_list_item_out.xml | 310 +++++++++--------- 2 files changed, 259 insertions(+), 248 deletions(-) diff --git a/presentation/src/main/res/layout/message_list_item_in.xml b/presentation/src/main/res/layout/message_list_item_in.xml index 5dd6eea9..312d9055 100644 --- a/presentation/src/main/res/layout/message_list_item_in.xml +++ b/presentation/src/main/res/layout/message_list_item_in.xml @@ -18,120 +18,125 @@ ~ along with QKSMS. If not, see . --> - - - - - - - - - - - + android:background="?attr/selectableItemBackground"> + android:layout_marginEnd="36dp" + android:orientation="vertical"> - + + + + + + + + + + android:orientation="horizontal" + app:layout_constraintBottom_toBottomOf="parent"> - + - + android:layout_marginStart="12dp" + android:orientation="vertical"> + + + + + + + + - - - \ No newline at end of file + \ No newline at end of file diff --git a/presentation/src/main/res/layout/message_list_item_out.xml b/presentation/src/main/res/layout/message_list_item_out.xml index eebf3117..020e1cb6 100644 --- a/presentation/src/main/res/layout/message_list_item_out.xml +++ b/presentation/src/main/res/layout/message_list_item_out.xml @@ -17,174 +17,180 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:background="?attr/selectableItemBackground"> - - + android:layout_marginStart="36dp" + android:layout_marginEnd="12dp" + android:orientation="vertical"> - - - - - - - - - - - - - - - - - - - - + android:contentDescription="@string/compose_message_item"> - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:baselineAlignBottom="true" + android:contentDescription="@string/compose_message_send_now" + android:padding="6dp" + android:src="@drawable/ic_send_black_24dp" + android:visibility="gone" + tools:tint="@color/tools_theme" + tools:visibility="visible" /> - + - + - + - \ No newline at end of file + \ No newline at end of file From d7514d65b6a44b8b033f77a1a35505ebd7fd1df2 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sun, 2 Feb 2025 21:23:01 +1100 Subject: [PATCH 26/27] changes to add a new setting that allows user to choose to allow all message links, block all message links (including in notifications), or ask via a dialog box whether the user wishes to proceed --- .../java/com/moez/QKSMS/util/Preferences.kt | 5 + .../common/util/NotificationManagerImpl.kt | 6 ++ .../common/util/extensions/ViewExtensions.kt | 96 +++++++++++-------- .../QKSMS/feature/compose/ComposeActivity.kt | 19 ++++ .../moez/QKSMS/feature/compose/ComposeView.kt | 2 + .../QKSMS/feature/compose/ComposeViewModel.kt | 5 + .../QKSMS/feature/compose/MessagesAdapter.kt | 55 ++++++++++- .../feature/settings/SettingsController.kt | 10 +- .../feature/settings/SettingsPresenter.kt | 19 ++++ .../QKSMS/feature/settings/SettingsState.kt | 2 + .../QKSMS/feature/settings/SettingsView.kt | 2 + .../main/res/layout/settings_controller.xml | 9 ++ presentation/src/main/res/values/strings.xml | 17 ++++ 13 files changed, 199 insertions(+), 48 deletions(-) diff --git a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt index ff43a3c8..ce10166d 100644 --- a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt +++ b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt @@ -80,6 +80,10 @@ class Preferences @Inject constructor( const val BLOCKING_MANAGER_CC = 1 const val BLOCKING_MANAGER_SIA = 2 const val BLOCKING_MANAGER_CB = 3 + + const val MESSAGE_LINK_HANDLING_BLOCK = 0 + const val MESSAGE_LINK_HANDLING_ALLOW = 1 + const val MESSAGE_LINK_HANDLING_ASK = 2 } // Internal @@ -124,6 +128,7 @@ class Preferences @Inject constructor( val autoDelete = rxPrefs.getInteger("autoDelete", 0) val longAsMms = rxPrefs.getBoolean("longAsMms", false) val mmsSize = rxPrefs.getInteger("mmsSize", 300) + val messageLinkHandling = rxPrefs.getInteger("messageLinkHandling", MESSAGE_LINK_HANDLING_ASK) val logging = rxPrefs.getBoolean("logging", false) val unreadAtTop = rxPrefs.getBoolean("unreadAtTop", false) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/util/NotificationManagerImpl.kt b/presentation/src/main/java/com/moez/QKSMS/common/util/NotificationManagerImpl.kt index ee4bb43e..e61fb28c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/util/NotificationManagerImpl.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/util/NotificationManagerImpl.kt @@ -206,6 +206,12 @@ class NotificationManagerImpl @Inject constructor( } } + // remove system generated contextual actions (they're generated from message links) unless + // the user has explicitly set to allow message links + notification.setAllowSystemGeneratedContextualActions( + (prefs.messageLinkHandling.get() == Preferences.MESSAGE_LINK_HANDLING_ALLOW) + ) + // Set the large icon val avatar = conversation.recipients.takeIf { it.size == 1 } ?.first()?.contact?.photoUri diff --git a/presentation/src/main/java/com/moez/QKSMS/common/util/extensions/ViewExtensions.kt b/presentation/src/main/java/com/moez/QKSMS/common/util/extensions/ViewExtensions.kt index 526126a8..110e137c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/util/extensions/ViewExtensions.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/util/extensions/ViewExtensions.kt @@ -92,55 +92,67 @@ fun View.setVisible(visible: Boolean, invisible: Int = View.GONE) { * the view no longer work. Also problematic when we try to long press on an image in the message * view */ -fun View.forwardTouches(parent: View) { - var isLongClick = false - var textInitiallySelectable = false - if (this@forwardTouches is TextView) - textInitiallySelectable = this@forwardTouches.isTextSelectable + +class CancelableSimpleOnGestureListener(view: View, parentView: View) : SimpleOnGestureListener() { + private var lastUpEvent: MotionEvent? = null + private val parent = parentView + private val thisView = view + private var textInitiallySelectable = false + + init { + if (thisView is TextView) + textInitiallySelectable = thisView.isTextSelectable + } + + fun cancelCurrentClick() { + lastUpEvent?.recycle() + lastUpEvent = null + } + + override fun onSingleTapConfirmed(e: MotionEvent): Boolean { + if (lastUpEvent !== null) { + parent.onTouchEvent(e) + parent.onTouchEvent(lastUpEvent) + lastUpEvent?.recycle() + lastUpEvent = null + } + return true + } + + override fun onSingleTapUp(e: MotionEvent): Boolean { + lastUpEvent = MotionEvent.obtain(e) + thisView.onTouchEvent(e) + return true + } + + override fun onDown(e: MotionEvent): Boolean { + thisView.onTouchEvent(e) + return true + } + + override fun onLongPress(e: MotionEvent) { + parent.onTouchEvent(e) + // this is kinda odd but we have to 'bounce' the text selectable value so it doesn't + // start selecting text on a long press, but will start selecting it on the next double-tap + if (thisView is TextView) { + thisView.setTextIsSelectable(false) + thisView.setTextIsSelectable(textInitiallySelectable) + } + } +} + +fun View.forwardTouches(parent: View): CancelableSimpleOnGestureListener { + val gestureListener = CancelableSimpleOnGestureListener(this, parent) setOnTouchListener(object : OnTouchListener { - private val gestureDetector = - GestureDetector(parent.context, object : SimpleOnGestureListener() { - private var lastUpEvent: MotionEvent? = null - - override fun onSingleTapConfirmed(e: MotionEvent): Boolean { - parent.onTouchEvent(e) - if (lastUpEvent !== null) { - parent.onTouchEvent(lastUpEvent) - lastUpEvent?.recycle() - lastUpEvent = null - } - return true - } - - override fun onSingleTapUp(e: MotionEvent): Boolean { - onTouchEvent(e) - lastUpEvent = MotionEvent.obtain(e) - return true - } - - override fun onDown(e: MotionEvent): Boolean { - isLongClick = false - onTouchEvent(e) - return true - } - - override fun onLongPress(e: MotionEvent) { - parent.onTouchEvent(e) - isLongClick = true - // this is kinda odd but we have to 'bounce' the text selectable value so it doesn't - // start selecting text on a long press, but will start selecting it on the next double-tap - if (this@forwardTouches is TextView) { - (this@forwardTouches as TextView).setTextIsSelectable(false) - (this@forwardTouches as TextView).setTextIsSelectable(textInitiallySelectable) - } - } - }) + val gestureDetector = GestureDetector(parent.context, gestureListener) override fun onTouch(v: View, e: MotionEvent): Boolean { return gestureDetector.onTouchEvent(e) } }) + + return gestureListener } fun ViewPager.addOnPageChangeListener(listener: (Int) -> Unit) { diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt index 6ce2b9e2..06f12a9a 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt @@ -43,6 +43,7 @@ import androidx.appcompat.app.AlertDialog import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat import androidx.core.view.isVisible import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProviders @@ -121,6 +122,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val viewQksmsPlusIntent: Subject = PublishSubject.create() override val backPressedIntent: Subject = PublishSubject.create() override val confirmDeleteIntent: Subject> = PublishSubject.create() + override val messageLinkAskIntent: Subject by lazy { messageAdapter.messageLinkClicks } private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[ComposeViewModel::class.java] } @@ -350,6 +352,23 @@ class ComposeActivity : QkThemedActivity(), ComposeView { .show() } + override fun showMessageLinkAskDialog(uri: Uri) { + AlertDialog.Builder(this) + .setTitle(R.string.messageLinkHandling_dialog_title) + .setMessage(getString(R.string.messageLinkHandling_dialog_body, uri.toString())) + .setPositiveButton( + R.string.messageLinkHandling_dialog_positive + ) { _, _ -> + ContextCompat.startActivity( + this, + Intent(Intent.ACTION_VIEW).setData(uri), + null + ) + } + .setNegativeButton(R.string.messageLinkHandling_dialog_negative) { _, _ -> { } } + .show() + } + override fun requestDefaultSms() { navigator.showDefaultSmsDialog(this) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt index e8086126..d5b96e11 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeView.kt @@ -68,11 +68,13 @@ interface ComposeView : QkView { val viewQksmsPlusIntent: Subject val backPressedIntent: Observable val confirmDeleteIntent: Observable> + val messageLinkAskIntent: Observable fun clearSelection() fun toggleSelectAll() fun expandMessages(messageIds: List, expand: Boolean) fun showDetails(details: String) + fun showMessageLinkAskDialog(uri: Uri) fun requestDefaultSms() fun requestStoragePermission() fun requestSmsPermission() diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index 56ecb11a..a94558bd 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -513,6 +513,11 @@ class ComposeViewModel @Inject constructor( ) } + // Show the message details + view.messageLinkAskIntent + .autoDisposable(view.scope()) + .subscribe { view.showMessageLinkAskDialog(it) } + // Set the current conversation Observables .combineLatest( diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt index cc67ad75..0a08fae5 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt @@ -21,17 +21,21 @@ package dev.octoshrimpy.quik.feature.compose import android.animation.ObjectAnimator import android.content.Context import android.graphics.Typeface -import android.os.Build +import android.net.Uri import android.text.Layout import android.text.Spannable import android.text.SpannableString +import android.text.SpannableStringBuilder +import android.text.method.LinkMovementMethod +import android.text.style.ClickableSpan import android.text.style.StyleSpan +import android.text.style.URLSpan +import android.text.util.Linkify import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.ProgressBar -import androidx.recyclerview.widget.RecyclerView import com.jakewharton.rxbinding2.view.clicks import com.moez.QKSMS.common.QkMediaPlayer import dev.octoshrimpy.quik.R @@ -107,6 +111,7 @@ class MessagesAdapter @Inject constructor( val clicks: Subject = PublishSubject.create() val partClicks: Subject = PublishSubject.create() + val messageLinkClicks: Subject = PublishSubject.create() val cancelSending: Subject = PublishSubject.create() val sendNow: Subject = PublishSubject.create() @@ -170,7 +175,6 @@ class MessagesAdapter @Inject constructor( val partsAdapter = partsAdapterProvider.get() partsAdapter.clicks.subscribe(partClicks) view.attachments.adapter = partsAdapter - view.body.forwardTouches(view) return QkViewHolder(view).apply { view.setOnClickListener { @@ -240,6 +244,8 @@ class MessagesAdapter @Inject constructor( } } + val cancelableSimpleOnGestureListener = holder.body.forwardTouches(holder.containerView) + // Bind the message status bindStatus(holder, message, next) @@ -297,8 +303,47 @@ class MessagesAdapter @Inject constructor( false -> TextViewStyler.SIZE_PRIMARY }) - holder.body.text = messageText - holder.body.setVisible(message.isSms() || messageText.isNotBlank()) + val spanString = SpannableStringBuilder(messageText) + + when (prefs.messageLinkHandling.get()) { + Preferences.MESSAGE_LINK_HANDLING_BLOCK -> holder.body.autoLinkMask = 0 + Preferences.MESSAGE_LINK_HANDLING_ASK -> { + // manually handle link clicks if user has set to ask before opening links + holder.body.isClickable = false + holder.body.linksClickable = false + holder.body.movementMethod = LinkMovementMethod.getInstance() + + Linkify.addLinks(spanString, holder.body.autoLinkMask) + + for (span in spanString.getSpans( + 0, + spanString.length, + URLSpan::class.java) + ) { + // set handler for when user touches a link into new span + spanString.setSpan( + object : ClickableSpan() { + override fun onClick(widget: View) { + messageLinkClicks.onNext(Uri.parse(span.url)) + + // interrupt the upcoming click event on the body view + cancelableSimpleOnGestureListener.cancelCurrentClick() + } + }, + spanString.getSpanStart(span), + spanString.getSpanEnd(span), + spanString.getSpanFlags(span) + ) + + // remove original span + spanString.removeSpan(span) + } + } + } + + holder.body.text = spanString + holder.body.setVisible(message.isSms() || spanString.isNotBlank()) + holder.body.setBackgroundResource(getBubble( emojiOnly = emojiOnly, canGroupWithPrevious = canGroup(message, previous) || media.isNotEmpty(), diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt index ff03200f..4c302dfe 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt @@ -41,7 +41,6 @@ import dev.octoshrimpy.quik.common.util.extensions.animateLayoutChanges import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint import dev.octoshrimpy.quik.common.util.extensions.setVisible import dev.octoshrimpy.quik.common.widget.PreferenceView -import dev.octoshrimpy.quik.common.widget.QkSwitch import dev.octoshrimpy.quik.common.widget.TextInputDialog import dev.octoshrimpy.quik.feature.settings.about.AboutController import dev.octoshrimpy.quik.feature.settings.autodelete.AutoDeleteDialog @@ -73,6 +72,7 @@ class SettingsController : QkController = mmsSizeDialog.adapter.menuItemClicks + override fun messageLinkHandlingSelected(): Observable = messageLinkHandlingDialog.adapter.menuItemClicks + override fun render(state: SettingsState) { themePreview.setBackgroundTint(state.theme) night.summary = state.nightModeSummary @@ -195,6 +198,9 @@ class SettingsController : QkController syncingProgress.isVisible = false @@ -254,6 +260,8 @@ class SettingsController : QkController + val index = messageLinkHandlingIds.indexOf(messageLinkHandlingId) + newState { + copy( + messageLinkHandlingSummary = messageLinkHandlingLabels[index], + messageLinkHandlingId = messageLinkHandlingId + ) + } + } + disposables += syncRepo.syncProgress .sample(16, TimeUnit.MILLISECONDS) .distinctUntilChanged() @@ -204,6 +217,8 @@ class SettingsPresenter @Inject constructor( R.id.mmsSize -> view.showMmsSizePicker() + R.id.messsageLinkHandling -> view.showMessageLinkHandlingDialogPicker() + R.id.sync -> syncMessages.execute(Unit) R.id.about -> view.showAbout() @@ -294,6 +309,10 @@ class SettingsPresenter @Inject constructor( view.mmsSizeSelected() .autoDisposable(view.scope()) .subscribe(prefs.mmsSize::set) + + view.messageLinkHandlingSelected() + .autoDisposable(view.scope()) + .subscribe(prefs.messageLinkHandling::set) } } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsState.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsState.kt index ea90b728..c87522bc 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsState.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsState.kt @@ -46,5 +46,7 @@ data class SettingsState( val longAsMms: Boolean = false, val maxMmsSizeSummary: String = "100KB", val maxMmsSizeId: Int = 100, + val messageLinkHandlingSummary: String = "Ask before opening", + val messageLinkHandlingId: Int = 2, val syncProgress: SyncRepository.SyncProgress = SyncRepository.SyncProgress.Idle ) \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsView.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsView.kt index d97a0229..b3396b49 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsView.kt @@ -34,6 +34,7 @@ interface SettingsView : QkViewContract { fun signatureChanged(): Observable fun autoDeleteChanged(): Observable fun mmsSizeSelected(): Observable + fun messageLinkHandlingSelected(): Observable fun showQksmsPlusSnackbar() fun showNightModeDialog() @@ -45,6 +46,7 @@ interface SettingsView : QkViewContract { fun showAutoDeleteDialog(days: Int) suspend fun showAutoDeleteWarningDialog(messages: Int): Boolean fun showMmsSizePicker() + fun showMessageLinkHandlingDialogPicker() fun showSwipeActions() fun showThemePicker() fun showAbout() diff --git a/presentation/src/main/res/layout/settings_controller.xml b/presentation/src/main/res/layout/settings_controller.xml index 19c392ed..e2687537 100644 --- a/presentation/src/main/res/layout/settings_controller.xml +++ b/presentation/src/main/res/layout/settings_controller.xml @@ -212,6 +212,15 @@ app:title="@string/settings_mms_size_title" tools:summary="100KB" /> + + Send long messages as MMS If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply Auto-compress MMS image attachments + Link handling in messages Sync messages Re-sync your messages with the native Android SMS database About QUIK @@ -505,6 +506,18 @@ 0 + + Block + Allow + Ask before opening + + + + 0 + 1 + 2 + + Okay Give me a moment @@ -521,4 +534,8 @@ No Messages Speak unseen messages + External Link Warning + Some links may be unsafe or redirect you unexpectedly. Review the link below before proceeding:\n\n%1$s\n\nDo you want to continue? + Yes, open the link + No From fbd1094b2b2a867571defe8ea9c56e04d628de56 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sun, 2 Feb 2025 21:31:01 +1100 Subject: [PATCH 27/27] fixed bug that was a hangover from the original code that made message links only clickable once --- .../main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt index 0a08fae5..dc397a65 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt @@ -339,6 +339,7 @@ class MessagesAdapter @Inject constructor( spanString.removeSpan(span) } } + else -> holder.body.movementMethod = LinkMovementMethod.getInstance() } holder.body.text = spanString