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 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..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 @@ -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 @@ -67,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 @@ -126,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 { @@ -190,6 +190,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 +203,14 @@ 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.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), + 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" /> - - - Poll ended Remove poll Are you sure you want to remove this poll? You won\'t be able to recover it once removed. + + Open camera + Send images and videos + Upload file + Send sticker + Open contacts + Create poll +