From 334632b30df9c8d0ea48f4b33d6803ea0cc5681f Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Tue, 28 Jan 2025 11:26:58 -0800 Subject: [PATCH 01/29] Update build-on-pull.yml Update's versions. --- .github/workflows/build-on-pull.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-on-pull.yml b/.github/workflows/build-on-pull.yml index c153d237..e110208a 100644 --- a/.github/workflows/build-on-pull.yml +++ b/.github/workflows/build-on-pull.yml @@ -11,11 +11,12 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up JDK 17 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: + distribution: 'temurin' java-version: '17' - name: Build with Gradle @@ -25,7 +26,7 @@ jobs: run: ./gradlew test - name: Deploy Artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: build-artifacts path: build/libs/ From a0e9180ba272c26a4a4021cacee59136c1ab1feb Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Mon, 3 Feb 2025 15:50:23 -0800 Subject: [PATCH 02/29] Update build-on-pull.yml Update Versions and add code to add the signing keys to the build. --- .github/workflows/build-on-pull.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-on-pull.yml b/.github/workflows/build-on-pull.yml index e110208a..c6512a65 100644 --- a/.github/workflows/build-on-pull.yml +++ b/.github/workflows/build-on-pull.yml @@ -11,8 +11,11 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 - + uses: actions/checkout@v4 + + - name: Decode Keystore File + run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > ${{ github.workspace }}/my-release-key.keystore + - name: Set up JDK 17 uses: actions/setup-java@v4 with: @@ -20,13 +23,17 @@ jobs: java-version: '17' - name: Build with Gradle - run: ./gradlew build + run: ./gradlew build \ + -Pandroid.injected.signing.store.file=${{ github.workspace }}/my-release-key.keystore \ + -Pandroid.injected.signing.store.password=${{ secrets.KEYSTORE_PASSWORD }} \ + -Pandroid.injected.signing.key.alias=${{ secrets.KEY_ALIAS }} \ + -Pandroid.injected.signing.key.password=${{ secrets.KEY_PASSWORD }} \ - name: Run Tests run: ./gradlew test - name: Deploy Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: build-artifacts path: build/libs/ From 2b59b3aa1d1428c4ca8c472cc2685af8a700357b Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Mon, 3 Feb 2025 16:07:11 -0800 Subject: [PATCH 03/29] Update build-on-pull.yml --- .github/workflows/build-on-pull.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-on-pull.yml b/.github/workflows/build-on-pull.yml index c6512a65..b6c0d0e3 100644 --- a/.github/workflows/build-on-pull.yml +++ b/.github/workflows/build-on-pull.yml @@ -24,10 +24,7 @@ jobs: - name: Build with Gradle run: ./gradlew build \ - -Pandroid.injected.signing.store.file=${{ github.workspace }}/my-release-key.keystore \ - -Pandroid.injected.signing.store.password=${{ secrets.KEYSTORE_PASSWORD }} \ - -Pandroid.injected.signing.key.alias=${{ secrets.KEY_ALIAS }} \ - -Pandroid.injected.signing.key.password=${{ secrets.KEY_PASSWORD }} \ + -Dandroid.injected.signing.store.file=${{ github.workspace }}/my-release-key.keystore - name: Run Tests run: ./gradlew test From e3e7c00145ec8a78e9898ec2bc1eaac7a419cd4e Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Sun, 9 Feb 2025 10:33:58 -0800 Subject: [PATCH 04/29] Fixes the size of the icon.png. --- metadata/en-US/images/icon.png | Bin 16821 -> 72175 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/metadata/en-US/images/icon.png b/metadata/en-US/images/icon.png index 3cae4497e8050892bf3353dcbdca7e6c24021ba5..689d040b463cda3023f037b0e4660a34a64b2555 100644 GIT binary patch literal 72175 zcmeFYby$>N`!725&|T6El0y#NAPv$;4?{?I2n;3N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zo}#|?4)Hg|gN`bB(C5PEeWtFiGitn@dR`uZ&s@hAR=QfC;FyoJ;235cDPB;7!d$Bz z%hEA=i}81$z|pm*VCX}A`PUO(W2Swl3PLQJ5_-6lpzHlT|AWcfax{3?QgG{`riP!Y zP^ro5E~FAAcxX=I1$jz52)ouR?@KX!8v4kAK>230og9J;PK|g1GtC=16}>4-&1%`J zD~`X30bI5dk1B4^*ehd8x)s4^(iTxo3j zH<+F|;EP*u(V91AncfedL<t*NCK8( zo}LudP#`^+Tnne4N!BRfebiE7g$)jE{Iq7B{?e$M6=RvqcU%86aG23yBUr3d6Y-BBX^+!FCl-z@zKX$wVu* z%0kKc>ncSIDh{8y9l)R@pXCd z`17!(%|G+Hb$0vi Date: Sun, 9 Feb 2025 10:41:40 -0800 Subject: [PATCH 05/29] Update build-on-pull.yml Fixes the formatting of the keystore injections. --- .github/workflows/build-on-pull.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-on-pull.yml b/.github/workflows/build-on-pull.yml index b6c0d0e3..16fac75b 100644 --- a/.github/workflows/build-on-pull.yml +++ b/.github/workflows/build-on-pull.yml @@ -23,9 +23,9 @@ jobs: java-version: '17' - name: Build with Gradle - run: ./gradlew build \ - -Dandroid.injected.signing.store.file=${{ github.workspace }}/my-release-key.keystore - + run: | + ./gradlew build \ + -Dandroid.injected.signing.store.file=${{ github.workspace }}/my-release-key.keystore - name: Run Tests run: ./gradlew test From 91d284ea301743a3f83262c72ff72af17a199be5 Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Sun, 9 Feb 2025 10:59:14 -0800 Subject: [PATCH 06/29] Update build-on-pull.yml Changes it to only set up a NoAnalyticsDebug. --- .github/workflows/build-on-pull.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-on-pull.yml b/.github/workflows/build-on-pull.yml index 16fac75b..9baf2c93 100644 --- a/.github/workflows/build-on-pull.yml +++ b/.github/workflows/build-on-pull.yml @@ -24,8 +24,9 @@ jobs: - name: Build with Gradle run: | - ./gradlew build \ + ./gradlew assembleNoAnalyticsDebug \ -Dandroid.injected.signing.store.file=${{ github.workspace }}/my-release-key.keystore + --stacktrace - name: Run Tests run: ./gradlew test From f324dc58169be7889b839a2cdf18a262681273c8 Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Sun, 9 Feb 2025 12:00:39 -0800 Subject: [PATCH 07/29] Update build-on-pull.yml Remove --stacktrace. --- .github/workflows/build-on-pull.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-on-pull.yml b/.github/workflows/build-on-pull.yml index 9baf2c93..f2ad17b4 100644 --- a/.github/workflows/build-on-pull.yml +++ b/.github/workflows/build-on-pull.yml @@ -26,7 +26,7 @@ jobs: run: | ./gradlew assembleNoAnalyticsDebug \ -Dandroid.injected.signing.store.file=${{ github.workspace }}/my-release-key.keystore - --stacktrace + - name: Run Tests run: ./gradlew test From b41c9f71033373997d803386d1698ebc0200278c Mon Sep 17 00:00:00 2001 From: gavine99 Date: Mon, 10 Feb 2025 22:08:39 +1100 Subject: [PATCH 08/29] attachment context menu for save, share, forward and open externally remove share icons from audio and file attachment types add forward and open externally to gallery menu so it matches attachment context menu new icon/button for resend message --- .../com/moez/QKSMS/common/MenuItemAdapter.kt | 2 +- .../moez/QKSMS/common/base/FlowableAdapter.kt | 2 +- .../com/moez/QKSMS/common/base/QkAdapter.kt | 2 +- .../moez/QKSMS/common/base/QkViewHolder.kt | 2 +- .../widget/QkContextMenuRecyclerView.kt | 83 +++++++++++++ .../com/moez/QKSMS/common/widget/QkDialog.kt | 2 +- .../feature/changelog/ChangelogAdapter.kt | 2 +- .../feature/compose/AttachmentAdapter.kt | 2 +- .../QKSMS/feature/compose/ComposeActivity.kt | 76 ++++++++++-- .../moez/QKSMS/feature/compose/ComposeView.kt | 6 +- .../QKSMS/feature/compose/ComposeViewModel.kt | 109 +++++++++++++---- .../QKSMS/feature/compose/MessagesAdapter.kt | 110 +++++++++--------- .../feature/compose/editing/ChipsAdapter.kt | 2 +- .../compose/editing/ComposeItemAdapter.kt | 2 +- .../compose/editing/PhoneNumberAdapter.kt | 2 +- .../editing/PhoneNumberPickerAdapter.kt | 2 +- .../QKSMS/feature/compose/part/AudioBinder.kt | 15 +-- .../QKSMS/feature/compose/part/FileBinder.kt | 16 --- .../feature/compose/part/PartsAdapter.kt | 28 ++--- .../QKSMS/feature/compose/part/VCardBinder.kt | 3 - .../ConversationInfoAdapter.kt | 2 +- .../QKSMS/feature/gallery/GalleryActivity.kt | 2 +- .../feature/gallery/GalleryPagerAdapter.kt | 2 +- .../QKSMS/feature/gallery/GalleryViewModel.kt | 25 +++- .../moez/QKSMS/feature/main/SearchAdapter.kt | 2 +- .../ScheduledMessageAttachmentAdapter.kt | 2 +- .../QKSMS/feature/themepicker/ThemeAdapter.kt | 2 +- .../src/main/res/layout/compose_activity.xml | 6 +- .../main/res/layout/message_list_item_in.xml | 4 +- .../main/res/layout/message_list_item_out.xml | 45 ++++--- .../layout/mms_audio_preview_list_item.xml | 15 +-- .../main/res/layout/mms_file_list_item.xml | 110 ++++++++---------- .../main/res/layout/mms_vcard_list_item.xml | 94 ++++++++------- .../menu/{gallery.xml => mms_part_menu.xml} | 24 ++-- presentation/src/main/res/values/strings.xml | 7 +- 35 files changed, 512 insertions(+), 298 deletions(-) create mode 100644 presentation/src/main/java/com/moez/QKSMS/common/widget/QkContextMenuRecyclerView.kt rename presentation/src/main/res/menu/{gallery.xml => mms_part_menu.xml} (53%) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/MenuItemAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/common/MenuItemAdapter.kt index 752419c1..52469313 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/MenuItemAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/MenuItemAdapter.kt @@ -39,7 +39,7 @@ import javax.inject.Inject data class MenuItem(val title: String, val actionId: Int) -class MenuItemAdapter @Inject constructor(private val context: Context, private val colors: Colors) : QkAdapter() { +class MenuItemAdapter @Inject constructor(private val context: Context, private val colors: Colors) : QkAdapter() { val menuItemClicks: Subject = PublishSubject.create() diff --git a/presentation/src/main/java/com/moez/QKSMS/common/base/FlowableAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/common/base/FlowableAdapter.kt index 46ac3daf..9e135314 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/base/FlowableAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/base/FlowableAdapter.kt @@ -27,7 +27,7 @@ import io.reactivex.disposables.Disposable * Base RecyclerView.Adapter that provides some convenience when creating a new Adapter, such as * data list handing and item animations */ -abstract class FlowableAdapter : QkAdapter() { +abstract class FlowableAdapter : QkAdapter() { var flowable: Flowable>? = null set(value) { diff --git a/presentation/src/main/java/com/moez/QKSMS/common/base/QkAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/common/base/QkAdapter.kt index 7e7f5dcb..61c4bb2e 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/base/QkAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/base/QkAdapter.kt @@ -30,7 +30,7 @@ import io.reactivex.subjects.Subject * Base RecyclerView.Adapter that provides some convenience when creating a new Adapter, such as * data list handing and item animations */ -abstract class QkAdapter : RecyclerView.Adapter() { +abstract class QkAdapter : RecyclerView.Adapter() { var data: List = ArrayList() set(value) { diff --git a/presentation/src/main/java/com/moez/QKSMS/common/base/QkViewHolder.kt b/presentation/src/main/java/com/moez/QKSMS/common/base/QkViewHolder.kt index 685dce4a..4bf15117 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/base/QkViewHolder.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/base/QkViewHolder.kt @@ -22,6 +22,6 @@ import android.view.View import androidx.recyclerview.widget.RecyclerView import kotlinx.android.extensions.LayoutContainer -class QkViewHolder(view: View) : RecyclerView.ViewHolder(view), LayoutContainer { +open class QkViewHolder(view: View) : RecyclerView.ViewHolder(view), LayoutContainer { override val containerView: View = view } diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkContextMenuRecyclerView.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkContextMenuRecyclerView.kt new file mode 100644 index 00000000..91844393 --- /dev/null +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkContextMenuRecyclerView.kt @@ -0,0 +1,83 @@ +package dev.octoshrimpy.quik.common.widget + +import android.content.Context +import android.net.Uri +import android.util.AttributeSet +import android.view.ContextMenu +import android.view.View +import androidx.recyclerview.widget.RecyclerView +import dev.octoshrimpy.quik.common.base.QkAdapter +import dev.octoshrimpy.quik.common.base.QkViewHolder +import dev.octoshrimpy.quik.model.MmsPart + +open class QkContextMenuRecyclerView : RecyclerView { + class ViewHolder(view: View) : QkViewHolder(view) { + init { itemView.isLongClickable = true } + var contextMenuValue: VIEW_HOLDER_VALUE_TYPE? = null + } + + abstract class Adapter< + ADAPTER_VALUE_TYPE, + T, + VHT : RecyclerView.ViewHolder + > : QkAdapter() { + var contextMenuValue: ADAPTER_VALUE_TYPE? = null + } + + private var contextMenuInfo: ContextMenuInfo< + ADAPTER_VALUE_TYPE, + VIEW_HOLDER_VALUE_TYPE + >? = null + + constructor(context: Context) : super(context) + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) + : super(context, attrs, defStyleAttr) + + override fun getContextMenuInfo() = contextMenuInfo + + override fun getChildViewHolder(child: View): ViewHolder? { + return super.getChildViewHolder(child) as ViewHolder + } + + override fun showContextMenuForChild(originalView: View): Boolean { + saveContextMenuInfo(originalView) + return super.showContextMenuForChild(originalView) + } + + override fun showContextMenuForChild(originalView: View, x: Float, y: Float): Boolean { + saveContextMenuInfo(originalView) + return super.showContextMenuForChild(originalView, x, y) + } + + private fun saveContextMenuInfo(originalView: View) { + contextMenuInfo = ContextMenuInfo( + (adapter as Adapter)?.contextMenuValue, + getChildViewHolder(originalView)?.contextMenuValue, + this, + originalView, + getChildAdapterPosition(originalView), + getChildItemId(originalView) + ) + } + + class ContextMenuInfo( + val adapterValue: ADAPTER_VALUE_TYPE?, + val viewHolderValue: VIEW_HOLDER_VALUE_TYPE?, + val recyclerView: QkContextMenuRecyclerView, + val itemView: View, + val adapterPosition: Int, + val childItemStableId: Long + ) : ContextMenu.ContextMenuInfo +} + +class QkContextMenuRecyclerViewLongMmsPart : QkContextMenuRecyclerView { + constructor(context: Context) : super(context) + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) + : super(context, attrs, defStyleAttr) +} \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkDialog.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkDialog.kt index 09a46397..6d134cd3 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkDialog.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkDialog.kt @@ -59,7 +59,7 @@ class QkDialog(private val context: Activity) : AlertDialog(context) { view.subtitle.isVisible = !value.isNullOrBlank() } - var adapter: QkAdapter<*>? = null + var adapter: QkAdapter<*, *>? = null set(value) { field = value view.list.isVisible = value != null diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/changelog/ChangelogAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/changelog/ChangelogAdapter.kt index 45a78ec7..441ba84b 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/changelog/ChangelogAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/changelog/ChangelogAdapter.kt @@ -28,7 +28,7 @@ import dev.octoshrimpy.quik.common.base.QkViewHolder import dev.octoshrimpy.quik.manager.ChangelogManager import kotlinx.android.synthetic.main.changelog_list_item.* -class ChangelogAdapter(private val context: Context) : QkAdapter() { +class ChangelogAdapter(private val context: Context) : QkAdapter() { data class ChangelogItem(val type: Int, val label: String) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt index d8a7d70b..304567fd 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt @@ -43,7 +43,7 @@ import javax.inject.Inject class AttachmentAdapter @Inject constructor( private val context: Context -) : QkAdapter() { +) : QkAdapter() { companion object { private const val VIEW_TYPE_FILE = 0 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 06f12a9a..7179d255 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 @@ -31,6 +31,7 @@ import android.provider.ContactsContract import android.provider.MediaStore import android.speech.RecognizerIntent import android.text.format.DateFormat +import android.view.ContextMenu import android.view.GestureDetector import android.view.GestureDetector.SimpleOnGestureListener import android.view.Menu @@ -67,19 +68,53 @@ import dev.octoshrimpy.quik.common.util.extensions.setTint import dev.octoshrimpy.quik.common.util.extensions.setVisible import dev.octoshrimpy.quik.common.util.extensions.showKeyboard import dev.octoshrimpy.quik.common.widget.QkEditText +import dev.octoshrimpy.quik.extensions.mapNotNull import dev.octoshrimpy.quik.feature.compose.editing.ChipsAdapter 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.compose_activity.attach +import kotlinx.android.synthetic.main.compose_activity.attachAFileIcon +import kotlinx.android.synthetic.main.compose_activity.attachAFileLabel +import kotlinx.android.synthetic.main.compose_activity.attaching +import kotlinx.android.synthetic.main.compose_activity.attachingBackground +import kotlinx.android.synthetic.main.compose_activity.camera +import kotlinx.android.synthetic.main.compose_activity.cameraLabel +import kotlinx.android.synthetic.main.compose_activity.chips +import kotlinx.android.synthetic.main.compose_activity.composeBar +import kotlinx.android.synthetic.main.compose_activity.contact +import kotlinx.android.synthetic.main.compose_activity.contactLabel +import kotlinx.android.synthetic.main.compose_activity.contentView +import kotlinx.android.synthetic.main.compose_activity.counter +import kotlinx.android.synthetic.main.compose_activity.gallery +import kotlinx.android.synthetic.main.compose_activity.galleryLabel +import kotlinx.android.synthetic.main.compose_activity.loading +import kotlinx.android.synthetic.main.compose_activity.message +import kotlinx.android.synthetic.main.compose_activity.messageList +import kotlinx.android.synthetic.main.compose_activity.messagesEmpty +import kotlinx.android.synthetic.main.compose_activity.noValidRecipients +import kotlinx.android.synthetic.main.compose_activity.parts +import kotlinx.android.synthetic.main.compose_activity.schedule +import kotlinx.android.synthetic.main.compose_activity.scheduleLabel +import kotlinx.android.synthetic.main.compose_activity.scheduledCancel +import kotlinx.android.synthetic.main.compose_activity.scheduledGroup +import kotlinx.android.synthetic.main.compose_activity.scheduledTime +import kotlinx.android.synthetic.main.compose_activity.send +import kotlinx.android.synthetic.main.compose_activity.sendAsGroup +import kotlinx.android.synthetic.main.compose_activity.sendAsGroupBackground +import kotlinx.android.synthetic.main.compose_activity.sendAsGroupSwitch +import kotlinx.android.synthetic.main.compose_activity.sim +import kotlinx.android.synthetic.main.compose_activity.simIndex +import kotlinx.android.synthetic.main.compose_activity.toolbarSubtitle +import kotlinx.android.synthetic.main.compose_activity.toolbarTitle import kotlinx.android.synthetic.main.main_activity.toolbar -import kotlinx.coroutines.reactive.publish import java.text.SimpleDateFormat -import java.util.* +import java.util.Calendar +import java.util.Date +import java.util.Locale import javax.inject.Inject @@ -97,13 +132,15 @@ 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 contextItemIntent: 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 } + override val messagePartContextMenuRegistrar: Subject by lazy { messageAdapter.partContextMenuRegistrar } 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 cancelSendingIntent: Subject by lazy { messageAdapter.cancelSendingClicks } + override val sendNowIntent: Subject by lazy { messageAdapter.sendNowClicks } + override val resendIntent: Subject by lazy { messageAdapter.resendClicks } 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()) } @@ -170,7 +207,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { messageList.setHasFixedSize(true) messageList.adapter = messageAdapter - attachments.adapter = attachmentAdapter + parts.adapter = attachmentAdapter message.supportsInputContent = true @@ -218,6 +255,12 @@ class ComposeActivity : QkThemedActivity(), ComposeView { } }) + // context menu registration for message parts + messagePartContextMenuRegistrar + .mapNotNull { it } + .autoDisposable(scope()) + .subscribe { registerForContextMenu(it) } + window.callback = ComposeWindowCallback(window.callback, this) } @@ -293,7 +336,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { scheduledGroup.isVisible = state.scheduled != 0L scheduledTime.text = dateFormatter.getScheduledTimestamp(state.scheduled) - attachments.setVisible(state.attachments.isNotEmpty()) + parts.setVisible(state.attachments.isNotEmpty()) attachmentAdapter.data = state.attachments attach.animate().rotation(if (state.attaching) 135f else 0f).start() @@ -491,6 +534,21 @@ class ComposeActivity : QkThemedActivity(), ComposeView { return super.getColoredMenuItems() + R.id.call } + override fun onCreateContextMenu( + menu: ContextMenu?, + v: View?, + menuInfo: ContextMenu.ContextMenuInfo? + ) { + super.onCreateContextMenu(menu, v, menuInfo) + menuInflater.inflate(R.menu.mms_part_menu, menu) + } + + override fun onContextItemSelected(item: MenuItem): Boolean { + super.onContextItemSelected(item) + contextItemIntent.onNext(item) + return true + } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (resultCode != Activity.RESULT_OK) return 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 d5b96e11..64f5669c 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 @@ -19,6 +19,8 @@ package dev.octoshrimpy.quik.feature.compose import android.net.Uri +import android.view.MenuItem +import android.view.View import androidx.annotation.StringRes import androidx.core.view.inputmethod.InputContentInfoCompat import dev.octoshrimpy.quik.common.base.QkView @@ -43,12 +45,14 @@ interface ComposeView : QkView { val chipDeletedIntent: Subject val menuReadyIntent: Observable val optionsItemIntent: Observable + val contextItemIntent: Observable val sendAsGroupIntent: Observable<*> - val messageClickIntent: Subject val messagePartClickIntent: Subject + val messagePartContextMenuRegistrar: Subject val messagesSelectedIntent: Observable> val cancelSendingIntent: Subject val sendNowIntent: Subject + val resendIntent: 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 14242737..6763f183 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 @@ -60,7 +60,10 @@ 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.common.widget.QkContextMenuRecyclerView import dev.octoshrimpy.quik.extensions.isSmil +import dev.octoshrimpy.quik.interactor.SaveImage +import dev.octoshrimpy.quik.model.MmsPart import io.reactivex.Observable import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.rxkotlin.Observables @@ -99,7 +102,8 @@ class ComposeViewModel @Inject constructor( private val prefs: Preferences, private val retrySending: RetrySending, private val sendMessage: SendMessage, - private val subscriptionManager: SubscriptionManagerCompat + private val subscriptionManager: SubscriptionManagerCompat, + private val saveImage: SaveImage, ) : QkViewModel(ComposeState( editingMode = threadId == 0L && addresses.isEmpty(), threadId = threadId, @@ -432,6 +436,61 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { newState { copy(query = "", searchSelectionId = -1) } } + // message part context menu item selected - save + view.contextItemIntent + .filter { it.itemId == R.id.save } + .filter { permissionManager.hasStorage().also { if (!it) view.requestStoragePermission() } } + .autoDisposable(view.scope()) + .subscribe { + val menuInfo = it.menuInfo as QkContextMenuRecyclerView.ContextMenuInfo + if (menuInfo.viewHolderValue != null) + saveImage.execute(menuInfo.viewHolderValue.id) { + context.makeToast(R.string.gallery_toast_saved) + } + } + + // message part context menu item selected - share + view.contextItemIntent + .filter { it.itemId == R.id.share } + .autoDisposable(view.scope()) + .subscribe { + val menuInfo = it.menuInfo as QkContextMenuRecyclerView.ContextMenuInfo + if (menuInfo.viewHolderValue != null) + navigator.shareFile( + MmsPartProvider.getUriForMmsPartId( + menuInfo.viewHolderValue.id, + menuInfo.viewHolderValue.getBestFilename() + ), + menuInfo.viewHolderValue.type + ) + } + + // message part context menu item selected - forward + view.contextItemIntent + .filter { it.itemId == R.id.forward } + .autoDisposable(view.scope()) + .subscribe { + val menuInfo = it.menuInfo as QkContextMenuRecyclerView.ContextMenuInfo + if (menuInfo.viewHolderValue != null) + navigator.showCompose("", listOf(menuInfo.viewHolderValue.getUri())) + } + + // message part context menu item selected - open externally + view.contextItemIntent + .filter { it.itemId == R.id.openExternally } + .autoDisposable(view.scope()) + .subscribe { + val menuInfo = it.menuInfo as QkContextMenuRecyclerView.ContextMenuInfo + if (menuInfo.viewHolderValue != null) + navigator.viewFile( + MmsPartProvider.getUriForMmsPartId( + menuInfo.viewHolderValue.id, + menuInfo.viewHolderValue.getBestFilename() + ), + menuInfo.viewHolderValue.type + ) + } + // Toggle the group sending mode view.sendAsGroupIntent .autoDisposable(view.scope()) @@ -451,14 +510,6 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe() - // Retry sending - view.messageClickIntent - .mapNotNull(messageRepo::getMessage) - .filter { message -> message.isFailedMessage() } - .doOnNext { message -> retrySending.execute(message.id) } - .autoDisposable(view.scope()) - .subscribe() - // Media attachment clicks view.messagePartClickIntent .mapNotNull(messageRepo::getPart) @@ -495,23 +546,31 @@ class ComposeViewModel @Inject constructor( // 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 - ) + .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 ) - } + ) + } + + // resend a failed message + view.resendIntent + .mapNotNull(messageRepo::getMessage) + .filter { message -> message.isFailedMessage() } + .doOnNext { message -> retrySending.execute(message.id) } + .autoDisposable(view.scope()) + .subscribe() // Show the message details view.messageLinkAskIntent 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 dc397a65..eef46e48 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 @@ -45,7 +45,6 @@ import dev.octoshrimpy.quik.common.util.Colors import dev.octoshrimpy.quik.common.util.DateFormatter import dev.octoshrimpy.quik.common.util.TextViewStyler import dev.octoshrimpy.quik.common.util.extensions.dpToPx -import dev.octoshrimpy.quik.common.util.extensions.forwardTouches import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint import dev.octoshrimpy.quik.common.util.extensions.setPadding import dev.octoshrimpy.quik.common.util.extensions.setTint @@ -66,7 +65,7 @@ import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.Subject import io.realm.RealmResults import kotlinx.android.synthetic.main.message_list_item_in.* -import kotlinx.android.synthetic.main.message_list_item_in.attachments +import kotlinx.android.synthetic.main.message_list_item_in.parts import kotlinx.android.synthetic.main.message_list_item_in.body import kotlinx.android.synthetic.main.message_list_item_in.sim import kotlinx.android.synthetic.main.message_list_item_in.simIndex @@ -109,11 +108,13 @@ class MessagesAdapter @Inject constructor( } - val clicks: Subject = PublishSubject.create() + // click events passed back to compose view model val partClicks: Subject = PublishSubject.create() val messageLinkClicks: Subject = PublishSubject.create() - val cancelSending: Subject = PublishSubject.create() - val sendNow: Subject = PublishSubject.create() + val cancelSendingClicks: Subject = PublishSubject.create() + val sendNowClicks: Subject = PublishSubject.create() + val resendClicks: Subject = PublishSubject.create() + val partContextMenuRegistrar: Subject = PublishSubject.create() var data: Pair>? = null set(value) { @@ -150,11 +151,6 @@ class MessagesAdapter @Inject constructor( 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 - * don't need clipToOutline set to true, and they don't need to worry about images - */ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder { // Use the parent's context to inflate the layout, otherwise link clicks will crash the app @@ -166,15 +162,15 @@ class MessagesAdapter @Inject constructor( view.findViewById(R.id.cancelIcon).setTint(theme.theme) view.findViewById(R.id.cancel).setTint(theme.theme) view.findViewById(R.id.sendNowIcon).setTint(theme.theme) + view.findViewById(R.id.resendIcon).setTint(theme.theme) } else { view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false) } view.body.hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE - val partsAdapter = partsAdapterProvider.get() - partsAdapter.clicks.subscribe(partClicks) - view.attachments.adapter = partsAdapter + // register recycler view with compose activity for context menus + partContextMenuRegistrar.onNext(view.parts) return QkViewHolder(view).apply { view.setOnClickListener { @@ -182,7 +178,6 @@ class MessagesAdapter @Inject constructor( when (toggleSelection(message.id, false)) { true -> view.isActivated = isSelected(message.id) false -> { - clicks.onNext(message.id) expanded[message.id] = view.status.visibility != View.VISIBLE notifyItemChanged(adapterPosition) } @@ -207,45 +202,60 @@ class MessagesAdapter @Inject constructor( false -> colors.theme(contactCache[message.address]) } + holder.parts.adapter = partsAdapterProvider.get().apply { + contextMenuValue = message.id + clicks.subscribe(partClicks) // part clicks gets passed back to compose view model + } + // Update the selected state holder.containerView.isActivated = isSelected(message.id) || highlight == message.id // 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 + holder.cancelFrame.let { cancelFrame -> + val isCancellable = message.isSending() && message.date > System.currentTimeMillis() + cancelFrame.visibility = if (isCancellable) View.VISIBLE else View.GONE + cancelFrame.clicks().subscribe { cancelSendingClicks.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(cancelFrame.cancel, "progress", progress.toInt(), 100) - .setDuration(message.date - System.currentTimeMillis()) - .start() + ObjectAnimator.ofInt(cancelFrame.cancel, "progress", progress.toInt(), 100) + .setDuration(message.date - System.currentTimeMillis()) + .start() + } + } + + // bind the send now icon view + holder.sendNowIcon.let { sendNowIcon -> + if (message.isSending() && message.date > System.currentTimeMillis()) { + sendNowIcon.visibility = View.VISIBLE + sendNowIcon.clicks().subscribe { sendNowClicks.onNext(message.id) } + } + else + sendNowIcon.visibility = View.GONE + } + + // bind the resend icon view + holder.resendIcon.let { resendIcon -> + if (message.isFailedMessage()) { + resendIcon.visibility = View.VISIBLE + resendIcon.clicks().subscribe { + resendClicks.onNext(message.id) + resendIcon.visibility = View.GONE } } + else + resendIcon.visibility = View.GONE } - // 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.clicks().subscribe { sendNow.onNext(message.id) } - } - } - - val cancelableSimpleOnGestureListener = holder.body.forwardTouches(holder.containerView) - // Bind the message status bindStatus(holder, message, next) @@ -325,9 +335,6 @@ class MessagesAdapter @Inject constructor( 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), @@ -351,8 +358,8 @@ class MessagesAdapter @Inject constructor( canGroupWithNext = canGroup(message, next), isMe = message.isMe())) - // Bind the attachments - val partsAdapter = holder.attachments.adapter as PartsAdapter + // Bind the parts + val partsAdapter = (holder.parts.adapter as PartsAdapter) partsAdapter.theme = theme partsAdapter.setData(message, previous, next, holder, audioState) } @@ -365,12 +372,9 @@ class MessagesAdapter @Inject constructor( message.isDelivered() -> context.getString(R.string.message_status_delivered, dateFormatter.getTimestamp(message.dateSent)) message.isFailedMessage() -> context.getString(R.string.message_status_failed) - - // Incoming group message - !message.isMe() && conversation?.recipients?.size ?: 0 > 1 -> { + !message.isMe() && (conversation?.recipients?.size ?: 0) > 1 -> { // incoming group message "${contactCache[message.address]?.getDisplayName()} • ${dateFormatter.getTimestamp(message.date)}" } - else -> dateFormatter.getTimestamp(message.date) } @@ -379,7 +383,7 @@ class MessagesAdapter @Inject constructor( message.isSending() -> true message.isFailedMessage() -> true expanded[message.id] == false -> false - conversation?.recipients?.size ?: 0 > 1 && !message.isMe() && next?.compareSender(message) != true -> true + (conversation?.recipients?.size ?: 0) > 1 && !message.isMe() && next?.compareSender(message) != true -> true message.isDelivered() && next?.isDelivered() != true && age <= BubbleUtils.TIMESTAMP_THRESHOLD -> true else -> false }) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/ChipsAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/ChipsAdapter.kt index 6ac7aa02..9ac1f07f 100755 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/ChipsAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/ChipsAdapter.kt @@ -35,7 +35,7 @@ import io.reactivex.subjects.PublishSubject import kotlinx.android.synthetic.main.contact_chip.* import javax.inject.Inject -class ChipsAdapter @Inject constructor() : QkAdapter() { +class ChipsAdapter @Inject constructor() : QkAdapter() { var view: RecyclerView? = null val chipDeleted: PublishSubject = PublishSubject.create() diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/ComposeItemAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/ComposeItemAdapter.kt index 70d78e11..85b23851 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/ComposeItemAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/ComposeItemAdapter.kt @@ -45,7 +45,7 @@ import javax.inject.Inject class ComposeItemAdapter @Inject constructor( private val colors: Colors, private val conversationRepo: ConversationRepository -) : QkAdapter() { +) : QkAdapter() { val clicks: Subject = PublishSubject.create() val longClicks: Subject = PublishSubject.create() diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/PhoneNumberAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/PhoneNumberAdapter.kt index 09d2d2ab..5d2658aa 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/PhoneNumberAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/PhoneNumberAdapter.kt @@ -26,7 +26,7 @@ import dev.octoshrimpy.quik.common.base.QkViewHolder import dev.octoshrimpy.quik.model.PhoneNumber import kotlinx.android.synthetic.main.contact_number_list_item.* -class PhoneNumberAdapter : QkAdapter() { +class PhoneNumberAdapter : QkAdapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder { val inflater = LayoutInflater.from(parent.context) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/PhoneNumberPickerAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/PhoneNumberPickerAdapter.kt index 633b8c8a..31130c8c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/PhoneNumberPickerAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/editing/PhoneNumberPickerAdapter.kt @@ -36,7 +36,7 @@ import javax.inject.Inject class PhoneNumberPickerAdapter @Inject constructor( private val context: Context -) : QkAdapter() { +) : QkAdapter() { val selectedItemChanges: Subject> = BehaviorSubject.create() 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 89d2352d..44faa595 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 @@ -107,6 +107,9 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte canGroupWithPrevious: Boolean, canGroupWithNext: Boolean, ) { + // click on background - passes back to compose view model + holder.containerView.setOnClickListener { clicks.onNext(part.id) } + // play/pause button click handling holder.playPause.setOnClickListener { when (holder.playPause.tag) { @@ -177,14 +180,6 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte } } - // share button click handling - holder.share.setOnClickListener { - navigator.shareFile( - MmsPartProvider.getUriForMmsPartId(part.id, part.getBestFilename()), - part.type - ) - } - // if this item is the active active audio item update the active view holder if (audioState.partId == part.id) audioState.viewHolder = holder @@ -238,10 +233,6 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte setBackgroundTint(primaryColor) } - // share button - holder.share.setTint(secondaryColor) - holder.share.setBackgroundTint(primaryColor) - MediaMetadataRetriever().use { it.setDataSource(context, part.getUri()) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/FileBinder.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/FileBinder.kt index 7fe60f4b..a5990a09 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/FileBinder.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/FileBinder.kt @@ -36,7 +36,6 @@ import dev.octoshrimpy.quik.model.MmsPart import io.reactivex.Observable import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers -import kotlinx.android.synthetic.main.mms_audio_preview_list_item.share import kotlinx.android.synthetic.main.mms_file_list_item.* import javax.inject.Inject @@ -76,33 +75,18 @@ class FileBinder @Inject constructor(colors: Colors, private val context: Contex .observeOn(AndroidSchedulers.mainThread()) .subscribe { size -> holder.size.text = size } - // share button click handling - holder.share.setOnClickListener { - navigator.shareFile( - MmsPartProvider.getUriForMmsPartId(part.id, part.getBestFilename()), - part.type - ) - } - holder.filename.text = part.name - val params = holder.fileBackground.layoutParams as FrameLayout.LayoutParams if (!message.isMe()) { - holder.fileBackground.layoutParams = params.apply { gravity = Gravity.START } holder.fileBackground.setBackgroundTint(theme.theme) holder.icon.setTint(theme.textPrimary) holder.filename.setTextColor(theme.textPrimary) holder.size.setTextColor(theme.textTertiary) - holder.share.setTint(theme.theme) - holder.share.setBackgroundTint(theme.textPrimary) } else { - holder.fileBackground.layoutParams = params.apply { gravity = Gravity.END } holder.fileBackground.setBackgroundTint(holder.containerView.context.resolveThemeColor(R.attr.bubbleColor)) holder.icon.setTint(holder.containerView.context.resolveThemeColor(android.R.attr.textColorSecondary)) holder.filename.setTextColor(holder.containerView.context.resolveThemeColor(android.R.attr.textColorPrimary)) holder.size.setTextColor(holder.containerView.context.resolveThemeColor(android.R.attr.textColorTertiary)) - holder.share.setTint(holder.containerView.context.resolveThemeColor(R.attr.bubbleColor)) - holder.share.setBackgroundTint(holder.containerView.context.resolveThemeColor(android.R.attr.textColorTertiary)) } } 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 7449616c..f5491e5f 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 @@ -18,13 +18,13 @@ */ package dev.octoshrimpy.quik.feature.compose.part +import android.net.Uri import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import dev.octoshrimpy.quik.common.base.QkAdapter import dev.octoshrimpy.quik.common.base.QkViewHolder import dev.octoshrimpy.quik.common.util.Colors -import dev.octoshrimpy.quik.common.util.extensions.forwardTouches +import dev.octoshrimpy.quik.common.widget.QkContextMenuRecyclerView import dev.octoshrimpy.quik.extensions.isSmil import dev.octoshrimpy.quik.extensions.isText import dev.octoshrimpy.quik.feature.compose.BubbleUtils.canGroup @@ -35,13 +35,14 @@ import io.reactivex.Observable import kotlinx.android.synthetic.main.message_list_item_in.* import javax.inject.Inject + class PartsAdapter @Inject constructor( colors: Colors, fileBinder: FileBinder, imageBinder: ImageBinder, audioBinder: AudioBinder, vCardBinder: VCardBinder, -) : QkAdapter() { +) : QkContextMenuRecyclerView.Adapter>() { private val partBinders = listOf(audioBinder, imageBinder, vCardBinder, fileBinder) @@ -56,7 +57,6 @@ class PartsAdapter @Inject constructor( private lateinit var message: Message private var previous: Message? = null private var next: Message? = null - private var holder: QkViewHolder? = null private var bodyVisible: Boolean = true private var audioState: MessagesAdapter.AudioState? = null @@ -70,37 +70,39 @@ class PartsAdapter @Inject constructor( 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 { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) + : QkContextMenuRecyclerView.ViewHolder { val layout = partBinders.getOrNull(viewType)?.partLayout ?: 0 val view = LayoutInflater.from(parent.context).inflate(layout, parent, false) - holder?.containerView?.let(view::forwardTouches) - return QkViewHolder(view) + return QkContextMenuRecyclerView.ViewHolder(view) } - override fun onBindViewHolder(holder: QkViewHolder, position: Int) { + override fun onBindViewHolder(holder: QkContextMenuRecyclerView.ViewHolder, position: Int) { val part = data[position] + holder.contextMenuValue = part + val canGroupWithPrevious = canGroup(message, previous) || position > 0 val canGroupWithNext = canGroup(message, next) || position < itemCount - 1 || bodyVisible val binder = partBinders.firstOrNull { it.canBindPart(part) } + if (binder == null) + return - // if audioState is set and binder is audio type, set audioState into it + // if audioState is set and binder is audio type, set it's audioState ref if ((audioState != null) && (binder is AudioBinder)) binder.audioState = audioState!! - binder?.bindPart(holder, part, message, canGroupWithPrevious, canGroupWithNext) + binder.bindPart(holder, part, message, canGroupWithPrevious, canGroupWithNext) } override fun getItemViewType(position: Int): Int { - val part = data[position] - return partBinders.indexOfFirst { it.canBindPart(part) } + return partBinders.indexOfFirst { it.canBindPart(data[position]) } } } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt index aae439e2..1bf1cd74 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt @@ -71,15 +71,12 @@ class VCardBinder @Inject constructor(colors: Colors, private val context: Conte holder.name.isVisible = displayName.isNotEmpty() } - val params = holder.vCardBackground.layoutParams as FrameLayout.LayoutParams if (!message.isMe()) { - holder.vCardBackground.layoutParams = params.apply { gravity = Gravity.START } holder.vCardBackground.setBackgroundTint(theme.theme) holder.vCardAvatar.setTint(theme.textPrimary) holder.name.setTextColor(theme.textPrimary) holder.label.setTextColor(theme.textTertiary) } else { - holder.vCardBackground.layoutParams = params.apply { gravity = Gravity.END } holder.vCardBackground.setBackgroundTint(holder.containerView.context.resolveThemeColor(R.attr.bubbleColor)) holder.vCardAvatar.setTint(holder.containerView.context.resolveThemeColor(android.R.attr.textColorSecondary)) holder.name.setTextColor(holder.containerView.context.resolveThemeColor(android.R.attr.textColorPrimary)) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoAdapter.kt index fa67e48e..35182204 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoAdapter.kt @@ -24,7 +24,7 @@ import javax.inject.Inject class ConversationInfoAdapter @Inject constructor( private val context: Context, private val colors: Colors -) : QkAdapter() { +) : QkAdapter() { val recipientClicks: Subject = PublishSubject.create() val recipientLongClicks: Subject = PublishSubject.create() diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryActivity.kt index 68dfb6ca..1329b315 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryActivity.kt @@ -107,7 +107,7 @@ class GalleryActivity : QkActivity(), GalleryView { } override fun onCreateOptionsMenu(menu: Menu?): Boolean { - menuInflater.inflate(R.menu.gallery, menu) + menuInflater.inflate(R.menu.mms_part_menu, menu) return super.onCreateOptionsMenu(menu) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryPagerAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryPagerAdapter.kt index 139ebd7c..c6497932 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryPagerAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryPagerAdapter.kt @@ -114,7 +114,7 @@ class GalleryPagerAdapter @Inject constructor(private val context: Context) : Qk holder.video.player = exoPlayer exoPlayers.add(exoPlayer) - val dataSourceFactory = DefaultDataSourceFactory(context, Util.getUserAgent(context, "QKSMS")) + val dataSourceFactory = DefaultDataSourceFactory(context, Util.getUserAgent(context, "QUIK")) val videoSource = ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(part.getUri()) exoPlayer?.prepare(videoSource) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryViewModel.kt index 6e4950d9..1438bf0a 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/gallery/GalleryViewModel.kt @@ -31,6 +31,8 @@ import dev.octoshrimpy.quik.repository.ConversationRepository import dev.octoshrimpy.quik.repository.MessageRepository import com.uber.autodispose.android.lifecycle.scope import com.uber.autodispose.autoDisposable +import dev.octoshrimpy.quik.common.widget.QkContextMenuRecyclerView +import dev.octoshrimpy.quik.model.MmsPart import io.reactivex.Flowable import io.reactivex.rxkotlin.plusAssign import io.reactivex.rxkotlin.withLatestFrom @@ -75,7 +77,7 @@ class GalleryViewModel @Inject constructor( // Save image to device view.optionsItemSelected() - .filter { itemId -> itemId == R.id.save } + .filter { it == R.id.save } .filter { permissions.hasStorage().also { if (!it) view.requestStoragePermission() } } .withLatestFrom(view.pageChanged()) { _, part -> part.id } .autoDisposable(view.scope()) @@ -83,7 +85,7 @@ class GalleryViewModel @Inject constructor( // Share image externally view.optionsItemSelected() - .filter { itemId -> itemId == R.id.share } + .filter { it == R.id.share } .withLatestFrom(view.pageChanged()) { _, part -> part } .autoDisposable(view.scope()) .subscribe { @@ -92,6 +94,25 @@ class GalleryViewModel @Inject constructor( it.type ) } + + // message part context menu item selected - forward + view.optionsItemSelected() + .filter { it == R.id.forward } + .withLatestFrom(view.pageChanged()) { _, part -> part } + .autoDisposable(view.scope()) + .subscribe { navigator.showCompose("", listOf(it.getUri())) } + + // message part context menu item selected - open externally + view.optionsItemSelected() + .filter { it == R.id.openExternally } + .withLatestFrom(view.pageChanged()) { _, part -> part } + .autoDisposable(view.scope()) + .subscribe { + navigator.viewFile( + MmsPartProvider.getUriForMmsPartId(it.id, it.getBestFilename()), + it.type + ) + } } } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/main/SearchAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/main/SearchAdapter.kt index 85c0555e..61200d67 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/main/SearchAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/main/SearchAdapter.kt @@ -42,7 +42,7 @@ class SearchAdapter @Inject constructor( private val context: Context, private val dateFormatter: DateFormatter, private val navigator: Navigator -) : QkAdapter() { +) : QkAdapter() { private val highlightColor: Int by lazy { colors.theme().highlight } 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 e5f3e1b4..2b826dff 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 @@ -39,7 +39,7 @@ import javax.inject.Inject class ScheduledMessageAttachmentAdapter @Inject constructor( private val context: Context -) : QkAdapter() { +) : QkAdapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder { return QkViewHolder( diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/themepicker/ThemeAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/themepicker/ThemeAdapter.kt index 207aebd5..0d05e068 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/themepicker/ThemeAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/themepicker/ThemeAdapter.kt @@ -43,7 +43,7 @@ import javax.inject.Inject class ThemeAdapter @Inject constructor( private val context: Context, private val colors: Colors -) : QkAdapter>() { +) : QkAdapter, QkViewHolder>() { val colorSelected: Subject = PublishSubject.create() diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index 9da2deb6..95f8b1e4 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -133,7 +133,7 @@ android:id="@+id/composeBar" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:constraint_referenced_ids="messageBackground,attachments,attach,message,counter,send" /> + app:constraint_referenced_ids="messageBackground,parts,attach,message,counter,send" /> - - + android:textIsSelectable="true" /> - + android:orientation="horizontal"> + + + + + + diff --git a/presentation/src/main/res/layout/mms_audio_preview_list_item.xml b/presentation/src/main/res/layout/mms_audio_preview_list_item.xml index a9f65b55..e89525c2 100644 --- a/presentation/src/main/res/layout/mms_audio_preview_list_item.xml +++ b/presentation/src/main/res/layout/mms_audio_preview_list_item.xml @@ -92,22 +92,9 @@ android:text="@tools:sample/lorem/random[0]" android:textColor="@color/black" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@id/share" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/playPause" /> - \ No newline at end of file diff --git a/presentation/src/main/res/layout/mms_file_list_item.xml b/presentation/src/main/res/layout/mms_file_list_item.xml index 8acc1d77..6198ba13 100644 --- a/presentation/src/main/res/layout/mms_file_list_item.xml +++ b/presentation/src/main/res/layout/mms_file_list_item.xml @@ -17,72 +17,62 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:id="@+id/fileBackground" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> - + + + android:layout_height="wrap_content" + android:orientation="vertical"> - - - - - - - - - - + app:textSize="primary" + tools:text="a test file.pdf" /> - + + - + diff --git a/presentation/src/main/res/layout/mms_vcard_list_item.xml b/presentation/src/main/res/layout/mms_vcard_list_item.xml index 45aa8245..1cf308b5 100644 --- a/presentation/src/main/res/layout/mms_vcard_list_item.xml +++ b/presentation/src/main/res/layout/mms_vcard_list_item.xml @@ -17,56 +17,60 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:id="@+id/vCardBackground" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> - + + + + + android:paddingEnd="12dp" + android:singleLine="true" + android:textColor="?android:attr/textColorPrimary" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/icon" + app:layout_constraintTop_toTopOf="parent" + app:textSize="primary" + tools:text="Person Name" /> - + + - - - - - - - + diff --git a/presentation/src/main/res/menu/gallery.xml b/presentation/src/main/res/menu/mms_part_menu.xml similarity index 53% rename from presentation/src/main/res/menu/gallery.xml rename to presentation/src/main/res/menu/mms_part_menu.xml index 9cd668b4..457e5157 100644 --- a/presentation/src/main/res/menu/gallery.xml +++ b/presentation/src/main/res/menu/mms_part_menu.xml @@ -1,30 +1,38 @@ + android:title="@string/menu_mms_part_save" /> + android:title="@string/menu_mms_part_share" /> - + + + + + \ 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 db3e19c8..42a4e3f7 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -38,8 +38,11 @@ Add person Call Details - Save to gallery - Share + + Save to gallery + Share + Forward + Open externally Open navigation drawer %d selected From 68a2b353a1b58ef8856e71f81b704b55acefefbd Mon Sep 17 00:00:00 2001 From: octoshrimpy Date: Mon, 10 Feb 2025 08:36:23 -0700 Subject: [PATCH 09/29] Update build-and-release.yml --- .github/workflows/build-and-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 73408819..71e0069f 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -3,8 +3,6 @@ name: Build and Release on: workflow_dispatch: push: - branches: - - master tags: - "v*" From 0bab3ff9ec8795da7eeb8b8cf44fa389f1b5ea72 Mon Sep 17 00:00:00 2001 From: octoshrimpy Date: Mon, 10 Feb 2025 08:36:50 -0700 Subject: [PATCH 10/29] Update build-on-pull.yml --- .github/workflows/build-on-pull.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-on-pull.yml b/.github/workflows/build-on-pull.yml index f2ad17b4..25eaddfe 100644 --- a/.github/workflows/build-on-pull.yml +++ b/.github/workflows/build-on-pull.yml @@ -1,6 +1,7 @@ name: Build and Test on Pull Request on: + workflow_dispatch: pull_request: branches: - '**' From 976d8a7ece52532d5f94f71349198e49feda8715 Mon Sep 17 00:00:00 2001 From: octoshrimpy Date: Mon, 10 Feb 2025 08:47:03 -0700 Subject: [PATCH 11/29] Update PR-deploy.yml --- .github/workflows/PR-deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/PR-deploy.yml b/.github/workflows/PR-deploy.yml index d874336e..88f1d196 100644 --- a/.github/workflows/PR-deploy.yml +++ b/.github/workflows/PR-deploy.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup JDK uses: actions/setup-java@v3 @@ -41,7 +41,7 @@ jobs: run: mv presentation/build/outputs/apk/noAnalytics/release/QUIK-v*-noAnalytics-release.apk presentation/build/outputs/apk/noAnalytics/release/QUIK-noAnalytics-release.apk - name: Upload APK - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: apk path: presentation/build/outputs/apk/noAnalytics/release/QUIK-noAnalytics-release.apk @@ -53,7 +53,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') steps: - name: Download APK from build - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: apk @@ -69,7 +69,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Validate Fastlane Supply Metadata uses: ashutoshgngwr/validate-fastlane-supply-metadata@v2.0.0 From 4420dc454c879ddca7224ef1d3061804d4e65a77 Mon Sep 17 00:00:00 2001 From: octoshrimpy Date: Mon, 10 Feb 2025 08:55:33 -0700 Subject: [PATCH 12/29] Update build-and-release.yml --- .github/workflows/build-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 71e0069f..77093508 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup JDK uses: actions/setup-java@v3 @@ -53,7 +53,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set release datetime run: echo "DATETIME=$(date +'%d-%m-%y_%s')" >> $GITHUB_ENV From 0741a94e7052ed268c9f57adcbc4398effe66454 Mon Sep 17 00:00:00 2001 From: octoshrimpy Date: Mon, 10 Feb 2025 09:00:25 -0700 Subject: [PATCH 13/29] Update PR-deploy.yml --- .github/workflows/PR-deploy.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/PR-deploy.yml b/.github/workflows/PR-deploy.yml index 88f1d196..b3c4a4a4 100644 --- a/.github/workflows/PR-deploy.yml +++ b/.github/workflows/PR-deploy.yml @@ -47,7 +47,7 @@ jobs: path: presentation/build/outputs/apk/noAnalytics/release/QUIK-noAnalytics-release.apk release: - name: Release APK + name: validate fdroid APK needs: apk runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') @@ -59,14 +59,6 @@ jobs: - name: List files in the APK directory run: ls -Rla ./ - - - name: Create and upload pre-release - uses: softprops/action-gh-release@v1 - with: - files: presentation/build/outputs/apk/noAnalytics/release/QUIK-noAnalytics-release.apk - prerelease: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Checkout uses: actions/checkout@v4 From 7a4cb07ceb2b7ed8fb6759e7214e8cd6c180387c Mon Sep 17 00:00:00 2001 From: gavine99 Date: Tue, 11 Feb 2025 06:09:36 +1100 Subject: [PATCH 14/29] fix npe when setting out icons in messagesadapter when in message --- .../QKSMS/feature/compose/MessagesAdapter.kt | 66 ++++++++++--------- 1 file changed, 35 insertions(+), 31 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 eef46e48..e6f2074f 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 @@ -211,49 +211,53 @@ class MessagesAdapter @Inject constructor( holder.containerView.isActivated = isSelected(message.id) || highlight == message.id // Bind the cancelFrame (cancel button) view - holder.cancelFrame.let { cancelFrame -> - val isCancellable = message.isSending() && message.date > System.currentTimeMillis() - cancelFrame.visibility = if (isCancellable) View.VISIBLE else View.GONE - cancelFrame.clicks().subscribe { cancelSendingClicks.onNext(message.id) } - cancelFrame.cancel.progress = 2 + 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 { cancelSendingClicks.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 + 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(cancelFrame.cancel, "progress", progress.toInt(), 100) + .setDuration(message.date - System.currentTimeMillis()) + .start() } - val progress = - (1 - (message.date - System.currentTimeMillis()) / delay.toFloat()) * 100 - - ObjectAnimator.ofInt(cancelFrame.cancel, "progress", progress.toInt(), 100) - .setDuration(message.date - System.currentTimeMillis()) - .start() } } // bind the send now icon view - holder.sendNowIcon.let { sendNowIcon -> - if (message.isSending() && message.date > System.currentTimeMillis()) { - sendNowIcon.visibility = View.VISIBLE - sendNowIcon.clicks().subscribe { sendNowClicks.onNext(message.id) } + if (holder.sendNowIcon != null) { + holder.sendNowIcon.let { sendNowIcon -> + if (message.isSending() && message.date > System.currentTimeMillis()) { + sendNowIcon.visibility = View.VISIBLE + sendNowIcon.clicks().subscribe { sendNowClicks.onNext(message.id) } + } else + sendNowIcon.visibility = View.GONE } - else - sendNowIcon.visibility = View.GONE } // bind the resend icon view - holder.resendIcon.let { resendIcon -> - if (message.isFailedMessage()) { - resendIcon.visibility = View.VISIBLE - resendIcon.clicks().subscribe { - resendClicks.onNext(message.id) + if (holder.resendIcon != null) { + holder.resendIcon.let { resendIcon -> + if (message.isFailedMessage()) { + resendIcon.visibility = View.VISIBLE + resendIcon.clicks().subscribe { + resendClicks.onNext(message.id) + resendIcon.visibility = View.GONE + } + } else resendIcon.visibility = View.GONE - } } - else - resendIcon.visibility = View.GONE } // Bind the message status From ae942aa35dd1337f12fee64ddb45b0ccd3ef1698 Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Mon, 10 Feb 2025 11:13:09 -0800 Subject: [PATCH 15/29] Update strings.xml Change to "Leave A Star". --- presentation/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index db3e19c8..dec591fc 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -86,7 +86,7 @@ Unlock amazing new features, and support development Enjoying QUIK? - Share some love and rate us on Google Play! + Share some love and leave us a Star on GitHub! OKAY! DISMISS From 51a0576ce0dc2afa20865f84426e85ae5e96f1c4 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 12 Feb 2025 14:35:17 +1100 Subject: [PATCH 16/29] new setting to show/hide new stt button - defaults to 'show' to enable discovery by user. move compose stt feature from double-tap compose entry box to new button on compose activity --- .../java/com/moez/QKSMS/util/Preferences.kt | 1 + .../QKSMS/feature/compose/ComposeActivity.kt | 92 ++++++++----------- .../moez/QKSMS/feature/compose/ComposeView.kt | 5 +- .../QKSMS/feature/compose/ComposeViewModel.kt | 5 + .../feature/settings/SettingsController.kt | 2 + .../feature/settings/SettingsPresenter.kt | 7 +- .../QKSMS/feature/settings/SettingsState.kt | 1 + .../res/drawable/ic_speech_to_text_black.xml | 11 +++ .../src/main/res/layout/compose_activity.xml | 38 +++++++- .../main/res/layout/settings_controller.xml | 8 ++ presentation/src/main/res/values/strings.xml | 1 + 11 files changed, 112 insertions(+), 59 deletions(-) create mode 100644 presentation/src/main/res/drawable/ic_speech_to_text_black.xml 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 ce10166d..eb102d3b 100644 --- a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt +++ b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt @@ -108,6 +108,7 @@ class Preferences @Inject constructor( val black = rxPrefs.getBoolean("black", false) val autoColor = rxPrefs.getBoolean("autoColor", true) val systemFont = rxPrefs.getBoolean("systemFont", false) + val showStt = rxPrefs.getBoolean("showStt", true) val textSize = rxPrefs.getInteger("textSize", TEXT_SIZE_NORMAL) val blockingManager = rxPrefs.getInteger("blockingManager", BLOCKING_MANAGER_QKSMS) val drop = rxPrefs.getBoolean("drop", false) 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 7179d255..ba82b7dd 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 @@ -108,6 +108,9 @@ import kotlinx.android.synthetic.main.compose_activity.sendAsGroupBackground import kotlinx.android.synthetic.main.compose_activity.sendAsGroupSwitch import kotlinx.android.synthetic.main.compose_activity.sim import kotlinx.android.synthetic.main.compose_activity.simIndex +import kotlinx.android.synthetic.main.compose_activity.speechToTextFrame +import kotlinx.android.synthetic.main.compose_activity.speechToTextIcon +import kotlinx.android.synthetic.main.compose_activity.speechToTextIconBorder import kotlinx.android.synthetic.main.compose_activity.toolbarSubtitle import kotlinx.android.synthetic.main.compose_activity.toolbarTitle import kotlinx.android.synthetic.main.main_activity.toolbar @@ -160,31 +163,12 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val backPressedIntent: Subject = PublishSubject.create() override val confirmDeleteIntent: Subject> = PublishSubject.create() override val messageLinkAskIntent: Subject by lazy { messageAdapter.messageLinkClicks } + override val speechRecogniserIntent by lazy { speechToTextIconBorder.clicks() } private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[ComposeViewModel::class.java] } private var cameraDestination: Uri? = null - private val speechResultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> - if (result.resultCode != Activity.RESULT_OK) - return@registerForActivityResult - - // check returned results are good - val match = result.data?.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS) - if ((match === null) || (match.size < 1) || (match[0].isNullOrEmpty())) - return@registerForActivityResult - - // get the edit text view - val message = findViewById(R.id.message) - if (message === null) - return@registerForActivityResult - - // populate message box with data returned by STT, set cursor to end, and focus - message.append(match[0]) - message.setSelection(message.text.length) - message.requestFocus() - } - override fun onCreate(savedInstanceState: Bundle?) { AndroidInjection.inject(this) super.onCreate(savedInstanceState) @@ -215,46 +199,13 @@ class ComposeActivity : QkThemedActivity(), ComposeView { .doOnNext { loading.setTint(it.theme) } .doOnNext { attach.setBackgroundTint(it.theme) } .doOnNext { attach.setTint(it.textPrimary) } + .doOnNext { speechToTextIconBorder.setBackgroundTint(it.theme) } + .doOnNext { speechToTextIcon.setBackgroundTint(it.textPrimary) } + .doOnNext { speechToTextIcon.setTint(it.theme) } .doOnNext { messageAdapter.theme = it } .autoDisposable(scope()) .subscribe() - message.setOnTouchListener(object : OnTouchListener { - private val gestureDetector = - GestureDetector(this@ComposeActivity, object : SimpleOnGestureListener() { - private var lastUpEvent: MotionEvent? = null - - override fun onDoubleTap(e: MotionEvent): Boolean { - val speechRecognizerIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) - .putExtra( - RecognizerIntent.EXTRA_LANGUAGE_MODEL, - RecognizerIntent.LANGUAGE_MODEL_FREE_FORM - ) - // include if want a custom message that the STT can (optionally) display .putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak your message") - speechResultLauncher.launch(speechRecognizerIntent) - return true - } - - override fun onSingleTapConfirmed(e: MotionEvent): Boolean { - if (lastUpEvent !== null) { - message.onTouchEvent(lastUpEvent) - lastUpEvent?.recycle() - lastUpEvent = null - } - return true - } - - override fun onSingleTapUp(e: MotionEvent): Boolean { - lastUpEvent = MotionEvent.obtain(e) - return true // don't show soft keyboard on this event - } - }) - - override fun onTouch(v: View, e: MotionEvent): Boolean { - return gestureDetector.onTouchEvent(e) - } - }) - // context menu registration for message parts messagePartContextMenuRegistrar .mapNotNull { it } @@ -375,6 +326,8 @@ class ComposeActivity : QkThemedActivity(), ComposeView { // if scheduling mode is set, show schedule dialog if (state.scheduling) scheduleAction.onNext(true) + + speechToTextFrame.isVisible = (prefs.showStt.get()) } override fun clearSelection() = messageAdapter.clearSelection() @@ -460,6 +413,18 @@ class ComposeActivity : QkThemedActivity(), ComposeView { startActivityForResult(intent, ComposeView.SelectContactRequestCode) } + override fun startSpeechRecognition() { + startActivityForResult( + Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).putExtra( + RecognizerIntent.EXTRA_LANGUAGE_MODEL, + RecognizerIntent.LANGUAGE_MODEL_FREE_FORM + ), + // include below if want a custom message that the STT can (optionally) display + // .putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak your message") + ComposeView.SpeechRecognitionRequestCode + ) + } + override fun themeChanged() { messageList.scrapViews() } @@ -576,6 +541,21 @@ class ComposeActivity : QkThemedActivity(), ComposeView { data?.data?.let(contactSelectedIntent::onNext) } + ComposeView.SpeechRecognitionRequestCode -> { + // check returned results are good + val match = data?.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS) + if ((match !== null) && (match.size > 0) && (!match[0].isNullOrEmpty())) { + // get the edit text view + val messageEditBox = findViewById(R.id.message) + if (messageEditBox !== null) { + // populate message box with data returned by STT, set cursor to end, and focus + messageEditBox.append(match[0]) + messageEditBox.setSelection(messageEditBox.text.length) + messageEditBox.requestFocus() + } + } + } + else -> super.onActivityResult(requestCode, resultCode, data) } } 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 64f5669c..ef537990 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 @@ -34,8 +34,9 @@ interface ComposeView : QkView { companion object { const val SelectContactRequestCode = 0 const val TakePhotoRequestCode = 1 - const val AttachAFileRequestCode = 4 const val AttachContactRequestCode = 3 + const val AttachAFileRequestCode = 4 + const val SpeechRecognitionRequestCode = 5 const val CameraDestinationKey = "camera_destination" } @@ -73,6 +74,7 @@ interface ComposeView : QkView { val backPressedIntent: Observable val confirmDeleteIntent: Observable> val messageLinkAskIntent: Observable + val speechRecogniserIntent: Observable<*> fun clearSelection() fun toggleSelectAll() @@ -93,5 +95,6 @@ interface ComposeView : QkView { fun scrollToMessage(id: Long) fun showQksmsPlusSnackbar(@StringRes message: Int) fun showDeleteDialog( messages: List) + fun startSpeechRecognition() } \ No newline at end of file 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 6763f183..9b594ec7 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 @@ -763,6 +763,11 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe() + // speech recognition button clicked + view.speechRecogniserIntent + .autoDisposable(view.scope()) + .subscribe { view.startSpeechRecognition() } + // Send a message when the send button is clicked, and disable editing mode if it's enabled view.sendIntent .withLatestFrom(view.textChangedIntent) { _, body -> body.toString() } 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 4c302dfe..54defd2d 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 @@ -184,6 +184,8 @@ class SettingsController : QkController newState { copy(autoColor = autoColor) } } disposables += prefs.systemFont.asObservable() - .subscribe { enabled -> newState { copy(systemFontEnabled = enabled) } } + .subscribe { enabled -> newState { copy(systemFontEnabled = enabled) } } + + disposables += prefs.showStt.asObservable() + .subscribe { enabled -> newState { copy(showStt = enabled) } } disposables += prefs.unicode.asObservable() .subscribe { enabled -> newState { copy(stripUnicodeEnabled = enabled) } } @@ -207,6 +210,8 @@ class SettingsPresenter @Inject constructor( R.id.systemFont -> prefs.systemFont.set(!prefs.systemFont.get()) + R.id.showStt -> prefs.showStt.set(!prefs.showStt.get()) + R.id.unicode -> prefs.unicode.set(!prefs.unicode.get()) R.id.mobileOnly -> prefs.mobileOnly.set(!prefs.mobileOnly.get()) 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 c87522bc..7e766ca0 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 @@ -39,6 +39,7 @@ data class SettingsState( val textSizeSummary: String = "", val textSizeId: Int = Preferences.TEXT_SIZE_NORMAL, val systemFontEnabled: Boolean = false, + val showStt: Boolean = true, val splitSmsEnabled: Boolean = false, val stripUnicodeEnabled: Boolean = false, val mobileOnly: Boolean = false, diff --git a/presentation/src/main/res/drawable/ic_speech_to_text_black.xml b/presentation/src/main/res/drawable/ic_speech_to_text_black.xml new file mode 100644 index 00000000..48de1c61 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_speech_to_text_black.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index 95f8b1e4..ff30a5d3 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -27,6 +27,41 @@ android:orientation="vertical" tools:context="dev.octoshrimpy.quik.feature.compose.ComposeActivity"> + + + + + + + + + tools:listitem="@layout/message_list_item_in" + tools:visibility="invisible" /> + + Automatic contact colors Font size Use system font + Show the speech to text button Automatic emoji Notifications Tap to customize From 3e9d7804353b55eb4590692dc4e11ef3e8f62551 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 12 Feb 2025 14:36:05 +1100 Subject: [PATCH 17/29] change tools view to 'on' for messageList --- presentation/src/main/res/layout/compose_activity.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index ff30a5d3..fb19ed9a 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -74,8 +74,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/sendAsGroupBackground" app:stackFromEnd="true" - tools:listitem="@layout/message_list_item_in" - tools:visibility="invisible" /> + tools:listitem="@layout/message_list_item_in" /> Date: Thu, 13 Feb 2025 13:16:10 +1100 Subject: [PATCH 18/29] changes to ingest all attachments in a standard manner. does not change user-facing functionality --- .../QKSMS/repository/MessageRepositoryImpl.kt | 10 +-- .../QKSMS/interactor/SendScheduledMessage.kt | 4 +- .../java/com/moez/QKSMS/model/Attachment.kt | 83 +++++++++---------- .../feature/compose/AttachmentAdapter.kt | 6 +- .../QKSMS/feature/compose/ComposeActivity.kt | 2 +- .../feature/compose/ComposeActivityModule.kt | 2 +- .../QKSMS/feature/compose/ComposeViewModel.kt | 27 ++---- 7 files changed, 58 insertions(+), 76 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 5771cff3..db4cc4f4 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt @@ -392,8 +392,8 @@ class MessageRepositoryImpl @Inject constructor( .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) + true -> ImageUtils.getScaledGif(context, it.uri, maxWidth, maxHeight) + false -> ImageUtils.getScaledImage(context, it.uri, maxWidth, maxHeight) } } .toMutableMap() @@ -401,7 +401,7 @@ class MessageRepositoryImpl @Inject constructor( val imageByteCount = imageBytesByAttachment.values.sumOf { it.size } if (imageByteCount > remainingBytes) { imageBytesByAttachment.forEach { (attachment, originalBytes) -> - val uri = attachment.getUri() ?: return@forEach + val uri = attachment.uri ?: return@forEach val maxBytes = originalBytes.size / imageByteCount.toFloat() * remainingBytes // Get the image dimensions @@ -429,8 +429,8 @@ class MessageRepositoryImpl @Inject constructor( attempts++ scaledBytes = when (attachment.getType(context) == "image/gif") { - true -> ImageUtils.getScaledGif(context, attachment.getUri(), newWidth, newHeight) - false -> ImageUtils.getScaledImage(context, attachment.getUri(), newWidth, newHeight) + true -> ImageUtils.getScaledGif(context, attachment.uri, newWidth, newHeight) + false -> ImageUtils.getScaledImage(context, attachment.uri, newWidth, newHeight) } Timber.d("Compression attempt $attempts: ${scaledBytes.size / 1024}/${maxBytes.toInt() / 1024}Kb ($width*$height -> $newWidth*$newHeight)") 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 0047fdd8..7ea2ec33 100644 --- a/domain/src/main/java/com/moez/QKSMS/interactor/SendScheduledMessage.kt +++ b/domain/src/main/java/com/moez/QKSMS/interactor/SendScheduledMessage.kt @@ -47,11 +47,11 @@ class SendScheduledMessage @Inject constructor( } .map { message -> val threadId = TelephonyCompat.getOrCreateThreadId(context, message.recipients) - val attachments = message.attachments.mapNotNull(Uri::parse).map { Attachment(it) } + val attachments = message.attachments.mapNotNull(Uri::parse).map { Attachment(context, it) } SendMessage.Params(message.subId, threadId, message.recipients, message.body, attachments) } .flatMap(sendMessage::buildObservable) .doOnNext { scheduledMessageRepo.deleteScheduledMessage(params) } } -} \ No newline at end of file +} 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 5b1cdaaa..8957a969 100644 --- a/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt +++ b/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt @@ -18,49 +18,60 @@ */ package dev.octoshrimpy.quik.model +import android.annotation.SuppressLint import android.content.Context import android.net.Uri import android.os.Build +import android.provider.ContactsContract import android.provider.OpenableColumns import androidx.core.view.inputmethod.InputContentInfoCompat -class Attachment( - private val uri: Uri? = null, - private val inputContent: InputContentInfoCompat? = null +@SuppressLint("Range") +class Attachment ( + context: Context, + var uri: Uri = Uri.EMPTY, + 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 ?: Uri.EMPTY - else uri ?: Uri.EMPTY - ) + init { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) + uri = inputContent?.contentUri ?: uri + + // if constructed with a uri to a contact, convert uri to associated vcard uri + if (context.contentResolver.getType(uri)?.lowercase() == + ContactsContract.Contacts.CONTENT_ITEM_TYPE) { + uri = try { + Uri.withAppendedPath( + ContactsContract.Contacts.CONTENT_VCARD_URI, + context.contentResolver.query( + uri, null, null, null, null + )?.use { + it.moveToFirst() + it.getString(it.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY)) ?: "" + } + ) + } catch (e: Exception) { + Uri.EMPTY + } + } } fun getType(context: Context): String { - return context.contentResolver.getType(getUri()) ?: "application/octect-stream" + return context.contentResolver.getType(uri) ?: "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" + uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null + )?.use { + it.moveToFirst() + return it.getString(it.getColumnIndex(OpenableColumns.DISPLAY_NAME)) ?: "unknown" } } - catch (e: Exception) { /* nothing*/ } + catch (e: Exception) { /* nothing */ } return "unknown" } @@ -75,30 +86,20 @@ class Attachment( } fun isAudio(context: Context): Boolean { - val mimeType = getType(context) - return (mimeType.startsWith("audio/")) + return (getType(context).startsWith("audio/")) } fun isImage(context: Context): Boolean { - val mimeType = getType(context) - return (mimeType.startsWith("image/")) + return (getType(context).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 + uri, arrayOf(OpenableColumns.SIZE), null, null, null + )?.use { it.moveToFirst() - return it.getLong(sizeIndex) + return it.getLong(it.getColumnIndex(OpenableColumns.SIZE)) } } catch (e: Exception) { /* nothing */ } @@ -110,16 +111,14 @@ class Attachment( if (resourceBytes != null) return resourceBytes!! - resourceBytes = ByteArray(0) - try { - context.contentResolver.openInputStream(getUri())?.use { + context.contentResolver.openInputStream(uri)?.use { resourceBytes = it.readBytes() } } catch (e: Exception) { } - return resourceBytes!! + return resourceBytes ?: ByteArray(0) } } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt index 304567fd..72759ea3 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt @@ -93,14 +93,14 @@ class AttachmentAdapter @Inject constructor( holder.fileName.visibility = View.GONE // if attachment uri is missing - if (!attachment.getUri().resourceExists(context)) { + if (!attachment.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 uri = attachment.getUri() + val uri = attachment.uri val mimeType = attachment.getType(context) // if attachment mime type is image/* or video/*, use image/frame @@ -160,4 +160,4 @@ class AttachmentAdapter @Inject constructor( 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 7179d255..06de9b73 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 @@ -446,7 +446,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override fun requestContact() { val intent = Intent(Intent.ACTION_PICK) - .setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE) + .setType(ContactsContract.Contacts.CONTENT_TYPE) startActivityForResult(Intent.createChooser(intent, null), ComposeView.AttachContactRequestCode) } 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 1a599bd8..9063b86b 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 @@ -79,7 +79,7 @@ class ComposeActivityModule { activity.intent.getParcelableExtra(Intent.EXTRA_STREAM)?.run(uris::add) activity.intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM)?.run(uris::addAll) - return Attachments(uris.mapNotNull { Attachment(it) }) + return Attachments(uris.mapNotNull { Attachment(activity, it) }) } @Provides 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 6763f183..789e886b 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 @@ -19,9 +19,7 @@ package dev.octoshrimpy.quik.feature.compose import android.content.Context -import android.net.Uri import android.os.Vibrator -import android.provider.ContactsContract import android.telephony.SmsMessage import androidx.core.content.getSystemService import com.moez.QKSMS.contentproviders.MmsPartProvider @@ -652,8 +650,8 @@ class ComposeViewModel @Inject constructor( // a file, photo or otherwise, was picked by the user Observable.merge( - view.attachAnyFileSelectedIntent.map { uri -> Attachment(uri) }, - view.inputContentIntent.map { inputContent -> Attachment(inputContent = inputContent) } + view.attachAnyFileSelectedIntent.map { uri -> Attachment(context, uri) }, + view.inputContentIntent.map { inputContent -> Attachment(context, inputContent = inputContent) } ) .withLatestFrom(attachments) { attachment, attachments -> attachments + attachment } .doOnNext(attachments::onNext) @@ -677,7 +675,7 @@ class ComposeViewModel @Inject constructor( // Contact was selected for attachment view.contactSelectedIntent - .map { uri -> Attachment(getFullVCardUri(uri)) } + .map { uri -> Attachment(context, uri) } .withLatestFrom(attachments) { attachment, attachments -> attachments + attachment } .subscribeOn(Schedulers.io()) .autoDisposable(view.scope()) @@ -801,9 +799,7 @@ class ComposeViewModel @Inject constructor( // Scheduling a message state.scheduled != 0L -> { newState { copy(scheduled = 0) } - val uris = attachments - .map { it.getUri() } - .map { it.toString() } + val uris = attachments.map { it.uri.toString() } val params = AddScheduledMessage .Params(state.scheduled, subId, addresses, sendAsGroup, body, uris) addScheduledMessage.execute(params) @@ -881,17 +877,4 @@ class ComposeViewModel @Inject constructor( } - 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 - "" - } - - return Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey) - } - -} \ No newline at end of file +} From 989d790626a5389c70568a6a384687ef652ef667 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Sat, 15 Feb 2025 11:01:47 +1100 Subject: [PATCH 19/29] changes to make the speed-to-text button drag-and-dropable --- .../java/com/moez/QKSMS/util/Preferences.kt | 2 + .../QKSMS/feature/compose/ComposeActivity.kt | 59 ++++++++++++++++--- .../feature/settings/SettingsPresenter.kt | 6 +- .../QKSMS/feature/settings/SettingsState.kt | 2 + presentation/src/main/res/values/strings.xml | 4 +- 5 files changed, 64 insertions(+), 9 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 eb102d3b..df81490f 100644 --- a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt +++ b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt @@ -109,6 +109,8 @@ class Preferences @Inject constructor( val autoColor = rxPrefs.getBoolean("autoColor", true) val systemFont = rxPrefs.getBoolean("systemFont", false) val showStt = rxPrefs.getBoolean("showStt", true) + val showSttOffsetX = rxPrefs.getFloat("showSttOffsetX", Float.MIN_VALUE) + val showSttOffsetY = rxPrefs.getFloat("showSttOffsetY", Float.MIN_VALUE) val textSize = rxPrefs.getInteger("textSize", TEXT_SIZE_NORMAL) val blockingManager = rxPrefs.getInteger("blockingManager", BLOCKING_MANAGER_QKSMS) val drop = rxPrefs.getBoolean("drop", false) 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 ba82b7dd..5790e473 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 @@ -32,14 +32,13 @@ import android.provider.MediaStore import android.speech.RecognizerIntent import android.text.format.DateFormat import android.view.ContextMenu -import android.view.GestureDetector -import android.view.GestureDetector.SimpleOnGestureListener +import android.view.DragEvent.ACTION_DRAG_ENDED +import android.view.DragEvent.ACTION_DRAG_EXITED +import android.view.DragEvent.ACTION_DROP import android.view.Menu import android.view.MenuItem -import android.view.MotionEvent import android.view.View -import android.view.View.OnTouchListener -import androidx.activity.result.contract.ActivityResultContracts +import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet @@ -62,6 +61,7 @@ import dev.octoshrimpy.quik.common.base.QkThemedActivity import dev.octoshrimpy.quik.common.util.DateFormatter import dev.octoshrimpy.quik.common.util.extensions.autoScrollToStart import dev.octoshrimpy.quik.common.util.extensions.hideKeyboard +import dev.octoshrimpy.quik.common.util.extensions.makeToast import dev.octoshrimpy.quik.common.util.extensions.scrapViews import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint import dev.octoshrimpy.quik.common.util.extensions.setTint @@ -163,7 +163,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val backPressedIntent: Subject = PublishSubject.create() override val confirmDeleteIntent: Subject> = PublishSubject.create() override val messageLinkAskIntent: Subject by lazy { messageAdapter.messageLinkClicks } - override val speechRecogniserIntent by lazy { speechToTextIconBorder.clicks() } + override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() } private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[ComposeViewModel::class.java] } @@ -212,12 +212,46 @@ class ComposeActivity : QkThemedActivity(), ComposeView { .autoDisposable(scope()) .subscribe { registerForContextMenu(it) } + // drag drop handlers for speech-to-text icon + speechToTextIcon.setOnLongClickListener { + it.startDragAndDrop(null, View.DragShadowBuilder(speechToTextFrame), null, 0) + speechToTextFrame.isVisible = false + + contentView.setOnDragListener { _, event -> + when (event.action) { + ACTION_DROP -> { + speechToTextFrame.x = (event.x - (speechToTextFrame.width / 2)) + speechToTextFrame.y =(event.y - (speechToTextFrame.height / 2)) + + // get offset from root view as a percentage of root view for saving + prefs.showSttOffsetX.set((speechToTextFrame.x - contentView.x) / contentView.width) + prefs.showSttOffsetY.set((speechToTextFrame.y - contentView.y) / contentView.height) + } + ACTION_DRAG_ENDED, ACTION_DRAG_EXITED -> { + speechToTextFrame.isVisible = true + } + } + true + } + true + } + window.callback = ComposeWindowCallback(window.callback, this) } override fun onStart() { super.onStart() activityVisibleIntent.onNext(true) + + // if first time stt icon is shown (since setting reset), pop up an instruction toast + if (prefs.showStt.get() && + (prefs.showSttOffsetX.get() == Float.MIN_VALUE) && + (prefs.showSttOffsetX.get() == Float.MIN_VALUE)) { + makeToast(R.string.compose_toast_drag_stt, Toast.LENGTH_LONG) + // reset to new flag value that indicates 'not first time through, but not customised' + prefs.showSttOffsetX.set(Float.MAX_VALUE) + prefs.showSttOffsetY.set(Float.MAX_VALUE) + } } override fun onPause() { @@ -327,7 +361,18 @@ class ComposeActivity : QkThemedActivity(), ComposeView { if (state.scheduling) scheduleAction.onNext(true) - speechToTextFrame.isVisible = (prefs.showStt.get()) + if (prefs.showStt.get()) { + speechToTextFrame.isVisible = true + + var xPercent = prefs.showSttOffsetX.get() + var yPercent = prefs.showSttOffsetY.get() + + // if the stt icon has a custom position, move it + if ((xPercent != Float.MAX_VALUE) && (yPercent != Float.MAX_VALUE)) { + speechToTextFrame.x = (contentView.x + (xPercent * contentView.width)) + speechToTextFrame.y = (contentView.y + (yPercent * contentView.height)) + } + } } override fun clearSelection() = messageAdapter.clearSelection() diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsPresenter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsPresenter.kt index daf8a8b7..15e0f580 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsPresenter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsPresenter.kt @@ -210,7 +210,11 @@ class SettingsPresenter @Inject constructor( R.id.systemFont -> prefs.systemFont.set(!prefs.systemFont.get()) - R.id.showStt -> prefs.showStt.set(!prefs.showStt.get()) + R.id.showStt -> { + prefs.showStt.set(!prefs.showStt.get()) + prefs.showSttOffsetX.set(Float.MIN_VALUE) + prefs.showSttOffsetY.set(Float.MIN_VALUE) + } R.id.unicode -> prefs.unicode.set(!prefs.unicode.get()) 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 7e766ca0..0b8b270d 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 @@ -40,6 +40,8 @@ data class SettingsState( val textSizeId: Int = Preferences.TEXT_SIZE_NORMAL, val systemFontEnabled: Boolean = false, val showStt: Boolean = true, + val showSttOffsetX: Float = Float.MIN_VALUE, + val showSttOffsetY: Float = Float.MAX_VALUE, val splitSmsEnabled: Boolean = false, val stripUnicodeEnabled: Boolean = false, val mobileOnly: Boolean = false, diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index a482146e..d7371aaa 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -161,6 +161,8 @@ Message item Attachment + Move the speech-to-text button anywhere you like + Sending… Delivered %s Failed to send. Tap to try again @@ -240,7 +242,7 @@ Automatic contact colors Font size Use system font - Show the speech to text button + Show the speech-to-text button Automatic emoji Notifications Tap to customize From 94019f5e7aa5ce16ccbd359e53399fae4043b25b Mon Sep 17 00:00:00 2001 From: gavine99 Date: Mon, 17 Feb 2025 19:10:59 +1100 Subject: [PATCH 20/29] rebased to latest master --- data/src/main/AndroidManifest.xml | 2 + .../moez/QKSMS/extensions/UriExtensions.kt | 21 +- .../QKSMS/manager/MediaRecorderManager.kt | 95 ++++ .../QKSMS/manager/PermissionManagerImpl.kt | 4 + .../QKSMS/repository/MessageRepositoryImpl.kt | 27 +- .../com/moez/QKSMS/interactor/SendMessage.kt | 3 + .../moez/QKSMS/manager/PermissionManager.kt | 2 + .../java/com/moez/QKSMS/model/Attachment.kt | 78 +++- .../QKSMS/common/widget/MicInputCloudView.kt | 404 ++++++++++++++++++ .../QKSMS/feature/compose/ComposeActivity.kt | 203 ++++++++- .../feature/compose/ComposeActivityModule.kt | 7 +- ...Adapter.kt => ComposeAttachmentAdapter.kt} | 2 +- .../QKSMS/feature/compose/ComposeState.kt | 3 +- .../moez/QKSMS/feature/compose/ComposeView.kt | 12 + .../QKSMS/feature/compose/ComposeViewModel.kt | 249 +++++++++-- .../src/main/res/layout/compose_activity.xml | 227 ++++++++-- presentation/src/main/res/values/attrs.xml | 5 + presentation/src/main/res/values/strings.xml | 7 + 18 files changed, 1220 insertions(+), 131 deletions(-) create mode 100644 data/src/main/java/com/moez/QKSMS/manager/MediaRecorderManager.kt create mode 100644 presentation/src/main/java/com/moez/QKSMS/common/widget/MicInputCloudView.kt rename presentation/src/main/java/com/moez/QKSMS/feature/compose/{AttachmentAdapter.kt => ComposeAttachmentAdapter.kt} (99%) diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml index a65cc645..6cf78b81 100644 --- a/data/src/main/AndroidManifest.xml +++ b/data/src/main/AndroidManifest.xml @@ -20,4 +20,6 @@ + + diff --git a/data/src/main/java/com/moez/QKSMS/extensions/UriExtensions.kt b/data/src/main/java/com/moez/QKSMS/extensions/UriExtensions.kt index 7ebe330a..2262732c 100644 --- a/data/src/main/java/com/moez/QKSMS/extensions/UriExtensions.kt +++ b/data/src/main/java/com/moez/QKSMS/extensions/UriExtensions.kt @@ -18,19 +18,24 @@ */ package dev.octoshrimpy.quik.extensions +import android.content.ContentResolver import android.content.Context import android.net.Uri +import androidx.core.net.toFile fun Uri.resourceExists(context: Context): Boolean { - // check if resource at uri still exists + var retVal: Boolean? = null try { - return context.contentResolver.query( - this, null, null, null, null - )?.use { - it.moveToFirst() - } ?: false + when (this.scheme) { + ContentResolver.SCHEME_CONTENT -> { + retVal = context.contentResolver.query( + this, null, null, null, null + )?.use { it.moveToFirst() } + } + ContentResolver.SCHEME_FILE -> retVal = this.toFile().exists() + } + } catch (e: Exception) { /* nothing */ } - catch (e: Exception) { /* nothing */ } - return false + return retVal ?: false } diff --git a/data/src/main/java/com/moez/QKSMS/manager/MediaRecorderManager.kt b/data/src/main/java/com/moez/QKSMS/manager/MediaRecorderManager.kt new file mode 100644 index 00000000..157f325b --- /dev/null +++ b/data/src/main/java/com/moez/QKSMS/manager/MediaRecorderManager.kt @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2025 + * + * This file is part of QUIK. + * + * QUIK 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. + * + * QUIK 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 QUIK. If not, see . + */ +package com.moez.QKSMS.manager + +import android.content.Context +import android.media.MediaRecorder +import android.net.Uri +import androidx.core.net.toUri +import java.io.File +import java.util.UUID + +object MediaRecorderManager : MediaRecorder() { + + enum class RecordingState { + Initial, + DataSourceConfigured, + Prepared, + Recording, + Error + } + + const val AUDIO_FILE_PREFIX = "recorded-" + const val AUDIO_FILE_SUFFIX = ".3ga" + + var recordingState: RecordingState = RecordingState.Initial + private set + + var uri: Uri = Uri.EMPTY + private set + + fun stopRecording(): Uri { + return try { + if (recordingState == RecordingState.Recording) + stop() + + reset() + recordingState = RecordingState.Initial + + uri + } + catch (e: Exception) { + Uri.EMPTY + } + } + + fun startRecording(context: Context): Uri { + return try { + val file = File( + context.cacheDir, + AUDIO_FILE_PREFIX + UUID.randomUUID() + AUDIO_FILE_SUFFIX + ) + + // ensure stopped before using again + stopRecording() + + // configure + setAudioSource(AudioSource.MIC) + setOutputFormat(OutputFormat.THREE_GPP) + setAudioEncoder(AudioEncoder.AMR_WB) + recordingState = RecordingState.DataSourceConfigured + + setOutputFile(file.path) + + prepare() + recordingState = RecordingState.Prepared + + start() + recordingState = RecordingState.Recording + + uri = file.toUri() + + uri + } + catch (e: Exception) { + Uri.EMPTY + } + } + +} diff --git a/data/src/main/java/com/moez/QKSMS/manager/PermissionManagerImpl.kt b/data/src/main/java/com/moez/QKSMS/manager/PermissionManagerImpl.kt index 21955eb0..bc5a6f1c 100644 --- a/data/src/main/java/com/moez/QKSMS/manager/PermissionManagerImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/manager/PermissionManagerImpl.kt @@ -72,6 +72,10 @@ class PermissionManagerImpl @Inject constructor(private val context: Context) : return hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) } + override fun hasRecordAudio(): Boolean { + return hasPermission(Manifest.permission.RECORD_AUDIO) + } + override fun hasExactAlarms(): Boolean { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { return true 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 db4cc4f4..a93be920 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt @@ -47,6 +47,7 @@ import dev.octoshrimpy.quik.compat.TelephonyCompat import dev.octoshrimpy.quik.extensions.anyOf import dev.octoshrimpy.quik.extensions.isImage import dev.octoshrimpy.quik.extensions.isVideo +import dev.octoshrimpy.quik.extensions.resourceExists import dev.octoshrimpy.quik.manager.ActiveConversationManager import dev.octoshrimpy.quik.manager.KeyManager import dev.octoshrimpy.quik.model.Attachment @@ -368,28 +369,31 @@ class MessageRepositoryImpl @Inject constructor( parts += MMSPart("text", ContentType.TEXT_PLAIN, bytes) } - // Attach those that can't be compressed (ie. everything but not images) + // Attach those that can't be compressed (ie. everything but images) parts += attachments - // filter out images + // filter in non-images only .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() } + // filter in only items that exist (user may have deleted the file) + .filter { it.uri.resourceExists(context) } .map { remainingBytes -= it.getResourceBytes(context).size - MMSPart( + val mmsPart = MMSPart( it.getName(context), it.getType(context), it.getResourceBytes(context) ) + + // release the attachment hold on the image bytes so the GC can reclaim + it.releaseResourceBytes() + + mmsPart } val imageBytesByAttachment = attachments - // filter out non-images + // filter in images only .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() } + // filter in only items that exist (user may have deleted the file) + .filter { it.uri.resourceExists(context) } .associateWith { when (it.getType(context) == "image/gif") { true -> ImageUtils.getScaledGif(context, it.uri, maxWidth, maxHeight) @@ -434,6 +438,9 @@ class MessageRepositoryImpl @Inject constructor( } Timber.d("Compression attempt $attempts: ${scaledBytes.size / 1024}/${maxBytes.toInt() / 1024}Kb ($width*$height -> $newWidth*$newHeight)") + + // release the attachment hold on the image bytes so the GC can reclaim + attachment.releaseResourceBytes() } Timber.v("Compressed ${originalBytes.size / 1024}Kb to ${scaledBytes.size / 1024}Kb with a target size of ${maxBytes.toInt() / 1024}Kb in $attempts attempts") diff --git a/domain/src/main/java/com/moez/QKSMS/interactor/SendMessage.kt b/domain/src/main/java/com/moez/QKSMS/interactor/SendMessage.kt index b6443e75..23fc11d8 100644 --- a/domain/src/main/java/com/moez/QKSMS/interactor/SendMessage.kt +++ b/domain/src/main/java/com/moez/QKSMS/interactor/SendMessage.kt @@ -53,6 +53,9 @@ class SendMessage @Inject constructor( } messageRepo.sendMessage(params.subId, threadId, params.addresses, params.body, params.attachments, params.delay) + + // delete attachment local files, if any, because they're saved to mms db by now + params.attachments.forEach { it.removeCacheFile() } } .mapNotNull { // If the threadId wasn't provided, then it's probably because it doesn't exist in Realm. diff --git a/domain/src/main/java/com/moez/QKSMS/manager/PermissionManager.kt b/domain/src/main/java/com/moez/QKSMS/manager/PermissionManager.kt index c1a30c63..c1c0432a 100644 --- a/domain/src/main/java/com/moez/QKSMS/manager/PermissionManager.kt +++ b/domain/src/main/java/com/moez/QKSMS/manager/PermissionManager.kt @@ -36,6 +36,8 @@ interface PermissionManager { fun hasStorage(): Boolean + fun hasRecordAudio(): Boolean + fun hasExactAlarms(): Boolean } 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 8957a969..257a1ba4 100644 --- a/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt +++ b/domain/src/main/java/com/moez/QKSMS/model/Attachment.kt @@ -19,11 +19,14 @@ package dev.octoshrimpy.quik.model import android.annotation.SuppressLint +import android.content.ContentResolver import android.content.Context import android.net.Uri import android.os.Build import android.provider.ContactsContract import android.provider.OpenableColumns +import android.webkit.MimeTypeMap +import androidx.core.net.toFile import androidx.core.view.inputmethod.InputContentInfoCompat @@ -41,7 +44,8 @@ class Attachment ( // if constructed with a uri to a contact, convert uri to associated vcard uri if (context.contentResolver.getType(uri)?.lowercase() == - ContactsContract.Contacts.CONTENT_ITEM_TYPE) { + ContactsContract.Contacts.CONTENT_ITEM_TYPE + ) { uri = try { Uri.withAppendedPath( ContactsContract.Contacts.CONTENT_VCARD_URI, @@ -59,21 +63,34 @@ class Attachment ( } fun getType(context: Context): String { - return context.contentResolver.getType(uri) ?: "application/octect-stream" + var retVal: String? = null + when (uri.scheme) { + ContentResolver.SCHEME_CONTENT -> retVal = context.contentResolver.getType(uri) + ContentResolver.SCHEME_FILE -> retVal = + MimeTypeMap.getSingleton().getMimeTypeFromExtension(uri.toFile().extension) + } + return retVal ?: "application/octect-stream" } fun getName(context: Context): String { + var retVal: String? = null try { - context.contentResolver.query( - uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null - )?.use { - it.moveToFirst() - return it.getString(it.getColumnIndex(OpenableColumns.DISPLAY_NAME)) ?: "unknown" - } - } - catch (e: Exception) { /* nothing */ } + when (uri.scheme) { + ContentResolver.SCHEME_CONTENT -> { + context.contentResolver.query( + uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null + )?.use { + it.moveToFirst() + retVal = it.getString(it.getColumnIndex(OpenableColumns.DISPLAY_NAME)) + } + } - return "unknown" + ContentResolver.SCHEME_FILE -> retVal = uri.toFile().name + } + } catch (e: Exception) { /* nothing */ + } + + return retVal ?: "unknown" } fun isVCard(context: Context): Boolean { @@ -94,17 +111,24 @@ class Attachment ( } fun getSize(context: Context): Long { + var retVal: Long? = null try { - context.contentResolver.query( - uri, arrayOf(OpenableColumns.SIZE), null, null, null - )?.use { - it.moveToFirst() - return it.getLong(it.getColumnIndex(OpenableColumns.SIZE)) - } - } - catch (e: Exception) { /* nothing */ } + when (uri.scheme) { + ContentResolver.SCHEME_CONTENT -> { + context.contentResolver.query( + uri, arrayOf(OpenableColumns.SIZE), null, null, null + )?.use { + it.moveToFirst() + retVal = it.getLong(it.getColumnIndex(OpenableColumns.SIZE)) + } + } - return -1 + ContentResolver.SCHEME_FILE -> retVal = uri.toFile().length() + } + } catch (e: Exception) { /* nothing */ + } + + return retVal ?: -1 } fun getResourceBytes(context: Context): ByteArray { @@ -121,6 +145,18 @@ class Attachment ( return resourceBytes ?: ByteArray(0) } + fun releaseResourceBytes() { + resourceBytes = null + } + + fun removeCacheFile(): Boolean { + // all file:// scheme files are local to the app cache dir, so can be deleted + if (uri.scheme == ContentResolver.SCHEME_FILE) { + return try { uri.toFile().delete() } + catch (e: Exception) { false } + } + + return false + } } -class Attachments(attachments: List) : List by attachments diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/MicInputCloudView.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/MicInputCloudView.kt new file mode 100644 index 00000000..e5eab160 --- /dev/null +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/MicInputCloudView.kt @@ -0,0 +1,404 @@ +/* + * Copyright (C) - see below + * + * This file is part of QUIK. + * + * QUIK 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. + * + * QUIK 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 QUIK. If not, see . + */ +/* + * Original from: Nextcloud Talk - Android Client + * + * SPDX-FileCopyrightText: 2023 Julius Linus + * SPDX-License-Identifier: GPL-3.0-or-later + */ +package dev.octoshrimpy.quik.common.widget + +import android.animation.ValueAnimator +import android.content.Context +import android.content.res.Resources +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.Paint +import android.graphics.Paint.ANTI_ALIAS_FLAG +import android.graphics.Path +import android.graphics.Rect +import android.graphics.drawable.Drawable +import android.util.AttributeSet +import android.view.View +import android.view.animation.LinearInterpolator +import androidx.annotation.ColorInt +import dev.octoshrimpy.quik.R +import kotlin.math.roundToInt + +class MicInputCloudView(context: Context, attrs: AttributeSet) : View(context, attrs) { + /** + * State Descriptions: + * - PAUSED_STATE: Animation speed is set to zero. + * - PLAY_STATE: Animation speed is set to default, but can be overridden. + */ + enum class ViewState { + /** + * Animation speed is set to zero. + */ + PAUSED_STATE, + + /** + * Animation speed is set to default, but can be overridden. + */ + PLAY_STATE + } + + @ColorInt + private var primaryColor: Int = Color.WHITE + + private var pauseIcon: Drawable? = null + + private var playIcon: Drawable? = null + + init { + context.theme.obtainStyledAttributes( + attrs, + R.styleable.MicInputCloudView, + 0, + 0 + ).apply { + + try { + pauseIcon = getDrawable(R.styleable.MicInputCloudView_pauseIcon) + playIcon = getDrawable(R.styleable.MicInputCloudView_playIcon) + } finally { + recycle() + } + } + } + + private var state: ViewState = ViewState.PLAY_STATE + private var ovalOneAnimator: ValueAnimator? = null + private var ovalTwoAnimator: ValueAnimator? = null + private var ovalThreeAnimator: ValueAnimator? = null + private var r1 = OVAL_ONE_DEFAULT_ROTATION + private var r2 = OVAL_TWO_DEFAULT_ROTATION + private var r3 = OVAL_THREE_DEFAULT_ROTATION + private var o1h = OVAL_ONE_DEFAULT_HEIGHT + private var o1w = OVAL_ONE_DEFAULT_WIDTH + private var o2h = OVAL_TWO_DEFAULT_HEIGHT + private var o2w = OVAL_TWO_DEFAULT_WIDTH + private var o3h = OVAL_THREE_DEFAULT_HEIGHT + private var o3w = OVAL_THREE_DEFAULT_WIDTH + private var rotationSpeedMultiplier: Float = DEFAULT_ROTATION_SPEED_MULTIPLIER + private var radius: Float = DEFAULT_RADIUS + private var centerX: Float = 0f + private var centerY: Float = 0f + + private val bottomCirclePaint = Paint(ANTI_ALIAS_FLAG).apply { + color = primaryColor + style = Paint.Style.FILL + alpha = DEFAULT_OPACITY + } + + private val topCircleBounds = Rect(0, 0, 0, 0) + private val iconBounds = topCircleBounds + + override fun onVisibilityChanged(changedView: View, visibility: Int) { + super.onVisibilityChanged(changedView, visibility) + if (visibility == VISIBLE) { + createAnimators() + } else { + state = ViewState.PLAY_STATE + destroyAnimators() + } + } + + private fun createAnimators() { + ovalOneAnimator = ValueAnimator.ofInt( + o1h, + OVAL_ONE_DEFAULT_HEIGHT + ANIMATION_CAP, + o1h + ).apply { + duration = OVAL_ONE_ANIMATION_LENGTH + interpolator = LinearInterpolator() + repeatCount = ValueAnimator.INFINITE + addUpdateListener { valueAnimator -> + o1h = valueAnimator.animatedValue as Int + } + } + + ovalTwoAnimator = ValueAnimator.ofInt( + o2h, + OVAL_TWO_DEFAULT_HEIGHT + ANIMATION_CAP, + o2h + ).apply { + duration = OVAL_TWO_ANIMATION_LENGTH + interpolator = LinearInterpolator() + repeatCount = ValueAnimator.INFINITE + addUpdateListener { valueAnimator -> + o2h = valueAnimator.animatedValue as Int + } + } + + ovalThreeAnimator = ValueAnimator.ofInt( + o3h, + OVAL_THREE_DEFAULT_HEIGHT + ANIMATION_CAP, + o3h + ).apply { + duration = OVAL_THREE_ANIMATION_LENGTH + interpolator = LinearInterpolator() + repeatCount = ValueAnimator.INFINITE + addUpdateListener { valueAnimator -> + o3h = valueAnimator.animatedValue as Int + invalidate() // needed to animate the other listeners as well + } + } + } + + private fun destroyAnimators() { + ovalOneAnimator?.cancel() + ovalOneAnimator?.removeAllUpdateListeners() + ovalTwoAnimator?.cancel() + ovalTwoAnimator?.removeAllUpdateListeners() + ovalThreeAnimator?.cancel() + ovalThreeAnimator?.removeAllUpdateListeners() + } + + private val circlePath: Path = Path() + private val ovalOnePath: Path = Path() + private val ovalTwoPath: Path = Path() + private val ovalThreePath: Path = Path() + + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + circlePath.apply { + addCircle(centerX, centerY, DEFAULT_RADIUS, Path.Direction.CCW) + } + ovalOnePath.apply { + addOval( + centerX - (radius + o1w), + centerY - o1h, + centerX + (radius + o1w), + centerY + o1h, + Path.Direction.CCW + ) + op(this, circlePath, Path.Op.DIFFERENCE) + } + ovalTwoPath.apply { + addOval( + centerX - (radius + o2w), + centerY - o2h, + centerX + (radius + o2w), + centerY + o2h, + Path.Direction.CCW + ) + op(this, circlePath, Path.Op.DIFFERENCE) + } + ovalThreePath.apply { + addOval( + centerX - (radius + o3w), + centerY - o3h, + centerX + (radius + o3w), + centerY + o3h, + Path.Direction.CCW + ) + op(this, circlePath, Path.Op.DIFFERENCE) + } + drawMicInputCloud(canvas) + if (state == ViewState.PLAY_STATE) { + r1 += OVAL_ONE_ANIMATION_SPEED * rotationSpeedMultiplier + r2 -= OVAL_TWO_ANIMATION_SPEED * rotationSpeedMultiplier + r3 += OVAL_THREE_ANIMATION_SPEED * rotationSpeedMultiplier + invalidate() + } + } + + private fun drawMicInputCloud(canvas: Canvas?) { + canvas?.apply { + save() + rotate(r1, centerX, centerY) + drawPath(ovalOnePath, bottomCirclePaint) + restore() + save() + rotate(r2, centerX, centerY) + drawPath(ovalTwoPath, bottomCirclePaint) + restore() + save() + rotate(r3, centerX, centerY) + drawPath(ovalThreePath, bottomCirclePaint) + restore() + circlePath.reset() + ovalOnePath.reset() + ovalTwoPath.reset() + ovalThreePath.reset() + if (state == ViewState.PLAY_STATE) { + pauseIcon?.apply { + bounds = topCircleBounds + setTint(primaryColor) + draw(canvas) + } + } else { + playIcon?.apply { + bounds = topCircleBounds + setTint(primaryColor) + draw(canvas) + } + } + } + } + + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + val desiredWidth = DEFAULT_SIZE.dp + val desiredHeight = DEFAULT_SIZE.dp + + val widthMode = MeasureSpec.getMode(widthMeasureSpec) + val widthSize = MeasureSpec.getSize(widthMeasureSpec) + val heightMode = MeasureSpec.getMode(heightMeasureSpec) + val heightSize = MeasureSpec.getSize(heightMeasureSpec) + + val width: Int = when (widthMode) { + MeasureSpec.EXACTLY -> { + widthSize + } + + MeasureSpec.AT_MOST -> { + desiredWidth.coerceAtMost(widthSize) + } + + else -> { + desiredWidth + } + } + + val height: Int = when (heightMode) { + MeasureSpec.EXACTLY -> { + heightSize + } + + MeasureSpec.AT_MOST -> { + desiredHeight.coerceAtMost(heightSize) + } + + else -> { + desiredHeight + } + } + + centerX = (width / 2).toFloat() + centerY = (height / 2).toFloat() + topCircleBounds.apply { + left = (centerX - DEFAULT_RADIUS).toInt() + top = (centerY - DEFAULT_RADIUS).toInt() + right = (centerX + DEFAULT_RADIUS).toInt() + bottom = (centerY + DEFAULT_RADIUS).toInt() + } + + /** + * Drawables are drawn the same way as the canvas is drawn, as both originate from the top-left corner. + * Because of this, the icon's width = (right - left) and height = (bottom - top). + */ + iconBounds.apply { + left = (centerX - DEFAULT_RADIUS + ICON_SIZE.dp).toInt() + top = (centerY - DEFAULT_RADIUS + ICON_SIZE.dp).toInt() + right = (centerX + DEFAULT_RADIUS - ICON_SIZE.dp).toInt() + bottom = (centerY + DEFAULT_RADIUS - ICON_SIZE.dp).toInt() + } + + setMeasuredDimension(width, height) + } + + override fun performClick(): Boolean { + state = if (state == ViewState.PAUSED_STATE) { + ovalOneAnimator?.resume() + ovalTwoAnimator?.resume() + ovalThreeAnimator?.resume() + ViewState.PLAY_STATE + } else { + ovalOneAnimator?.pause() + ovalTwoAnimator?.pause() + ovalThreeAnimator?.pause() + ViewState.PAUSED_STATE + } + invalidate() + return super.performClick() + } + + /** + * Sets the color of the cloud to the parameter, opacity is still set to 50%. + */ + fun setColor(primary: Int) { + primaryColor = primary + bottomCirclePaint.apply { + color = primary + style = Paint.Style.FILL + alpha = DEFAULT_OPACITY + } + invalidate() + } + + /** + * Sets state of the component to the parameter, must be of type MicInputCloud.ViewState. + */ + fun setState(s: ViewState) { + state = s + invalidate() + } + + fun getState() : ViewState { + return state + } + + /** + * Sets the rotation speed and radius to the parameters, defaults are left unchanged. + */ + fun setRotationSpeed(speed: Float, r: Float) { + rotationSpeedMultiplier = speed + radius = r + invalidate() + } + + /** + * Starts the growing and shrinking animation + */ + fun startAnimators() { + ovalOneAnimator?.start() + ovalTwoAnimator?.start() + ovalThreeAnimator?.start() + } + + companion object { + val TAG: String? = MicInputCloudView::class.simpleName + const val DEFAULT_RADIUS: Float = 70f + const val EXTENDED_RADIUS: Float = 75f + const val MAXIMUM_RADIUS: Float = 80f + const val ICON_SIZE: Int = 9 // Converted to dp this equals about 24dp + private const val DEFAULT_SIZE: Int = 110 + private const val DEFAULT_OPACITY: Int = 108 + private const val DEFAULT_ROTATION_SPEED_MULTIPLIER: Float = 0.5f + private const val OVAL_ONE_DEFAULT_ROTATION: Float = 105f + private const val OVAL_ONE_DEFAULT_HEIGHT: Int = 85 + private const val OVAL_ONE_DEFAULT_WIDTH: Int = 30 + private const val OVAL_ONE_ANIMATION_LENGTH: Long = 2000 + private const val OVAL_ONE_ANIMATION_SPEED: Float = 2.3f + private const val OVAL_TWO_DEFAULT_ROTATION: Float = 138f + private const val OVAL_TWO_DEFAULT_HEIGHT: Int = 70 + private const val OVAL_TWO_DEFAULT_WIDTH: Int = 25 + private const val OVAL_TWO_ANIMATION_LENGTH: Long = 1000 + private const val OVAL_TWO_ANIMATION_SPEED: Float = 1.75f + private const val OVAL_THREE_DEFAULT_ROTATION: Float = 63f + private const val OVAL_THREE_DEFAULT_HEIGHT: Int = 80 + private const val OVAL_THREE_DEFAULT_WIDTH: Int = 40 + private const val OVAL_THREE_ANIMATION_LENGTH: Long = 1500 + private const val OVAL_THREE_ANIMATION_SPEED: Float = 1f + private const val ANIMATION_CAP: Int = 15 + private val Int.dp: Int + get() = (this * Resources.getSystem().displayMetrics.density).roundToInt() + } +} 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 5c783439..def29466 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 @@ -25,8 +25,10 @@ import android.app.DatePickerDialog import android.app.TimePickerDialog import android.content.ContentValues import android.content.Intent +import android.content.res.ColorStateList import android.net.Uri import android.os.Bundle +import android.os.SystemClock import android.provider.ContactsContract import android.provider.MediaStore import android.speech.RecognizerIntent @@ -39,6 +41,9 @@ import android.view.Menu import android.view.MenuItem import android.view.View import android.widget.Toast +import android.view.View.OnTouchListener +import android.widget.SeekBar +import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AlertDialog import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet @@ -52,6 +57,7 @@ import com.google.android.material.snackbar.Snackbar import com.jakewharton.rxbinding2.view.clicks import com.jakewharton.rxbinding2.widget.textChanges import com.moez.QKSMS.common.QkMediaPlayer +import com.uber.autodispose.ObservableSubscribeProxy import com.uber.autodispose.android.lifecycle.scope import com.uber.autodispose.autoDisposable import dagger.android.AndroidInjection @@ -67,6 +73,7 @@ import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint import dev.octoshrimpy.quik.common.util.extensions.setTint import dev.octoshrimpy.quik.common.util.extensions.setVisible import dev.octoshrimpy.quik.common.util.extensions.showKeyboard +import dev.octoshrimpy.quik.common.widget.MicInputCloudView import dev.octoshrimpy.quik.common.widget.QkEditText import dev.octoshrimpy.quik.extensions.mapNotNull import dev.octoshrimpy.quik.feature.compose.editing.ChipsAdapter @@ -74,13 +81,23 @@ 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.android.schedulers.AndroidSchedulers +import io.reactivex.disposables.Disposable +import io.reactivex.schedulers.Schedulers import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.Subject import kotlinx.android.synthetic.main.compose_activity.attach import kotlinx.android.synthetic.main.compose_activity.attachAFileIcon import kotlinx.android.synthetic.main.compose_activity.attachAFileLabel import kotlinx.android.synthetic.main.compose_activity.attaching -import kotlinx.android.synthetic.main.compose_activity.attachingBackground +import kotlinx.android.synthetic.main.compose_activity.shadeBackground +import kotlinx.android.synthetic.main.compose_activity.audioMsgAbort +import kotlinx.android.synthetic.main.compose_activity.audioMsgAttach +import kotlinx.android.synthetic.main.compose_activity.audioMsgBackground +import kotlinx.android.synthetic.main.compose_activity.audioMsgPlayerBackground +import kotlinx.android.synthetic.main.compose_activity.audioMsgPlayerPlayPause +import kotlinx.android.synthetic.main.compose_activity.audioMsgPlayerSeekBar +import kotlinx.android.synthetic.main.compose_activity.audioMsgRecord import kotlinx.android.synthetic.main.compose_activity.camera import kotlinx.android.synthetic.main.compose_activity.cameraLabel import kotlinx.android.synthetic.main.compose_activity.chips @@ -96,7 +113,11 @@ import kotlinx.android.synthetic.main.compose_activity.message import kotlinx.android.synthetic.main.compose_activity.messageList import kotlinx.android.synthetic.main.compose_activity.messagesEmpty import kotlinx.android.synthetic.main.compose_activity.noValidRecipients -import kotlinx.android.synthetic.main.compose_activity.parts +import kotlinx.android.synthetic.main.compose_activity.messageAttachments +import kotlinx.android.synthetic.main.compose_activity.attachAnAudioMessageIcon +import kotlinx.android.synthetic.main.compose_activity.attachAnAudioMessageLabel +import kotlinx.android.synthetic.main.compose_activity.audioMsgDuration +import kotlinx.android.synthetic.main.compose_activity.recordAudioMsg import kotlinx.android.synthetic.main.compose_activity.schedule import kotlinx.android.synthetic.main.compose_activity.scheduleLabel import kotlinx.android.synthetic.main.compose_activity.scheduledCancel @@ -118,12 +139,13 @@ import java.text.SimpleDateFormat import java.util.Calendar import java.util.Date import java.util.Locale +import java.util.concurrent.TimeUnit import javax.inject.Inject class ComposeActivity : QkThemedActivity(), ComposeView { - @Inject lateinit var attachmentAdapter: AttachmentAdapter + @Inject lateinit var composeAttachmentAdapter: ComposeAttachmentAdapter @Inject lateinit var chipsAdapter: ChipsAdapter @Inject lateinit var dateFormatter: DateFormatter @Inject lateinit var messageAdapter: MessagesAdapter @@ -144,9 +166,9 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val cancelSendingIntent: Subject by lazy { messageAdapter.cancelSendingClicks } override val sendNowIntent: Subject by lazy { messageAdapter.sendNowClicks } override val resendIntent: Subject by lazy { messageAdapter.resendClicks } - override val attachmentDeletedIntent: Subject by lazy { attachmentAdapter.attachmentDeleted } + override val attachmentDeletedIntent: Subject by lazy { composeAttachmentAdapter.attachmentDeleted } override val textChangedIntent by lazy { message.textChanges() } - override val attachIntent by lazy { Observable.merge(attach.clicks(), attachingBackground.clicks()) } + override val attachIntent by lazy { Observable.merge(attach.clicks(), shadeBackground.clicks()) } override val cameraIntent by lazy { Observable.merge(camera.clicks(), cameraLabel.clicks()) } override val attachImageFileIntent by lazy { Observable.merge(gallery.clicks(), galleryLabel.clicks()) } override val attachAnyFileIntent by lazy { Observable.merge(attachAFileIcon.clicks(), attachAFileLabel.clicks()) } @@ -164,11 +186,53 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val confirmDeleteIntent: Subject> = PublishSubject.create() override val messageLinkAskIntent: Subject by lazy { messageAdapter.messageLinkClicks } override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() } + override val shadeIntent by lazy { shadeBackground.clicks() } + override val recordAnAudioMessage by lazy { + Observable.merge(recordAudioMsg.clicks(), + attachAnAudioMessageIcon.clicks(), + attachAnAudioMessageLabel.clicks()) + } + override val recordAudioAbort by lazy { audioMsgAbort.clicks() } + override val recordAudioAttach by lazy { audioMsgAttach.clicks() } + override val recordAudioPlayerPlayPause: Subject = PublishSubject.create() + override val recordAudioPlayerConfigUI: Subject = PublishSubject.create() + override val recordAudioPlayerVisible: Subject = PublishSubject.create() + override val recordAudioChronometer: Subject = PublishSubject.create() + override val recordAudioStartStop: Subject = PublishSubject.create() + + private var seekBarUpdater: Disposable? = null private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[ComposeViewModel::class.java] } private var cameraDestination: Uri? = null + private fun getSeekBarUpdater(): ObservableSubscribeProxy { + return Observable.interval(500, TimeUnit.MILLISECONDS) + .subscribeOn(Schedulers.single()) + .observeOn(AndroidSchedulers.mainThread()) + .autoDisposable(scope()) + } + + private val speechResultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> + if (result.resultCode != Activity.RESULT_OK) + return@registerForActivityResult + + // check returned results are good + val match = result.data?.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS) + if ((match === null) || (match.size < 1) || (match[0].isNullOrEmpty())) + return@registerForActivityResult + + // get the edit text view + val message = findViewById(R.id.message) + if (message === null) + return@registerForActivityResult + + // populate message box with data returned by STT, set cursor to end, and focus + message.append(match[0]) + message.setSelection(message.text.length) + message.requestFocus() + } + override fun onCreate(savedInstanceState: Bundle?) { AndroidInjection.inject(this) super.onCreate(savedInstanceState) @@ -196,15 +260,24 @@ class ComposeActivity : QkThemedActivity(), ComposeView { message.supportsInputContent = true theme - .doOnNext { loading.setTint(it.theme) } - .doOnNext { attach.setBackgroundTint(it.theme) } - .doOnNext { attach.setTint(it.textPrimary) } - .doOnNext { speechToTextIconBorder.setBackgroundTint(it.theme) } - .doOnNext { speechToTextIcon.setBackgroundTint(it.textPrimary) } - .doOnNext { speechToTextIcon.setTint(it.theme) } - .doOnNext { messageAdapter.theme = it } - .autoDisposable(scope()) - .subscribe() + .doOnNext { loading.setTint(it.theme) } + .doOnNext { attach.setBackgroundTint(it.theme) } + .doOnNext { attach.setTint(it.textPrimary) } + .doOnNext { speechToTextIconBorder.setBackgroundTint(it.theme) } + .doOnNext { speechToTextIcon.setBackgroundTint(it.textPrimary) } + .doOnNext { speechToTextIcon.setTint(it.theme) } + .doOnNext { audioMsgRecord.setColor(it.theme) } + .doOnNext { audioMsgPlayerPlayPause.setTint(it.theme) } + .doOnNext { + audioMsgPlayerSeekBar.apply { + thumbTintList = ColorStateList.valueOf(it.theme) + progressBackgroundTintList = ColorStateList.valueOf(it.theme) + progressTintList = ColorStateList.valueOf(it.theme) + } + } + .doOnNext { messageAdapter.theme = it } + .autoDisposable(scope()) + .subscribe() // context menu registration for message parts messagePartContextMenuRegistrar @@ -236,6 +309,86 @@ class ComposeActivity : QkThemedActivity(), ComposeView { true } + // start/stop audio message recording + audioMsgRecord.setOnClickListener { + recordAudioStartStop.onNext(audioMsgRecord.getState()) + } + + recordAudioChronometer + .subscribeOn(AndroidSchedulers.mainThread()) + .distinctUntilChanged() + .autoDisposable(scope()) + .subscribe { + if (it) { + audioMsgDuration.base = SystemClock.elapsedRealtime() + audioMsgDuration.start() + } else { + audioMsgDuration.stop() + } + } + + // audio record playback play/pause button + audioMsgPlayerPlayPause.setOnClickListener { + recordAudioPlayerPlayPause.onNext( + audioMsgPlayerPlayPause.tag as QkMediaPlayer.PlayingState + ) + } + + recordAudioPlayerVisible + .subscribeOn(AndroidSchedulers.mainThread()) + .distinctUntilChanged() + .autoDisposable(scope()) + .subscribe { + audioMsgPlayerBackground.isVisible = it + recordAudioPlayerConfigUI.onNext(QkMediaPlayer.PlayingState.Stopped) + } + + recordAudioPlayerConfigUI + .subscribeOn(AndroidSchedulers.mainThread()) + .distinctUntilChanged() + .autoDisposable(scope()) + .subscribe { + when (it) { + QkMediaPlayer.PlayingState.Playing -> { + audioMsgPlayerPlayPause.tag = QkMediaPlayer.PlayingState.Playing + QkMediaPlayer.start() + audioMsgPlayerPlayPause.setImageResource(R.drawable.exo_icon_pause) + seekBarUpdater = getSeekBarUpdater().subscribe { + audioMsgPlayerSeekBar.progress = QkMediaPlayer.currentPosition + audioMsgPlayerSeekBar.max = QkMediaPlayer.duration + } + audioMsgPlayerSeekBar.isEnabled = true + } + QkMediaPlayer.PlayingState.Paused -> { + audioMsgPlayerPlayPause.tag = QkMediaPlayer.PlayingState.Paused + QkMediaPlayer.pause() + audioMsgPlayerPlayPause.setImageResource(R.drawable.exo_icon_play) + seekBarUpdater?.dispose() + } + else -> { + audioMsgPlayerPlayPause.tag = QkMediaPlayer.PlayingState.Stopped + QkMediaPlayer.reset() + audioMsgPlayerPlayPause.setImageResource(R.drawable.exo_icon_play) + seekBarUpdater?.dispose() + audioMsgPlayerSeekBar.progress = 0 + audioMsgPlayerSeekBar.isEnabled = false + } + } + } + + // audio msg player seek bar handler + audioMsgPlayerSeekBar.setOnSeekBarChangeListener( + object : SeekBar.OnSeekBarChangeListener { + override fun onProgressChanged(p0: SeekBar?, progress: Int, fromUser: Boolean) { + // if seek was initiated by the user and this part is currently playing + if (fromUser) + QkMediaPlayer.seekTo(progress) + } + override fun onStartTrackingTouch(p0: SeekBar?) {} + override fun onStopTrackingTouch(p0: SeekBar?) {} + } + ) + window.callback = ComposeWindowCallback(window.callback, this) } @@ -264,6 +417,8 @@ class ComposeActivity : QkThemedActivity(), ComposeView { // stop any playing audio QkMediaPlayer.reset() + + seekBarUpdater?.dispose() } @@ -321,12 +476,19 @@ class ComposeActivity : QkThemedActivity(), ComposeView { scheduledGroup.isVisible = state.scheduled != 0L scheduledTime.text = dateFormatter.getScheduledTimestamp(state.scheduled) - parts.setVisible(state.attachments.isNotEmpty()) - attachmentAdapter.data = state.attachments + messageAttachments.setVisible(state.attachments.isNotEmpty()) + composeAttachmentAdapter.data = state.attachments attach.animate().rotation(if (state.attaching) 135f else 0f).start() attaching.isVisible = state.attaching + shadeBackground.visibility = + if (state.attaching || state.audioMsgRecording) View.VISIBLE + else View.GONE + + // show or hide audio message recording panel and shade background + audioMsgBackground.isVisible = state.audioMsgRecording + counter.text = state.remaining counter.setVisible(counter.text.isNotBlank()) @@ -334,8 +496,9 @@ class ComposeActivity : QkThemedActivity(), ComposeView { sim.contentDescription = getString(R.string.compose_sim_cd, state.subscription?.displayName) simIndex.text = state.subscription?.simSlotIndex?.plus(1)?.toString() - send.isEnabled = state.canSend - send.imageAlpha = if (state.canSend) 255 else 128 + // show either send or audio msg record button + send.visibility = if (state.canSend && !state.loading) View.VISIBLE else View.INVISIBLE + recordAudioMsg.visibility = if (state.canSend && !state.loading) View.INVISIBLE else View.VISIBLE // if not in editing mode, and there are no non-me participants that can be sent to, // hide controls that allow constructing a reply and inform user no valid recipients @@ -418,6 +581,10 @@ class ComposeActivity : QkThemedActivity(), ComposeView { ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 0) } + override fun requestRecordAudioPermission() { + ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.RECORD_AUDIO), 0) + } + override fun requestSmsPermission() { ActivityCompat.requestPermissions(this, arrayOf( Manifest.permission.READ_SMS, 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 9063b86b..fcc5646f 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 @@ -21,15 +21,12 @@ package dev.octoshrimpy.quik.feature.compose import android.content.Intent import android.net.Uri import androidx.lifecycle.ViewModel -import com.google.android.mms.ContentType import dev.octoshrimpy.quik.injection.ViewModelKey import dev.octoshrimpy.quik.model.Attachment -import dev.octoshrimpy.quik.model.Attachments import dagger.Module import dagger.Provides import dagger.multibindings.IntoMap import java.net.URLDecoder -import java.nio.charset.Charset import javax.inject.Named @Module @@ -74,12 +71,12 @@ class ComposeActivityModule { @Provides @Named("attachments") - fun provideSharedAttachments(activity: ComposeActivity): Attachments { + fun provideSharedAttachments(activity: ComposeActivity): List { 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 { Attachment(activity, it) }) + return uris.mapNotNull { Attachment(activity, it) } } @Provides diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeAttachmentAdapter.kt similarity index 99% rename from presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt rename to presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeAttachmentAdapter.kt index 72759ea3..35a69f3f 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeAttachmentAdapter.kt @@ -41,7 +41,7 @@ import kotlinx.android.synthetic.main.attachment_contact_list_item.* import javax.inject.Inject -class AttachmentAdapter @Inject constructor( +class ComposeAttachmentAdapter @Inject constructor( private val context: Context ) : QkAdapter() { 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 ca8f6475..fd261a00 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 @@ -40,11 +40,12 @@ data class ComposeState( val messages: Pair>? = null, val selectedMessages: Int = 0, val scheduled: Long = 0, - val attachments: List = ArrayList(), + val attachments: List = listOf(), val attaching: Boolean = false, val scheduling: Boolean = false, val remaining: String = "", val subscription: SubscriptionInfoCompat? = null, val canSend: Boolean = false, val validRecipientNumbers: Int = 1, + val audioMsgRecording: Boolean = false, ) \ No newline at end of file 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 ef537990..13a819fb 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 @@ -23,7 +23,9 @@ import android.view.MenuItem import android.view.View import androidx.annotation.StringRes import androidx.core.view.inputmethod.InputContentInfoCompat +import com.moez.QKSMS.common.QkMediaPlayer import dev.octoshrimpy.quik.common.base.QkView +import dev.octoshrimpy.quik.common.widget.MicInputCloudView import dev.octoshrimpy.quik.model.Attachment import dev.octoshrimpy.quik.model.Recipient import io.reactivex.Observable @@ -75,6 +77,15 @@ interface ComposeView : QkView { val confirmDeleteIntent: Observable> val messageLinkAskIntent: Observable val speechRecogniserIntent: Observable<*> + val shadeIntent: Observable + val recordAnAudioMessage: Observable + val recordAudioAbort: Observable + val recordAudioAttach: Observable + val recordAudioPlayerPlayPause: Observable + val recordAudioPlayerConfigUI: Subject + val recordAudioPlayerVisible: Subject + val recordAudioStartStop: Subject + val recordAudioChronometer: Subject fun clearSelection() fun toggleSelectAll() @@ -83,6 +94,7 @@ interface ComposeView : QkView { fun showMessageLinkAskDialog(uri: Uri) fun requestDefaultSms() fun requestStoragePermission() + fun requestRecordAudioPermission() fun requestSmsPermission() fun showContacts(sharing: Boolean, chips: List) fun themeChanged() 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 b99423be..290fbf06 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 @@ -18,11 +18,18 @@ */ package dev.octoshrimpy.quik.feature.compose +import android.annotation.SuppressLint import android.content.Context +import android.media.AudioAttributes +import android.net.Uri import android.os.Vibrator import android.telephony.SmsMessage import androidx.core.content.getSystemService +import androidx.core.net.toFile +import androidx.core.net.toUri +import com.moez.QKSMS.common.QkMediaPlayer import com.moez.QKSMS.contentproviders.MmsPartProvider +import com.moez.QKSMS.manager.MediaRecorderManager import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.common.Navigator import dev.octoshrimpy.quik.common.base.QkViewModel @@ -45,7 +52,6 @@ import dev.octoshrimpy.quik.manager.ActiveConversationManager import dev.octoshrimpy.quik.manager.BillingManager import dev.octoshrimpy.quik.manager.PermissionManager import dev.octoshrimpy.quik.model.Attachment -import dev.octoshrimpy.quik.model.Attachments import dev.octoshrimpy.quik.model.Conversation import dev.octoshrimpy.quik.model.Message import dev.octoshrimpy.quik.model.Recipient @@ -58,6 +64,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.common.widget.MicInputCloudView import dev.octoshrimpy.quik.common.widget.QkContextMenuRecyclerView import dev.octoshrimpy.quik.extensions.isSmil import dev.octoshrimpy.quik.interactor.SaveImage @@ -72,7 +79,9 @@ import io.reactivex.subjects.BehaviorSubject import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.Subject import timber.log.Timber +import java.io.File import java.util.* +import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Named @@ -81,7 +90,7 @@ class ComposeViewModel @Inject constructor( @Named("threadId") private val threadId: Long, @Named("addresses") private val addresses: List, @Named("text") private val sharedText: String, - @Named("attachments") private val sharedAttachments: Attachments, + @Named("attachments") private val sharedAttachments: List, @Named("mode") private val mode: String, private val contactRepo: ContactRepository, private val context: Context, @@ -108,7 +117,10 @@ class ComposeViewModel @Inject constructor( query = query) ) { - private val attachments: Subject> = BehaviorSubject.createDefault(sharedAttachments) + companion object { + private const val AUDIO_FILE_PREFIX = "recorded-" + } + private val chipsReducer: Subject<(List) -> List> = PublishSubject.create() private val conversation: Subject = BehaviorSubject.create() private val messages: Subject> = BehaviorSubject.create() @@ -119,6 +131,9 @@ class ComposeViewModel @Inject constructor( private var shouldShowContacts = threadId == 0L && addresses.isEmpty() init { + // set shared attachments into state, if any + newState { copy(attachments = sharedAttachments) } + val initialConversation = threadId.takeIf { it != 0L } ?.let(conversationRepo::getConversationAsync) ?.asObservable() @@ -199,9 +214,6 @@ class ComposeViewModel @Inject constructor( .distinctUntilChanged() .subscribe { enabled -> newState { copy(sendAsGroup = enabled) } } - disposables += attachments - .subscribe { attachments -> newState { copy(attachments = attachments) } } - disposables += conversation .map { conversation -> conversation.id } .distinctUntilChanged() @@ -253,10 +265,11 @@ class ComposeViewModel @Inject constructor( newState { copy(scheduling = true) } } + @SuppressLint("StringFormatInvalid") override fun bindView(view: ComposeView) { super.bindView(view) - val sharing = sharedText.isNotEmpty() || sharedAttachments.isNotEmpty() + val sharing = (sharedText.isNotEmpty() || sharedAttachments.isNotEmpty()) if (shouldShowContacts) { shouldShowContacts = false view.showContacts(sharing, selectedChips.blockingFirst()) @@ -387,8 +400,10 @@ class ComposeViewModel @Inject constructor( .filter { it == R.id.forward } .withLatestFrom(view.messagesSelectedIntent) { _, messages -> messages?.firstOrNull()?.let { messageRepo.getMessage(it) }?.let { message -> - val attachments = message.parts.filter { !it.isSmil() }.mapNotNull { it.getUri() } - navigator.showCompose(message.getText(), attachments) + navigator.showCompose( + message.getText(), + message.parts.filter { !it.isSmil() }.mapNotNull { it.getUri() } + ) } } .autoDisposable(view.scope()) @@ -648,15 +663,16 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { view.requestDatePicker() } - // a file, photo or otherwise, was picked by the user + // an attachment was picked by the user Observable.merge( view.attachAnyFileSelectedIntent.map { uri -> Attachment(context, uri) }, view.inputContentIntent.map { inputContent -> Attachment(context, inputContent = inputContent) } ) - .withLatestFrom(attachments) { attachment, attachments -> attachments + attachment } - .doOnNext(attachments::onNext) .autoDisposable(view.scope()) - .subscribe { newState { copy(attaching = false) } } + .subscribe { + newState { copy(attachments = attachments + it, attaching = false) } + } + // Set the scheduled time view.scheduleSelectedIntent .filter { scheduled -> @@ -675,20 +691,28 @@ class ComposeViewModel @Inject constructor( // Contact was selected for attachment view.contactSelectedIntent - .map { uri -> Attachment(context, uri) } - .withLatestFrom(attachments) { attachment, attachments -> attachments + attachment } .subscribeOn(Schedulers.io()) .autoDisposable(view.scope()) - .subscribe(attachments::onNext) { error -> + .subscribe( + { + newState { + copy(attachments = attachments + Attachment(context, uri = it)) + } + } + ) { error -> context.makeToast(R.string.compose_contact_error) Timber.w(error) } - // Detach a photo + // Detach an attachment view.attachmentDeletedIntent - .withLatestFrom(attachments) { bitmap, attachments -> attachments.filter { it !== bitmap } } .autoDisposable(view.scope()) - .subscribe { attachments.onNext(it) } + .subscribe { + newState { copy(attachments = attachments - it) } + + // if the attachment is backed by a local file, delete the file + it.removeCacheFile() + } conversation .map { conversation -> conversation.draft } @@ -707,14 +731,17 @@ class ComposeViewModel @Inject constructor( } } - // Enable the send button when there is text input into the new message body or there's - // an attachment, disable otherwise - Observables - .combineLatest(view.textChangedIntent, attachments) { text, attachments -> - text.isNotBlank() || attachments.isNotEmpty() - } - .autoDisposable(view.scope()) - .subscribe { canSend -> newState { copy(canSend = canSend) } } + // set canSend state depending on if there is text input or an attachment + Observables.combineLatest( + view.textChangedIntent, // input message text changed + state + .distinctUntilChanged { state -> state.attachments } // attachments changed + .map { it.attachments.size } // number of attachments + ) + .autoDisposable(view.scope()) + .subscribe { + newState { copy(canSend = (it.first.isNotBlank() || (it.second > 0))) } + } // Show the remaining character counter when necessary view.textChangedIntent @@ -766,11 +793,140 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { view.startSpeechRecognition() } + // shade clicked + view.shadeIntent + .autoDisposable(view.scope()) + .subscribe { newState { copy(attaching = false) } } + + // starting or stopping (change state) of audio message recording + state + .distinctUntilChanged { state -> state.audioMsgRecording } + .skip(1) // skip initial value + .autoDisposable(view.scope()) + .subscribe { + // stop any audio playback (ie from mms attachment or audio recorder) + QkMediaPlayer.stop() + + // if leaving audio recording mode + if (!it.audioMsgRecording) { + // ensure recording stopped and delete any recording file + safeDeleteLocalFile(MediaRecorderManager.stopRecording()) + view.recordAudioChronometer.onNext(false) // stop chronometer + } + } + + // start recording an audio message + view.recordAnAudioMessage + .autoDisposable(view.scope()) + .subscribe { + view.recordAudioPlayerVisible.onNext(false) // hide audio player + + // check have permissions to record audio + if (permissionManager.hasRecordAudio().also { + if (!it) view.requestRecordAudioPermission() + }) { + newState { copy( attaching = false, audioMsgRecording = true) } + view.recordAudioChronometer.onNext(true) // start chronometer + MediaRecorderManager.startRecording(context) + } + } + + // abort recording audio message button + view.recordAudioAbort + .observeOn(Schedulers.io()) + .autoDisposable(view.scope()) + .subscribe { newState { copy( audioMsgRecording = false) } } + + // main record/stop recording audio message button + view.recordAudioStartStop + .autoDisposable(view.scope()) + .subscribe { + if (it == MicInputCloudView.ViewState.PAUSED_STATE) { + view.recordAudioChronometer.onNext(false) // stop chronometer + MediaRecorderManager.stopRecording() + view.recordAudioPlayerVisible.onNext(true) // show audio player + } else { // state = start recording + // delete old recording file + safeDeleteLocalFile(MediaRecorderManager.uri) + view.recordAudioPlayerVisible.onNext(false) // hide audio player + view.recordAudioChronometer.onNext(true) // start chronometer + MediaRecorderManager.startRecording(context) + } + } + + // attach recorded audio message button + view.recordAudioAttach + .autoDisposable(view.scope()) + .subscribe { + MediaRecorderManager.stopRecording() + + try { + // create new filename for recorded file + val newFile = File( + context.cacheDir, + "${AUDIO_FILE_PREFIX}${UUID.randomUUID()}${MediaRecorderManager.AUDIO_FILE_SUFFIX}" + ) + + // rename recorded file to new name + MediaRecorderManager.uri.toFile().renameTo(newFile) + + // attach newly named file to message + newState { + copy( + audioMsgRecording = false, + attachments = attachments + Attachment(context, newFile.toUri()) + ) + } + } + catch (e: Exception) { /* nothing */ } + } + + // audio recording player play/pause button + view.recordAudioPlayerPlayPause + .autoDisposable(view.scope()) + .subscribe { + when (it) { + QkMediaPlayer.PlayingState.Paused -> + view.recordAudioPlayerConfigUI.onNext( + QkMediaPlayer.PlayingState.Playing + ) + QkMediaPlayer.PlayingState.Playing -> + view.recordAudioPlayerConfigUI.onNext( + QkMediaPlayer.PlayingState.Paused + ) + else -> { + if (MediaRecorderManager.uri != Uri.EMPTY) { + QkMediaPlayer.setOnPreparedListener { + view.recordAudioPlayerConfigUI.onNext( + QkMediaPlayer.PlayingState.Playing + ) + } + QkMediaPlayer.setOnCompletionListener { + view.recordAudioPlayerConfigUI.onNext( + QkMediaPlayer.PlayingState.Stopped + ) + } + + // start the media player play sequence + QkMediaPlayer.setAudioAttributes( + AudioAttributes.Builder() + .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH) + .setUsage(AudioAttributes.USAGE_MEDIA) + .build() + ) + + QkMediaPlayer.setDataSource(context, MediaRecorderManager.uri) + + QkMediaPlayer.prepareAsync() + } + } + } + } + // Send a message when the send button is clicked, and disable editing mode if it's enabled view.sendIntent .withLatestFrom(view.textChangedIntent) { _, body -> body.toString() } - .withLatestFrom(state, attachments, conversation, selectedChips) { body, state, attachments, - conversation, chips -> + .withLatestFrom(state, conversation, selectedChips) { body, state, conversation, chips -> if (!permissionManager.isDefaultSms()) { view.requestDefaultSms() return@withLatestFrom @@ -804,7 +960,7 @@ class ComposeViewModel @Inject constructor( // Scheduling a message state.scheduled != 0L -> { newState { copy(scheduled = 0) } - val uris = attachments.map { it.uri.toString() } + val uris = state.attachments.map { it.uri.toString() } val params = AddScheduledMessage .Params(state.scheduled, subId, addresses, sendAsGroup, body, uris) addScheduledMessage.execute(params) @@ -814,19 +970,19 @@ class ComposeViewModel @Inject constructor( // Sending a group message sendAsGroup -> { sendMessage.execute(SendMessage - .Params(subId, conversation.id, addresses, body, attachments, delay)) + .Params(subId, conversation.id, addresses, body, state.attachments, delay)) } // Sending a message to an existing conversation with one recipient conversation.recipients.size == 1 -> { val address = conversation.recipients.map { it.address } - sendMessage.execute(SendMessage.Params(subId, threadId, address, body, attachments, delay)) + sendMessage.execute(SendMessage.Params(subId, threadId, address, body, state.attachments, delay)) } // Create a new conversation with one address addresses.size == 1 -> { sendMessage.execute(SendMessage - .Params(subId, threadId, addresses, body, attachments, delay)) + .Params(subId, threadId, addresses, body, state.attachments, delay)) } // Send a message to multiple addresses @@ -838,13 +994,14 @@ class ComposeViewModel @Inject constructor( val address = listOf(conversationRepo .getConversation(threadId)?.recipients?.firstOrNull()?.address ?: addr) sendMessage.execute(SendMessage - .Params(subId, threadId, address, body, attachments, delay)) + .Params(subId, threadId, address, body, state.attachments, delay)) } } } + // configure for new message view.setDraft("") - this.attachments.onNext(ArrayList()) + newState { copy(attachments = listOf()) } if (state.editingMode) { newState { copy(editingMode = false, hasError = !sendAsGroup) } @@ -880,6 +1037,28 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { view.clearSelection() } + // when activity changes visibility, delete old recording cache files in background thread + // generally there won't be any, but under some circumstances some can be left behind + view.activityVisibleIntent + .subscribeOn(Schedulers.io()) + .autoDisposable(view.scope()) + .subscribe { + context.cacheDir.listFiles()?.forEach { + if (it.isFile && + it.name.startsWith(AUDIO_FILE_PREFIX) && + it.name.endsWith(MediaRecorderManager.AUDIO_FILE_SUFFIX)) + safeDeleteLocalFile(it.toUri()) + } + } + } + + private fun safeDeleteLocalFile(uri: Uri): Boolean { + return try { + if (uri == Uri.EMPTY) + false + uri.toFile().delete() + } + catch (e: Exception) { false } } } diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index fb19ed9a..5bf8c05a 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -168,7 +168,7 @@ android:id="@+id/composeBar" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:constraint_referenced_ids="messageBackground,parts,attach,message,counter,send" /> + app:constraint_referenced_ids="messageBackground,messageAttachments,attach,message,counter" /> + tools:text="December 23rd at 12:00AM" /> + app:layout_constraintEnd_toEndOf="@id/messageBackground" + app:tint="?android:attr/textColorSecondary" /> + app:layout_constraintEnd_toEndOf="@id/messageBackground" + app:tint="?android:attr/textColorSecondary" /> + app:layout_constraintEnd_toEndOf="parent" + app:tint="?android:textColorSecondary" + tools:visibility="visible" /> + android:textDirection="ltr" + tools:text="Moez Bhatti" /> - - + app:constraint_referenced_ids="contact,contactLabel,schedule,scheduleLabel,attachAFileIcon,attachAFileLabel,attachAnAudioMessageIcon,attachAnAudioMessageLabel,gallery,galleryLabel,camera,cameraLabel" /> + app:layout_constraintTop_toTopOf="parent" + tools:visibility="gone" /> + app:layout_constraintStart_toStartOf="@id/attach" + app:tint="?android:attr/textColorSecondary" /> + app:layout_constraintStart_toStartOf="@id/attach" + app:tint="?android:attr/textColorSecondary" /> - @@ -521,6 +518,39 @@ app:layout_constraintStart_toEndOf="@id/attachAFileIcon" app:layout_constraintTop_toTopOf="@id/attachAFileIcon" /> + + + + app:layout_constraintStart_toStartOf="@id/attach" + app:tint="?android:attr/textColorSecondary" /> + app:layout_constraintStart_toStartOf="@id/attach" + app:tint="?android:attr/textColorSecondary" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/values/attrs.xml b/presentation/src/main/res/values/attrs.xml index 45f5c173..32dfbb87 100644 --- a/presentation/src/main/res/values/attrs.xml +++ b/presentation/src/main/res/values/attrs.xml @@ -70,4 +70,9 @@ + + + + + diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index d7371aaa..915409d8 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -146,14 +146,21 @@ Add an attachment Attach any file Attach a photo + Record an audio message Take a photo Schedule message + Cancel schedule message Attach a contact Error reading contact SIM %1$d (%2$s) selected %s selected, change SIM card Send message + Record audio message + + Cancel audio message + Attach audio message + Play or pause audio message Cancel Send now From 756d39d3e1db3b39271ac4af3eb900f87287b24a Mon Sep 17 00:00:00 2001 From: gavine99 Date: Mon, 17 Feb 2025 19:33:17 +1100 Subject: [PATCH 21/29] changes to fix non-reset media player re-use crash --- .../java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 290fbf06..ec0bcb31 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 @@ -805,7 +805,7 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { // stop any audio playback (ie from mms attachment or audio recorder) - QkMediaPlayer.stop() + QkMediaPlayer.reset() // if leaving audio recording mode if (!it.audioMsgRecording) { @@ -915,6 +915,8 @@ class ComposeViewModel @Inject constructor( .build() ) + QkMediaPlayer.reset() + QkMediaPlayer.setDataSource(context, MediaRecorderManager.uri) QkMediaPlayer.prepareAsync() From dc5e0c1c5dcada53da9309cd3cb4e627f5f7e559 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Mon, 17 Feb 2025 20:50:16 +1100 Subject: [PATCH 22/29] manual update to fix my rebase merge --- .../main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 def29466..f3172ffb 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 @@ -255,7 +255,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { messageList.setHasFixedSize(true) messageList.adapter = messageAdapter - parts.adapter = attachmentAdapter + messageAttachments.adapter = composeAttachmentAdapter message.supportsInputContent = true From 8f644515ac6f219798ad4af56f000b22fae1a328 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Tue, 18 Feb 2025 21:31:51 +1100 Subject: [PATCH 23/29] changes to record audio for audio message from bluetooth sco device (ie bluetooth headset or earbuds) if connected at time of record --- data/src/main/AndroidManifest.xml | 2 + .../moez/QKSMS/manager/BluetoothMicManager.kt | 145 ++++++++++++++++++ .../QKSMS/manager/MediaRecorderManager.kt | 9 +- .../QKSMS/feature/compose/ComposeActivity.kt | 51 +++--- .../moez/QKSMS/feature/compose/ComposeView.kt | 4 +- .../QKSMS/feature/compose/ComposeViewModel.kt | 90 ++++++++--- .../src/main/res/layout/compose_activity.xml | 28 +++- 7 files changed, 278 insertions(+), 51 deletions(-) create mode 100644 data/src/main/java/com/moez/QKSMS/manager/BluetoothMicManager.kt diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml index 6cf78b81..b7fb36b8 100644 --- a/data/src/main/AndroidManifest.xml +++ b/data/src/main/AndroidManifest.xml @@ -21,5 +21,7 @@ + + diff --git a/data/src/main/java/com/moez/QKSMS/manager/BluetoothMicManager.kt b/data/src/main/java/com/moez/QKSMS/manager/BluetoothMicManager.kt new file mode 100644 index 00000000..8ddeec27 --- /dev/null +++ b/data/src/main/java/com/moez/QKSMS/manager/BluetoothMicManager.kt @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2025 + * + * This file is part of QUIK. + * + * QUIK 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. + * + * QUIK 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 QUIK. If not, see . + */ +package com.moez.QKSMS.manager + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.media.AudioDeviceInfo +import android.media.AudioManager +import android.media.AudioManager.GET_DEVICES_INPUTS + + +// this class is, by design, as simplistic it can be to support easy and fast connection +// for recording from first bluetooth mic found, if any + +class BluetoothMicManager( + private val context: Context, + private val callbacks: Callbacks +) + : BroadcastReceiver() { + interface Callbacks { + fun onNoDeviceFound() + fun onDeviceFound(device: AudioDeviceInfo?) + fun onConnecting(device: AudioDeviceInfo?) + fun onConnected(device: AudioDeviceInfo?) + fun onDisconnected(device: AudioDeviceInfo?) + } + + init { + // register for bluetooth sco broadcast intents + context.registerReceiver(this, IntentFilter().apply { + addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED) + }) + } + + enum class StartBluetoothDevice { + NoDevice, + Connecting, + Connected + } + + var device: AudioDeviceInfo? = null + private set + + private var hadFirstStickyIntent: Boolean = false + private var closed: Boolean = false + + fun close() { + if (closed) + return + closed = true + + device = null + (context.getSystemService(Context.AUDIO_SERVICE) as AudioManager).stopBluetoothSco() + context.unregisterReceiver(this) + } + + // note: caller may get connected() callback before this method returns if this method is + // called from a non-UI thread and the UI thread processes a sticky sco_audio_state_connected + fun startBluetoothDevice() { + device = null + val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager + + // get all audio input devices + val allAudioInputDevices = audioManager.getDevices(GET_DEVICES_INPUTS) + +// @TODO: below code can be used for BLE headset devices if and when one can be tested +// : also need to register for BLE headset intent broadcasts and other things later +// // firstly (highest priority), check for a connected BLE headset input device +// for (btInputDevice in allAudioInputDevices) { +// if (btInputDevice.type == AudioDeviceInfo.TYPE_BLE_HEADSET) { +// device = btInputDevice +// break +// } +// } + + // if no ble device found, check if platform supports non-phone-call sco connections + if ((device == null) && + (audioManager.isBluetoothScoAvailableOffCall)) { + // find first SCO input device + for (btInputDevice in allAudioInputDevices) { + if (btInputDevice.type == AudioDeviceInfo.TYPE_BLUETOOTH_SCO) { + device = btInputDevice + break + } + } + } + + // if no usable device found, callback to caller and return + if (device == null) { + callbacks.onNoDeviceFound() + return + } + + // callback that a sco capable bluetooth device was found + callbacks.onDeviceFound(device) + + // start sco connection on bluetooth device (even if already started by other app) + try { // see https://stackoverflow.com/a/26929741 for try-catch reason + audioManager.startBluetoothSco() + } + catch (e: Exception) { /* nothing */ } + + // if sco device is already on (maybe by another app?) callback now + if (audioManager.isBluetoothScoOn) + callbacks.onConnected(device) + } + + override fun onReceive(context: Context, intent: Intent) { + if (!hadFirstStickyIntent) { + hadFirstStickyIntent = true + return + } + + // if sco connection state has changed + val action = intent.action ?: return + if (action == AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED) { + when (intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, -1)) { + AudioManager.SCO_AUDIO_STATE_CONNECTED -> callbacks.onConnected(device) + AudioManager.SCO_AUDIO_STATE_CONNECTING -> callbacks.onConnecting(device) + AudioManager.SCO_AUDIO_STATE_DISCONNECTED -> { + close() + callbacks.onDisconnected(device) + } + } + } + } +} diff --git a/data/src/main/java/com/moez/QKSMS/manager/MediaRecorderManager.kt b/data/src/main/java/com/moez/QKSMS/manager/MediaRecorderManager.kt index 157f325b..a33e8b27 100644 --- a/data/src/main/java/com/moez/QKSMS/manager/MediaRecorderManager.kt +++ b/data/src/main/java/com/moez/QKSMS/manager/MediaRecorderManager.kt @@ -19,8 +19,10 @@ package com.moez.QKSMS.manager import android.content.Context +import android.media.AudioDeviceInfo import android.media.MediaRecorder import android.net.Uri +import android.os.Build import androidx.core.net.toUri import java.io.File import java.util.UUID @@ -59,7 +61,7 @@ object MediaRecorderManager : MediaRecorder() { } } - fun startRecording(context: Context): Uri { + fun startRecording(context: Context, preferredAudioDevice: AudioDeviceInfo? = null): Uri { return try { val file = File( context.cacheDir, @@ -73,6 +75,11 @@ object MediaRecorderManager : MediaRecorder() { setAudioSource(AudioSource.MIC) setOutputFormat(OutputFormat.THREE_GPP) setAudioEncoder(AudioEncoder.AMR_WB) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + preferredDevice = preferredAudioDevice + } + recordingState = RecordingState.DataSourceConfigured setOutputFile(file.path) 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 f3172ffb..f72df1c5 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 @@ -27,6 +27,7 @@ import android.content.ContentValues import android.content.Intent import android.content.res.ColorStateList import android.net.Uri +import android.os.Build import android.os.Bundle import android.os.SystemClock import android.provider.ContactsContract @@ -41,7 +42,6 @@ import android.view.Menu import android.view.MenuItem import android.view.View import android.widget.Toast -import android.view.View.OnTouchListener import android.widget.SeekBar import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AlertDialog @@ -116,6 +116,7 @@ import kotlinx.android.synthetic.main.compose_activity.noValidRecipients import kotlinx.android.synthetic.main.compose_activity.messageAttachments import kotlinx.android.synthetic.main.compose_activity.attachAnAudioMessageIcon import kotlinx.android.synthetic.main.compose_activity.attachAnAudioMessageLabel +import kotlinx.android.synthetic.main.compose_activity.audioMsgBluetooth import kotlinx.android.synthetic.main.compose_activity.audioMsgDuration import kotlinx.android.synthetic.main.compose_activity.recordAudioMsg import kotlinx.android.synthetic.main.compose_activity.schedule @@ -187,6 +188,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val messageLinkAskIntent: Subject by lazy { messageAdapter.messageLinkClicks } override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() } override val shadeIntent by lazy { shadeBackground.clicks() } + override val recordAudioStartStopRecording: Subject = PublishSubject.create() override val recordAnAudioMessage by lazy { Observable.merge(recordAudioMsg.clicks(), attachAnAudioMessageIcon.clicks(), @@ -197,8 +199,9 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val recordAudioPlayerPlayPause: Subject = PublishSubject.create() override val recordAudioPlayerConfigUI: Subject = PublishSubject.create() override val recordAudioPlayerVisible: Subject = PublishSubject.create() + override val recordAudioMsgRecordVisible: Subject = PublishSubject.create() override val recordAudioChronometer: Subject = PublishSubject.create() - override val recordAudioStartStop: Subject = PublishSubject.create() + override val recordAudioRecord: Subject = PublishSubject.create() private var seekBarUpdater: Disposable? = null @@ -286,32 +289,34 @@ class ComposeActivity : QkThemedActivity(), ComposeView { .subscribe { registerForContextMenu(it) } // drag drop handlers for speech-to-text icon - speechToTextIcon.setOnLongClickListener { - it.startDragAndDrop(null, View.DragShadowBuilder(speechToTextFrame), null, 0) - speechToTextFrame.isVisible = false + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + speechToTextIcon.setOnLongClickListener { + it.startDragAndDrop(null, View.DragShadowBuilder(speechToTextFrame), null, 0) + speechToTextFrame.isVisible = false - contentView.setOnDragListener { _, event -> - when (event.action) { - ACTION_DROP -> { - speechToTextFrame.x = (event.x - (speechToTextFrame.width / 2)) - speechToTextFrame.y =(event.y - (speechToTextFrame.height / 2)) + contentView.setOnDragListener { _, event -> + when (event.action) { + ACTION_DROP -> { + speechToTextFrame.x = (event.x - (speechToTextFrame.width / 2)) + speechToTextFrame.y =(event.y - (speechToTextFrame.height / 2)) - // get offset from root view as a percentage of root view for saving - prefs.showSttOffsetX.set((speechToTextFrame.x - contentView.x) / contentView.width) - prefs.showSttOffsetY.set((speechToTextFrame.y - contentView.y) / contentView.height) - } - ACTION_DRAG_ENDED, ACTION_DRAG_EXITED -> { - speechToTextFrame.isVisible = true + // get offset from root view as a percentage of root view for saving + prefs.showSttOffsetX.set((speechToTextFrame.x - contentView.x) / contentView.width) + prefs.showSttOffsetY.set((speechToTextFrame.y - contentView.y) / contentView.height) + } + ACTION_DRAG_ENDED, ACTION_DRAG_EXITED -> { + speechToTextFrame.isVisible = true + } } + true } true } - true } // start/stop audio message recording audioMsgRecord.setOnClickListener { - recordAudioStartStop.onNext(audioMsgRecord.getState()) + recordAudioRecord.onNext(audioMsgRecord.getState()) } recordAudioChronometer @@ -334,6 +339,16 @@ class ComposeActivity : QkThemedActivity(), ComposeView { ) } + recordAudioMsgRecordVisible + .subscribeOn(AndroidSchedulers.mainThread()) + .distinctUntilChanged() + .autoDisposable(scope()) + .subscribe { + audioMsgRecord.isVisible = it + audioMsgDuration.isVisible = it // chronometer follows record button visibility + audioMsgBluetooth.isVisible = !it + } + recordAudioPlayerVisible .subscribeOn(AndroidSchedulers.mainThread()) .distinctUntilChanged() 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 13a819fb..6fed5e39 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 @@ -78,13 +78,15 @@ interface ComposeView : QkView { val messageLinkAskIntent: Observable val speechRecogniserIntent: Observable<*> val shadeIntent: Observable + val recordAudioStartStopRecording: Subject val recordAnAudioMessage: Observable val recordAudioAbort: Observable val recordAudioAttach: Observable val recordAudioPlayerPlayPause: Observable val recordAudioPlayerConfigUI: Subject val recordAudioPlayerVisible: Subject - val recordAudioStartStop: Subject + val recordAudioMsgRecordVisible: Subject + val recordAudioRecord: Subject val recordAudioChronometer: Subject fun clearSelection() 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 ec0bcb31..ca5ef06f 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 @@ -21,6 +21,7 @@ package dev.octoshrimpy.quik.feature.compose import android.annotation.SuppressLint import android.content.Context import android.media.AudioAttributes +import android.media.AudioDeviceInfo import android.net.Uri import android.os.Vibrator import android.telephony.SmsMessage @@ -30,6 +31,7 @@ import androidx.core.net.toUri import com.moez.QKSMS.common.QkMediaPlayer import com.moez.QKSMS.contentproviders.MmsPartProvider import com.moez.QKSMS.manager.MediaRecorderManager +import com.moez.QKSMS.manager.BluetoothMicManager import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.common.Navigator import dev.octoshrimpy.quik.common.base.QkViewModel @@ -81,7 +83,6 @@ import io.reactivex.subjects.Subject import timber.log.Timber import java.io.File import java.util.* -import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Named @@ -130,6 +131,8 @@ class ComposeViewModel @Inject constructor( private var shouldShowContacts = threadId == 0L && addresses.isEmpty() + private var bluetoothMicManager: BluetoothMicManager? = null + init { // set shared attachments into state, if any newState { copy(attachments = sharedAttachments) } @@ -798,7 +801,7 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { newState { copy(attaching = false) } } - // starting or stopping (change state) of audio message recording + // starting or stopping (change state) of audio message ui state .distinctUntilChanged { state -> state.audioMsgRecording } .skip(1) // skip initial value @@ -811,24 +814,68 @@ class ComposeViewModel @Inject constructor( if (!it.audioMsgRecording) { // ensure recording stopped and delete any recording file safeDeleteLocalFile(MediaRecorderManager.stopRecording()) - view.recordAudioChronometer.onNext(false) // stop chronometer + view.recordAudioStartStopRecording.onNext(false) } } - // start recording an audio message + // starting or stopping the recording of audio + view.recordAudioStartStopRecording + .autoDisposable(view.scope()) + .subscribe { + // if start recording + if (it == true) { + view.recordAudioPlayerVisible.onNext(false) // hide audio player + + // check have permissions to record audio + if (permissionManager.hasRecordAudio().also { + if (!it) view.requestRecordAudioPermission() + }) { + // create bluetooth mic device manager + bluetoothMicManager?.close() + bluetoothMicManager = BluetoothMicManager( + context, + object : BluetoothMicManager.Callbacks { + override fun onNoDeviceFound() { + // no bluetooth sco device found, use built-in mic + this.onConnected(null) + } + override fun onDeviceFound(device: AudioDeviceInfo?) { + // show bluetooth placeholder until bluetooth connected + view.recordAudioMsgRecordVisible.onNext(false) + } + override fun onConnecting(device: AudioDeviceInfo?) { /* nothing */ } + override fun onConnected(device: AudioDeviceInfo?) { + // show record button and chronometer, hide bluetooth placeholder + view.recordAudioMsgRecordVisible.onNext(true) + view.recordAudioChronometer.onNext(true) // start chronometer + MediaRecorderManager.startRecording(context, device) + } + override fun onDisconnected(device: AudioDeviceInfo?) { + // if bluetooth disconnects, stop recording + if (device != null) { + view.recordAudioRecord.onNext( + MicInputCloudView.ViewState.PAUSED_STATE + ) + } + } + } + ) + bluetoothMicManager?.startBluetoothDevice() + } + } else { + // stop recording + bluetoothMicManager?.close() + view.recordAudioChronometer.onNext(false) // stop chronometer + MediaRecorderManager.stopRecording() + } + } + + // record an audio message menu item or main mic icon view.recordAnAudioMessage .autoDisposable(view.scope()) .subscribe { - view.recordAudioPlayerVisible.onNext(false) // hide audio player - - // check have permissions to record audio - if (permissionManager.hasRecordAudio().also { - if (!it) view.requestRecordAudioPermission() - }) { - newState { copy( attaching = false, audioMsgRecording = true) } - view.recordAudioChronometer.onNext(true) // start chronometer - MediaRecorderManager.startRecording(context) - } + view.recordAudioStartStopRecording.onNext(true) // start recording + newState { copy( attaching = false, audioMsgRecording = true) } } // abort recording audio message button @@ -838,19 +885,15 @@ class ComposeViewModel @Inject constructor( .subscribe { newState { copy( audioMsgRecording = false) } } // main record/stop recording audio message button - view.recordAudioStartStop + view.recordAudioRecord .autoDisposable(view.scope()) .subscribe { if (it == MicInputCloudView.ViewState.PAUSED_STATE) { - view.recordAudioChronometer.onNext(false) // stop chronometer - MediaRecorderManager.stopRecording() + view.recordAudioStartStopRecording.onNext(false) // stop recording view.recordAudioPlayerVisible.onNext(true) // show audio player } else { // state = start recording - // delete old recording file - safeDeleteLocalFile(MediaRecorderManager.uri) - view.recordAudioPlayerVisible.onNext(false) // hide audio player - view.recordAudioChronometer.onNext(true) // start chronometer - MediaRecorderManager.startRecording(context) + safeDeleteLocalFile(MediaRecorderManager.uri) // delete old recording file + view.recordAudioStartStopRecording.onNext(true) // start new recording } } @@ -861,7 +904,8 @@ class ComposeViewModel @Inject constructor( MediaRecorderManager.stopRecording() try { - // create new filename for recorded file + // create new filename for recorded file (so cache clean doesn't accidentally + // delete the attachment file) val newFile = File( context.cacheDir, "${AUDIO_FILE_PREFIX}${UUID.randomUUID()}${MediaRecorderManager.AUDIO_FILE_SUFFIX}" diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index 5bf8c05a..34ae0283 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -755,16 +755,28 @@ app:srcCompat="@drawable/ic_delete_white_24dp" app:tint="?android:attr/textColorPrimary" /> - + android:layout_weight="1"> + + + + + Date: Tue, 18 Feb 2025 21:49:58 +1100 Subject: [PATCH 24/29] changes to fix a bug that appeared to be a race condition between deleting mms parts (attachments) and removing the message data from the realm db when deleting a message. there could be attempts to access part data that no longer exists. protected where the access was being attempted. --- .../QKSMS/feature/compose/part/AudioBinder.kt | 74 ++++++++++--------- 1 file changed, 39 insertions(+), 35 deletions(-) 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 44faa595..35619ab9 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 @@ -35,6 +35,7 @@ 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.extensions.resourceExists import dev.octoshrimpy.quik.feature.compose.MessagesAdapter import dev.octoshrimpy.quik.model.Message import dev.octoshrimpy.quik.model.MmsPart @@ -134,48 +135,50 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte } } else -> { - QkMediaPlayer.reset() // make sure reset before trying to (re-)use + if (part.getUri().resourceExists(context)) { + QkMediaPlayer.reset() // make sure reset before trying to (re-)use - QkMediaPlayer.setOnPreparedListener { - // start media playing - QkMediaPlayer.start() + QkMediaPlayer.setOnPreparedListener { + // start media playing + QkMediaPlayer.start() - uiToPlaying(holder) + uiToPlaying(holder) - // set current view holder and part as active - audioState.apply { - audioState.state = QkMediaPlayer.PlayingState.Playing - partId = part.id - viewHolder = 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() } - // 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!!) - 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 + 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() } - - // 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() } } } @@ -234,7 +237,8 @@ class AudioBinder @Inject constructor(colors: Colors, private val context: Conte } MediaMetadataRetriever().use { - it.setDataSource(context, part.getUri()) + if (part.getUri().resourceExists(context)) + it.setDataSource(context, part.getUri()) // metadata title holder.metadataTitle.apply { From 81dfa874ad1b8b5ddfa588d75d2a3171cf501362 Mon Sep 17 00:00:00 2001 From: Inhishonor Date: Tue, 18 Feb 2025 10:37:54 -0800 Subject: [PATCH 25/29] Update compose.xml Fixed showing the copy text details, rather than message details. --- presentation/src/main/res/menu/compose.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/res/menu/compose.xml b/presentation/src/main/res/menu/compose.xml index 2fbb86c9..59bcfa8d 100644 --- a/presentation/src/main/res/menu/compose.xml +++ b/presentation/src/main/res/menu/compose.xml @@ -51,7 +51,7 @@ @@ -104,4 +104,4 @@ android:visible="false" app:showAsAction="always" /> - \ No newline at end of file + From a8b02459c474349d205250324e50498bd3b6b806 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 19 Feb 2025 12:40:43 +1100 Subject: [PATCH 26/29] changes to enable a delete/clear menu icon on compose screen when there is message contents to clear - ie a schedule set, text input or attachments added --- .../QKSMS/feature/compose/ComposeActivity.kt | 15 +++- .../moez/QKSMS/feature/compose/ComposeView.kt | 3 + .../QKSMS/feature/compose/ComposeViewModel.kt | 74 ++++++++++++++----- presentation/src/main/res/menu/compose.xml | 14 ++-- presentation/src/main/res/values/strings.xml | 4 + 5 files changed, 83 insertions(+), 27 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 f72df1c5..56d2e315 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 @@ -185,6 +185,8 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val viewQksmsPlusIntent: Subject = PublishSubject.create() override val backPressedIntent: Subject = PublishSubject.create() override val confirmDeleteIntent: Subject> = PublishSubject.create() + override val confirmClearCurrentMessageIntent: Subject = PublishSubject.create() + override val clearCurrentMessageIntent: Subject = PublishSubject.create() override val messageLinkAskIntent: Subject by lazy { messageAdapter.messageLinkClicks } override val speechRecogniserIntent by lazy { speechToTextIcon.clicks() } override val shadeIntent by lazy { shadeBackground.clicks() } @@ -470,7 +472,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { && state.query.isEmpty() toolbar.menu.findItem(R.id.copy)?.isVisible = !state.editingMode && state.selectedMessages > 0 toolbar.menu.findItem(R.id.details)?.isVisible = !state.editingMode && state.selectedMessages == 1 - toolbar.menu.findItem(R.id.delete)?.isVisible = !state.editingMode && state.selectedMessages > 0 + toolbar.menu.findItem(R.id.delete)?.isVisible = !state.editingMode && ((state.selectedMessages > 0) || state.canSend) toolbar.menu.findItem(R.id.forward)?.isVisible = !state.editingMode && state.selectedMessages == 1 toolbar.menu.findItem(R.id.show_status)?.isVisible = !state.editingMode && state.selectedMessages > 0 toolbar.menu.findItem(R.id.previous)?.isVisible = state.selectedMessages == 0 && state.query.isNotEmpty() @@ -712,6 +714,17 @@ class ComposeActivity : QkThemedActivity(), ComposeView { .show() } + override fun showClearCurrentMessageDialog() { + android.app.AlertDialog.Builder(this) + .setTitle(R.string.dialog_clear_compose_title) + .setMessage(R.string.dialog_clear_compose) + .setPositiveButton(R.string.button_clear) { _, _ -> + clearCurrentMessageIntent.onNext(Unit) + } + .setNegativeButton(R.string.button_cancel, null) + .show() + } + override fun onCreateOptionsMenu(menu: Menu?): Boolean { menuInflater.inflate(R.menu.compose, menu) return super.onCreateOptionsMenu(menu) 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 6fed5e39..dac6193f 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 @@ -75,6 +75,8 @@ interface ComposeView : QkView { val viewQksmsPlusIntent: Subject val backPressedIntent: Observable val confirmDeleteIntent: Observable> + val confirmClearCurrentMessageIntent: Observable + val clearCurrentMessageIntent: Subject val messageLinkAskIntent: Observable val speechRecogniserIntent: Observable<*> val shadeIntent: Observable @@ -109,6 +111,7 @@ interface ComposeView : QkView { fun scrollToMessage(id: Long) fun showQksmsPlusSnackbar(@StringRes message: Int) fun showDeleteDialog( messages: List) + fun showClearCurrentMessageDialog() fun startSpeechRecognition() } \ No newline at end of file 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 ca5ef06f..e316f501 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 @@ -388,15 +388,21 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { view.showDetails(it) } - // Show the delete message dialog + // Show the delete message dialog if one or more messages selected view.optionsItemIntent - .filter { it == R.id.delete } - .filter { permissionManager.isDefaultSms().also { if (!it) view.requestDefaultSms() } } - .withLatestFrom(view.messagesSelectedIntent, conversation) { _, messages, conversation -> - view.showDeleteDialog(messages) - } - .autoDisposable(view.scope()) - .subscribe() + .filter { it == R.id.delete } + .withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages } + .filter { permissionManager.isDefaultSms().also { if (!it) view.requestDefaultSms() } } + .autoDisposable(view.scope()) + .subscribe { view.showDeleteDialog(it) } + + // show the clear current message dialog if no messages selected + view.optionsItemIntent + .filter { it == R.id.delete } + .withLatestFrom(state) { _, state -> state } + .filter { it.selectedMessages == 0 } + .autoDisposable(view.scope()) + .subscribe { view.showClearCurrentMessageDialog() } // Forward the message view.optionsItemIntent @@ -734,16 +740,22 @@ class ComposeViewModel @Inject constructor( } } - // set canSend state depending on if there is text input or an attachment + // set canSend state depending on if there is text input, an attachment or a schedule set Observables.combineLatest( view.textChangedIntent, // input message text changed state .distinctUntilChanged { state -> state.attachments } // attachments changed - .map { it.attachments.size } // number of attachments + .map { it.attachments.size }, // number of attachments + state.distinctUntilChanged { state -> state.scheduled } // schedule set or not + .map { it.scheduled } ) .autoDisposable(view.scope()) .subscribe { - newState { copy(canSend = (it.first.isNotBlank() || (it.second > 0))) } + newState { + copy( + canSend = (it.first.isNotBlank() || (it.second > 0)) || (it.third > 0) + ) + } } // Show the remaining character counter when necessary @@ -1045,13 +1057,8 @@ class ComposeViewModel @Inject constructor( } } - // configure for new message - view.setDraft("") - newState { copy(attachments = listOf()) } - - if (state.editingMode) { - newState { copy(editingMode = false, hasError = !sendAsGroup) } - } + // clear the current message ready for new message composition + view.clearCurrentMessageIntent.onNext(Unit) } .autoDisposable(view.scope()) .subscribe() @@ -1083,6 +1090,37 @@ class ComposeViewModel @Inject constructor( .autoDisposable(view.scope()) .subscribe { view.clearSelection() } + view.confirmClearCurrentMessageIntent + .autoDisposable(view.scope()) + .subscribe { view.clearCurrentMessageIntent.onNext(Unit) } + + // clear the current message schedule, text and attachments + view.clearCurrentMessageIntent + .withLatestFrom(state) { _, state -> state } + .autoDisposable(view.scope()) + .subscribe { + view.setDraft("") + // if choosing contacts, don't remove attachments. they may have come from an + // external share + if (it.editingMode) + newState { + copy( + editingMode = false, + hasError = !sendAsGroup, + scheduled = 0, + ) + } + else + newState { + copy( + editingMode = false, + hasError = !sendAsGroup, + attachments = listOf(), + scheduled = 0, + ) + } + } + // when activity changes visibility, delete old recording cache files in background thread // generally there won't be any, but under some circumstances some can be left behind view.activityVisibleIntent diff --git a/presentation/src/main/res/menu/compose.xml b/presentation/src/main/res/menu/compose.xml index 2fbb86c9..711dbe72 100644 --- a/presentation/src/main/res/menu/compose.xml +++ b/presentation/src/main/res/menu/compose.xml @@ -41,26 +41,24 @@ android:visible="false" app:showAsAction="always" /> - - - + Are you sure you would like to delete %d messages? + Clear message + Clear the message? This action can\'t be undone. + Copy text Forward @@ -453,6 +456,7 @@ More Set Undo + Clear Copied From 302dadd077c875e1431ef3a4c65ccd37a84046c4 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 19 Feb 2025 13:32:35 +1100 Subject: [PATCH 27/29] changed to reset all necessary state, regardless of editingMode, in clearCurrentMessageIntent handler --- .../QKSMS/feature/compose/ComposeViewModel.kt | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 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 e316f501..daa4ca56 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 @@ -1102,23 +1102,14 @@ class ComposeViewModel @Inject constructor( view.setDraft("") // if choosing contacts, don't remove attachments. they may have come from an // external share - if (it.editingMode) - newState { - copy( - editingMode = false, - hasError = !sendAsGroup, - scheduled = 0, - ) - } - else - newState { - copy( - editingMode = false, - hasError = !sendAsGroup, - attachments = listOf(), - scheduled = 0, - ) - } + newState { + copy( + editingMode = false, + hasError = !sendAsGroup, + attachments = listOf(), + scheduled = 0, + ) + } } // when activity changes visibility, delete old recording cache files in background thread From d7c5b1b71e9fcda7bb0b7051a3f34e3573c4a71c Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 19 Feb 2025 18:51:36 +1100 Subject: [PATCH 28/29] changes to make scheduled messages activity ui compliant with the rest of the app message listing activities. now allows sending and deleting multiple scheduled messages at once --- .../ScheduledMessageRepositoryImpl.kt | 4 + .../repository/ScheduledMessageRepository.kt | 3 + .../moez/QKSMS/common/base/QkRealmAdapter.kt | 47 ++- .../QKSMS/feature/compose/MessagesAdapter.kt | 35 --- .../conversations/ConversationsAdapter.kt | 23 -- .../feature/scheduled/ScheduledActivity.kt | 91 ++++-- .../scheduled/ScheduledMessageAdapter.kt | 15 +- .../QKSMS/feature/scheduled/ScheduledState.kt | 3 +- .../QKSMS/feature/scheduled/ScheduledView.kt | 13 +- .../feature/scheduled/ScheduledViewModel.kt | 108 +++++-- .../main/res/layout/scheduled_activity.xml | 268 ++++++++++-------- .../src/main/res/menu/scheduled_messages.xml | 51 ++++ presentation/src/main/res/values/strings.xml | 10 +- 13 files changed, 430 insertions(+), 241 deletions(-) create mode 100644 presentation/src/main/res/menu/scheduled_messages.xml diff --git a/data/src/main/java/com/moez/QKSMS/repository/ScheduledMessageRepositoryImpl.kt b/data/src/main/java/com/moez/QKSMS/repository/ScheduledMessageRepositoryImpl.kt index c407c526..676133c8 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/ScheduledMessageRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/ScheduledMessageRepositoryImpl.kt @@ -69,6 +69,10 @@ class ScheduledMessageRepositoryImpl @Inject constructor() : ScheduledMessageRep disposables.add(subscription) } + override fun deleteScheduledMessages(ids: List) { + ids.forEach { deleteScheduledMessage(it) } + } + // Ensure to clear disposables when the repository is no longer needed fun clearDisposables() { disposables.clear() diff --git a/domain/src/main/java/com/moez/QKSMS/repository/ScheduledMessageRepository.kt b/domain/src/main/java/com/moez/QKSMS/repository/ScheduledMessageRepository.kt index cd78bc08..e4150aa9 100644 --- a/domain/src/main/java/com/moez/QKSMS/repository/ScheduledMessageRepository.kt +++ b/domain/src/main/java/com/moez/QKSMS/repository/ScheduledMessageRepository.kt @@ -50,4 +50,7 @@ interface ScheduledMessageRepository { */ fun deleteScheduledMessage(id: Long) + // delete multiple scheduled messages by id list + fun deleteScheduledMessages(ids: List) + } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/common/base/QkRealmAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/common/base/QkRealmAdapter.kt index 1fbc7d6d..8312e765 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/base/QkRealmAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/base/QkRealmAdapter.kt @@ -52,13 +52,28 @@ abstract class QkRealmAdapter : RealmRecyclerViewAdapter() + /** + * Mark this message as highlighted + */ + var highlight: Long = -1L + set(value) { + if (field == value) return + + field = value + notifyDataSetChanged() + } + /** * Toggles the selected state for a particular view * * If we are currently in selection mode (we have an active selection), then the state will * toggle. If we are not in selection mode, then we will only toggle if [force] */ - protected fun toggleSelection(id: Long, force: Boolean = true): Boolean { + protected fun toggleSelection( + id: Long, + force: Boolean = true, + useChangeEvent: Boolean = true + ): Boolean { if (!force && selection.isEmpty()) return false selection = when (selection.contains(id)) { @@ -66,7 +81,8 @@ abstract class QkRealmAdapter : RealmRecyclerViewAdapter selection + id } - selectionChanges.onNext(selection) + if (useChangeEvent) + selectionChanges.onNext(selection) return true } @@ -80,6 +96,33 @@ abstract class QkRealmAdapter : RealmRecyclerViewAdapter= 0 are allowed. Input was: $index") 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 e6f2074f..c4421ef1 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 @@ -132,17 +132,6 @@ class MessagesAdapter @Inject constructor( private val conversation: Conversation? get() = data?.first?.takeIf { it.isValid } - /** - * Mark this message as highlighted - */ - var highlight: Long = -1L - set(value) { - if (field == value) return - - field = value - notifyDataSetChanged() - } - private val contactCache = ContactCache() private val expanded = HashMap() private val subs = subscriptionManager.activeSubscriptionInfoList @@ -405,30 +394,6 @@ class MessagesAdapter @Inject constructor( } } - fun toggleSelectAll() { - var needToSelectAll = false - - // if a non-selected item is found, then we need to select all, otherwise deselect all - for (position in 0 until itemCount) - if (!isSelected(getItemId(position))) { - needToSelectAll = true - break - } - - // select or deselect item based on if toggling all selected of deselected - for (position in 0 until itemCount) { - val messageId = getItemId(position) - // if deselecting all then toggle selection (we know all items are selected) - if (!needToSelectAll) - toggleSelection(messageId) - // else, selecting all, toggle if not already selected - else if (!isSelected(messageId)) - toggleSelection(messageId) - } - - notifyDataSetChanged() - } - fun expandMessages(messageIds: List, expand: Boolean) { messageIds.forEach { messageId -> expanded[messageId] = expand } notifyDataSetChanged() diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationsAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationsAdapter.kt index ec9ff36d..e9448d7e 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationsAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationsAdapter.kt @@ -131,27 +131,4 @@ class ConversationsAdapter @Inject constructor( return if (getItem(position)?.unread == false) 0 else 1 } - fun toggleSelectAll() { - var needToSelectAll = false - - // if a non-selected item is found, then we need to select all, otherwise deselect all - for (position in 0 until itemCount) - if (!isSelected(getItemId(position))) { - needToSelectAll = true - break - } - - // select or deselect item based on if toggling all selected of deselected - for (position in 0 until itemCount) { - val threadId = getItemId(position) - // if deselecting all then toggle selection (we know all items are selected) - if (!needToSelectAll) - toggleSelection(threadId) - // else, selecting all, toggle if not already selected - else if (!isSelected(threadId)) - toggleSelection(threadId) - } - - notifyDataSetChanged() - } } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt index 77603095..4439fd6c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt @@ -20,33 +20,36 @@ package dev.octoshrimpy.quik.feature.scheduled import android.graphics.Typeface import android.os.Bundle +import android.view.Menu +import android.view.MenuItem import androidx.core.view.isVisible import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProviders import com.jakewharton.rxbinding2.view.clicks import dev.octoshrimpy.quik.R -import dev.octoshrimpy.quik.common.QkDialog import dev.octoshrimpy.quik.common.base.QkThemedActivity -import dev.octoshrimpy.quik.common.util.FontProvider import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint import dev.octoshrimpy.quik.common.util.extensions.setTint import dagger.android.AndroidInjection -import kotlinx.android.synthetic.main.collapsing_toolbar.* +import io.reactivex.subjects.PublishSubject +import io.reactivex.subjects.Subject +import kotlinx.android.synthetic.main.main_activity.toolbar import kotlinx.android.synthetic.main.scheduled_activity.* import javax.inject.Inject class ScheduledActivity : QkThemedActivity(), ScheduledView { - @Inject lateinit var dialog: QkDialog - @Inject lateinit var fontProvider: FontProvider - @Inject lateinit var messageAdapter: ScheduledMessageAdapter + @Inject lateinit var scheduledMessageAdapter: ScheduledMessageAdapter @Inject lateinit var viewModelFactory: ViewModelProvider.Factory - override val messageClickIntent by lazy { messageAdapter.clicks } - override val messageMenuIntent by lazy { dialog.adapter.menuItemClicks } override val composeIntent by lazy { compose.clicks() } override val upgradeIntent by lazy { upgrade.clicks() } + override val messagesSelectedIntent by lazy { scheduledMessageAdapter.selectionChanges } + override val optionsItemIntent: Subject = PublishSubject.create() + override val deleteScheduledMessages: Subject> = PublishSubject.create() + override val sendScheduledMessages: Subject> = PublishSubject.create() + override val backPressedIntent: Subject = PublishSubject.create() private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[ScheduledViewModel::class.java] } @@ -58,19 +61,8 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView { showBackButton(true) viewModel.bindView(this) - if (!prefs.systemFont.get()) { - fontProvider.getLato { lato -> - val typeface = Typeface.create(lato, Typeface.BOLD) - collapsingToolbar.setCollapsedTitleTypeface(typeface) - collapsingToolbar.setExpandedTitleTypeface(typeface) - } - } - - dialog.title = getString(R.string.scheduled_options_title) - dialog.adapter.setData(R.array.scheduled_options) - - messageAdapter.emptyView = empty - messages.adapter = messageAdapter + scheduledMessageAdapter.emptyView = empty + messages.adapter = scheduledMessageAdapter colors.theme().let { theme -> sampleMessage.setBackgroundTint(theme.theme) @@ -84,14 +76,65 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView { } override fun render(state: ScheduledState) { - messageAdapter.updateData(state.scheduledMessages) + scheduledMessageAdapter.updateData(state.scheduledMessages) + setTitle(when { + (state.selectedMessages > 0) -> + getString(R.string.compose_title_selected, state.selectedMessages) + else -> getString(R.string.scheduled_title) + }) + + // show/hide menu items + toolbar.menu.findItem(R.id.delete)?.isVisible = + ((scheduledMessageAdapter.itemCount != 0) && (state.selectedMessages != 0)) + toolbar.menu.findItem(R.id.select_all)?.isVisible = + ((scheduledMessageAdapter.itemCount > 1) && (state.selectedMessages != 0)) + toolbar.menu.findItem(R.id.copy)?.isVisible = (state.selectedMessages != 0) + toolbar.menu.findItem(R.id.send_now)?.isVisible = (state.selectedMessages != 0) + + // show compose button compose.isVisible = state.upgraded upgrade.isVisible = !state.upgraded } - override fun showMessageOptions() { - dialog.show(this) + override fun onBackPressed() = backPressedIntent.onNext(Unit) + + override fun clearSelection() = scheduledMessageAdapter.clearSelection() + + override fun toggleSelectAll() = scheduledMessageAdapter.toggleSelectAll() + + override fun showDeleteDialog(messages: List) { + val count = messages.size + android.app.AlertDialog.Builder(this) + .setTitle(R.string.dialog_delete_title) + .setMessage(resources.getQuantityString(R.plurals.dialog_delete_chat, count, count)) + .setPositiveButton(R.string.button_delete) { _, _ -> deleteScheduledMessages.onNext(messages) } + .setNegativeButton(R.string.button_cancel, null) + .show() + } + + override fun showSendNowDialog(messages: List) { + val count = messages.size + android.app.AlertDialog.Builder(this) + .setTitle(R.string.dialog_delete_title) + .setMessage(resources.getQuantityString(R.plurals.dialog_send_now, count, count)) + .setPositiveButton(R.string.main_menu_send_now) { _, _ -> sendScheduledMessages.onNext(messages) } + .setNegativeButton(R.string.button_cancel, null) + .show() + } + + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + menuInflater.inflate(R.menu.scheduled_messages, menu) + return super.onCreateOptionsMenu(menu) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + optionsItemIntent.onNext(item.itemId) + return true + } + + override fun finishActivity() { + finish() } } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledMessageAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledMessageAdapter.kt index 9d2e59b0..f42f6a66 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledMessageAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledMessageAdapter.kt @@ -61,7 +61,13 @@ class ScheduledMessageAdapter @Inject constructor( return QkViewHolder(view).apply { view.setOnClickListener { val message = getItem(adapterPosition) ?: return@setOnClickListener - clicks.onNext(message.id) + if (toggleSelection(message.id, false)) + view.isActivated = isSelected(message.id) + } + view.setOnClickListener { + val message = getItem(adapterPosition) ?: return@setOnClickListener + toggleSelection(message.id) + view.isActivated = isSelected(message.id) } } } @@ -79,11 +85,18 @@ class ScheduledMessageAdapter @Inject constructor( holder.date.text = dateFormatter.getScheduledTimestamp(message.date) holder.body.text = message.body + // update the selected/highlighted state + holder.containerView.isActivated = isSelected(message.id) || highlight == message.id + val adapter = holder.attachments.adapter as ScheduledMessageAttachmentAdapter adapter.data = message.attachments.map(Uri::parse) holder.attachments.isVisible = message.attachments.isNotEmpty() } + override fun getItemId(position: Int): Long { + return getItem(position)?.id ?: -1 + } + /** * Cache the contacts in a map by the address, because the messages we're binding don't have * a reference to the contact. diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledState.kt b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledState.kt index 987d7f54..92d42439 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledState.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledState.kt @@ -23,5 +23,6 @@ import io.realm.RealmResults data class ScheduledState( val scheduledMessages: RealmResults? = null, - val upgraded: Boolean = true + val upgraded: Boolean = true, + val selectedMessages: Int = 0, ) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledView.kt b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledView.kt index 26b079d5..b1717287 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledView.kt @@ -23,11 +23,18 @@ import io.reactivex.Observable interface ScheduledView : QkView { - val messageClickIntent: Observable - val messageMenuIntent: Observable val composeIntent: Observable<*> val upgradeIntent: Observable<*> + val messagesSelectedIntent: Observable> + val optionsItemIntent: Observable + val deleteScheduledMessages: Observable> + val sendScheduledMessages: Observable> + val backPressedIntent: Observable - fun showMessageOptions() + fun clearSelection() + fun toggleSelectAll() + fun showDeleteDialog(messages: List) + fun showSendNowDialog(messages: List) + fun finishActivity() } 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 c2f1489b..e2449208 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 @@ -4,14 +4,12 @@ import android.content.Context import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.common.Navigator import dev.octoshrimpy.quik.common.base.QkViewModel -import dev.octoshrimpy.quik.common.util.ClipboardUtils -import dev.octoshrimpy.quik.common.util.extensions.makeToast import dev.octoshrimpy.quik.interactor.SendScheduledMessage import dev.octoshrimpy.quik.manager.BillingManager import dev.octoshrimpy.quik.repository.ScheduledMessageRepository import com.uber.autodispose.android.lifecycle.scope import com.uber.autodispose.autoDisposable -import io.reactivex.Observable +import dev.octoshrimpy.quik.common.util.ClipboardUtils import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.rxkotlin.plusAssign import io.reactivex.rxkotlin.withLatestFrom @@ -23,7 +21,7 @@ class ScheduledViewModel @Inject constructor( private val context: Context, private val navigator: Navigator, private val scheduledMessageRepo: ScheduledMessageRepository, - private val sendScheduledMessage: SendScheduledMessage + private val sendScheduledMessageInteractor: SendScheduledMessage, ) : QkViewModel(ScheduledState( scheduledMessages = scheduledMessageRepo.getScheduledMessages() )) { @@ -36,41 +34,93 @@ class ScheduledViewModel @Inject constructor( override fun bindView(view: ScheduledView) { super.bindView(view) - view.messageClickIntent + // update the state when the message selected count changes + view.messagesSelectedIntent + .map { selection -> selection.size } .autoDisposable(view.scope()) - .subscribe { view.showMessageOptions() } + .subscribe { newState { copy(selectedMessages = it) } } - view.messageMenuIntent - .withLatestFrom(view.messageClickIntent) { itemId, messageId -> - when (itemId) { - 0 -> sendScheduledMessage.execute(messageId) - 1 -> scheduledMessageRepo.getScheduledMessage(messageId)?.let { message -> - ClipboardUtils.copy(context, message.body) - context.makeToast(R.string.toast_copied) - } - 2 -> { - val deleteSubscription = Observable.fromCallable { - scheduledMessageRepo.deleteScheduledMessage(messageId) - } - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe({ - // Handle completion, e.g., log success or update UI - }, { - // Handle error, e.g., log or show error message - }) + // toggle select all / select none + view.optionsItemIntent + .filter { it == R.id.select_all } + .autoDisposable(view.scope()) + .subscribe { view.toggleSelectAll() } - disposables += deleteSubscription + // show the delete message dialog if one or more messages selected + view.optionsItemIntent + .filter { it == R.id.delete } + .withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages } + .autoDisposable(view.scope()) + .subscribe { view.showDeleteDialog(it) } + + // copy the selected message text to the clipboard + view.optionsItemIntent + .filter { it == R.id.copy } + .withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages } + .autoDisposable(view.scope()) + .subscribe { + val messages = it + .mapNotNull(scheduledMessageRepo::getScheduledMessage) + .sortedBy { it.date } // same order as messages on screen + val text = when (messages.size) { + 1 -> messages.first().body + else -> messages.fold(StringBuilder()) { acc, message -> + if (acc.isNotEmpty() && message.body.isNotEmpty()) + acc.append("\n\n") + acc.append(message.body) } } - Unit + + ClipboardUtils.copy(context, text.toString()) } + + // send the messages now menu item selected + view.optionsItemIntent + .filter { it == R.id.send_now } + .withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages } .autoDisposable(view.scope()) - .subscribe() + .subscribe { view.showSendNowDialog(it) } + + // delete message(s) (fired after the confirmation dialog has been shown) + view.deleteScheduledMessages + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .autoDisposable(view.scope()) + .subscribe { + scheduledMessageRepo.deleteScheduledMessages(it) + view.clearSelection() + } + + // send message(s) now (fired after the confirmation dialog has been shown) + view.sendScheduledMessages + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .autoDisposable(view.scope()) + .subscribe { + it.forEach { sendScheduledMessageInteractor.execute(it) } + view.clearSelection() + } + + // navigate back or unselect + view.optionsItemIntent + .filter { it == android.R.id.home } + .map { Unit } + .mergeWith(view.backPressedIntent) + .withLatestFrom(state) { _, state -> state } + .autoDisposable(view.scope()) + .subscribe { + when { + (it.selectedMessages > 0) -> view.clearSelection() + else -> view.finishActivity() + } + } view.composeIntent .autoDisposable(view.scope()) - .subscribe { navigator.showCompose(mode = "scheduling") } + .subscribe { + navigator.showCompose(mode = "scheduling") + view.clearSelection() + } view.upgradeIntent .autoDisposable(view.scope()) diff --git a/presentation/src/main/res/layout/scheduled_activity.xml b/presentation/src/main/res/layout/scheduled_activity.xml index 7b598f1c..08199c0e 100644 --- a/presentation/src/main/res/layout/scheduled_activity.xml +++ b/presentation/src/main/res/layout/scheduled_activity.xml @@ -17,145 +17,177 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:layout_height="match_parent" + android:orientation="vertical"> - + android:layout_height="wrap_content" + android:gravity="center_vertical" + app:layout_constrainedHeight="true" + app:layout_constraintHeight_max="140dp" + app:layout_constraintTop_toTopOf="parent"> - - - - - - - - - - - - - - - - - - - + android:textDirection="ltr" + tools:text="Moez Bhatti" /> - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + android:layout_gravity="bottom|end" + android:layout_margin="16dp" + android:contentDescription="@string/scheduled_compose_cd" + android:src="@drawable/ic_schedule_send_black_24dp" + android:tint="@color/white" + android:visibility="visible" + tools:backgroundTint="@color/tools_theme" /> - + - + - + - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/menu/scheduled_messages.xml b/presentation/src/main/res/menu/scheduled_messages.xml new file mode 100644 index 00000000..1e86b168 --- /dev/null +++ b/presentation/src/main/res/menu/scheduled_messages.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index b1dffe67..1a1a8a4b 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -57,6 +57,7 @@ Mark read Mark unread Block + Send now Rename conversation Syncing messages… You: %s @@ -102,6 +103,10 @@ Are you sure you would like to delete this message? Are you sure you would like to delete %d messages? + + Are you sure you would like to send this message now? + Are you sure you would like to send %d messages now? + Clear message Clear the message? This action can\'t be undone. @@ -234,11 +239,6 @@ Schedule a message Scheduled message Missing - - Send now - Copy text - Delete - Appearance General From ff5bafb00c6c6f04375dd2a2ecc10ff18c4c8eef Mon Sep 17 00:00:00 2001 From: gavine99 Date: Wed, 19 Feb 2025 19:04:55 +1100 Subject: [PATCH 29/29] fixed title of send now confirm dialog --- .../java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt index 4439fd6c..e1dc3738 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt @@ -116,7 +116,7 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView { override fun showSendNowDialog(messages: List) { val count = messages.size android.app.AlertDialog.Builder(this) - .setTitle(R.string.dialog_delete_title) + .setTitle(R.string.main_menu_send_now) .setMessage(resources.getQuantityString(R.plurals.dialog_send_now, count, count)) .setPositiveButton(R.string.main_menu_send_now) { _, _ -> sendScheduledMessages.onNext(messages) } .setNegativeButton(R.string.button_cancel, null)