From ecc4009689b1d96dff283766269560f91172aec1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 4 Jan 2022 15:48:28 +0100 Subject: [PATCH 1/4] Add tooltip to explain what are the actions behind the buttons --- .../attachments/AttachmentTypeSelectorView.kt | 21 +++++++++++-------- vector/src/main/res/values/strings.xml | 4 ++++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt index c56b3ac832..1bc50d31fd 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt @@ -30,6 +30,8 @@ import android.view.animation.TranslateAnimation import android.widget.ImageButton import android.widget.LinearLayout import android.widget.PopupWindow +import androidx.annotation.StringRes +import androidx.appcompat.widget.TooltipCompat import androidx.core.view.doOnNextLayout import androidx.core.view.isVisible import im.vector.app.R @@ -190,6 +192,7 @@ class AttachmentTypeSelectorView(context: Context, private fun ImageButton.configure(type: Type): ImageButton { this.setOnClickListener(TypeClickListener(type)) + TooltipCompat.setTooltipText(this, context.getString(type.tooltipRes)) return this } @@ -202,15 +205,15 @@ class AttachmentTypeSelectorView(context: Context, } /** - * The all possible types to pick with their required permissions. + * The all possible types to pick with their required permissions and tooltip resource */ - enum class Type(val permissions: List) { - CAMERA(PERMISSIONS_FOR_TAKING_PHOTO), - GALLERY(PERMISSIONS_EMPTY), - FILE(PERMISSIONS_EMPTY), - STICKER(PERMISSIONS_EMPTY), - AUDIO(PERMISSIONS_EMPTY), - CONTACT(PERMISSIONS_FOR_PICKING_CONTACT), - POLL(PERMISSIONS_EMPTY) + enum class Type(val permissions: List, @StringRes val tooltipRes: Int) { + CAMERA(PERMISSIONS_FOR_TAKING_PHOTO, R.string.option_take_photo_video), + GALLERY(PERMISSIONS_EMPTY, R.string.tooltip_select_item_from_gallery), + FILE(PERMISSIONS_EMPTY, R.string.tooltip_select_file), + STICKER(PERMISSIONS_EMPTY, R.string.option_send_sticker), + AUDIO(PERMISSIONS_EMPTY, R.string.tooltip_select_audio_file), + CONTACT(PERMISSIONS_FOR_PICKING_CONTACT, R.string.tooltip_select_contact), + POLL(PERMISSIONS_EMPTY, R.string.create_poll_title) } } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 9886a9f009..ef1cb5abc8 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -3676,4 +3676,8 @@ Poll ended Remove poll Are you sure you want to remove this poll? You won\'t be able to recover it once removed. + Select photos and videos from your device + Select any files from your device + Select audio file from your device + Select contact from your device From 0797860e4f49966b3bb31d064f6bae7aa98f52a8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 4 Jan 2022 16:02:16 +0100 Subject: [PATCH 2/4] Update changelog --- changelog.d/3444.bugfix | 1 - changelog.d/3444.feature | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 changelog.d/3444.bugfix create mode 100644 changelog.d/3444.feature diff --git a/changelog.d/3444.bugfix b/changelog.d/3444.bugfix deleted file mode 100644 index bf397da5b7..0000000000 --- a/changelog.d/3444.bugfix +++ /dev/null @@ -1 +0,0 @@ -Attachment picker UI improvements \ No newline at end of file diff --git a/changelog.d/3444.feature b/changelog.d/3444.feature new file mode 100644 index 0000000000..8b9fad18b1 --- /dev/null +++ b/changelog.d/3444.feature @@ -0,0 +1 @@ +New attachment picker UI \ No newline at end of file From 97459bc8229f15f84d4c515ab7e370d5d5988fe6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 4 Jan 2022 18:43:17 +0100 Subject: [PATCH 3/4] Update wording of tooltips (Gaelle's review) --- .../attachments/AttachmentTypeSelectorView.kt | 14 +++++++------- vector/src/main/res/values/strings.xml | 13 +++++++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt index 1bc50d31fd..8e3401b6f1 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt @@ -208,12 +208,12 @@ class AttachmentTypeSelectorView(context: Context, * The all possible types to pick with their required permissions and tooltip resource */ enum class Type(val permissions: List, @StringRes val tooltipRes: Int) { - CAMERA(PERMISSIONS_FOR_TAKING_PHOTO, R.string.option_take_photo_video), - GALLERY(PERMISSIONS_EMPTY, R.string.tooltip_select_item_from_gallery), - FILE(PERMISSIONS_EMPTY, R.string.tooltip_select_file), - STICKER(PERMISSIONS_EMPTY, R.string.option_send_sticker), - AUDIO(PERMISSIONS_EMPTY, R.string.tooltip_select_audio_file), - CONTACT(PERMISSIONS_FOR_PICKING_CONTACT, R.string.tooltip_select_contact), - POLL(PERMISSIONS_EMPTY, R.string.create_poll_title) + CAMERA(PERMISSIONS_FOR_TAKING_PHOTO, R.string.tooltip_attachment_photo), + GALLERY(PERMISSIONS_EMPTY, R.string.tooltip_attachment_gallery), + FILE(PERMISSIONS_EMPTY, R.string.tooltip_attachment_file), + STICKER(PERMISSIONS_EMPTY, R.string.tooltip_attachment_sticker), + AUDIO(PERMISSIONS_EMPTY, R.string.tooltip_attachment_audio), + CONTACT(PERMISSIONS_FOR_PICKING_CONTACT, R.string.tooltip_attachment_contact), + POLL(PERMISSIONS_EMPTY, R.string.tooltip_attachment_poll) } } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index ef1cb5abc8..fb873f71b2 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -3676,8 +3676,13 @@ Poll ended Remove poll Are you sure you want to remove this poll? You won\'t be able to recover it once removed. - Select photos and videos from your device - Select any files from your device - Select audio file from your device - Select contact from your device + + Open camera + Send images and videos + Upload file + Send sticker + WILL BE REMOVED + Open contacts + Create poll + From d07dd154b8a4b961f3a14c0a1e30a921798eee3a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 4 Jan 2022 18:50:32 +0100 Subject: [PATCH 4/4] Remove audio item from attachment picker. Keep some related code for now --- .../attachments/AttachmentTypeSelectorView.kt | 3 --- .../features/home/room/detail/RoomDetailFragment.kt | 7 ------- .../main/res/layout/view_attachment_type_selector.xml | 11 ----------- vector/src/main/res/values/strings.xml | 1 - 4 files changed, 22 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt index 8e3401b6f1..683c5908ba 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt @@ -69,7 +69,6 @@ class AttachmentTypeSelectorView(context: Context, views.attachmentCameraButton.configure(Type.CAMERA) views.attachmentFileButton.configure(Type.FILE) views.attachmentStickersButton.configure(Type.STICKER) - views.attachmentAudioButton.configure(Type.AUDIO) views.attachmentContactButton.configure(Type.CONTACT) views.attachmentPollButton.configure(Type.POLL) width = LinearLayout.LayoutParams.MATCH_PARENT @@ -128,7 +127,6 @@ class AttachmentTypeSelectorView(context: Context, Type.GALLERY -> views.attachmentGalleryButton Type.FILE -> views.attachmentFileButton Type.STICKER -> views.attachmentStickersButton - Type.AUDIO -> views.attachmentAudioButton Type.CONTACT -> views.attachmentContactButton Type.POLL -> views.attachmentPollButton }.let { @@ -212,7 +210,6 @@ class AttachmentTypeSelectorView(context: Context, GALLERY(PERMISSIONS_EMPTY, R.string.tooltip_attachment_gallery), FILE(PERMISSIONS_EMPTY, R.string.tooltip_attachment_file), STICKER(PERMISSIONS_EMPTY, R.string.tooltip_attachment_sticker), - AUDIO(PERMISSIONS_EMPTY, R.string.tooltip_attachment_audio), CONTACT(PERMISSIONS_FOR_PICKING_CONTACT, R.string.tooltip_attachment_contact), POLL(PERMISSIONS_EMPTY, R.string.tooltip_attachment_poll) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index 620730cb4d..8c180d50e2 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -1163,12 +1163,6 @@ class RoomDetailFragment @Inject constructor( } } - private val attachmentAudioActivityResultLauncher = registerStartForActivityResult { - if (it.resultCode == Activity.RESULT_OK) { - attachmentsHelper.onAudioResult(it.data) - } - } - private val attachmentContactActivityResultLauncher = registerStartForActivityResult { if (it.resultCode == Activity.RESULT_OK) { attachmentsHelper.onContactResult(it.data) @@ -2218,7 +2212,6 @@ class RoomDetailFragment @Inject constructor( ) AttachmentTypeSelectorView.Type.FILE -> attachmentsHelper.selectFile(attachmentFileActivityResultLauncher) AttachmentTypeSelectorView.Type.GALLERY -> attachmentsHelper.selectGallery(attachmentMediaActivityResultLauncher) - AttachmentTypeSelectorView.Type.AUDIO -> attachmentsHelper.selectAudio(attachmentAudioActivityResultLauncher) AttachmentTypeSelectorView.Type.CONTACT -> attachmentsHelper.selectContact(attachmentContactActivityResultLauncher) AttachmentTypeSelectorView.Type.STICKER -> roomDetailViewModel.handle(RoomDetailAction.SelectStickerAttachment) AttachmentTypeSelectorView.Type.POLL -> navigator.openCreatePoll(requireContext(), roomDetailArgs.roomId) diff --git a/vector/src/main/res/layout/view_attachment_type_selector.xml b/vector/src/main/res/layout/view_attachment_type_selector.xml index 463d05d95d..77c25572c8 100644 --- a/vector/src/main/res/layout/view_attachment_type_selector.xml +++ b/vector/src/main/res/layout/view_attachment_type_selector.xml @@ -82,17 +82,6 @@ android:src="@drawable/ic_attachment_camera" app:tint="?colorPrimary" /> - - - Send images and videos Upload file Send sticker - WILL BE REMOVED Open contacts Create poll