mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-24 09:58:31 +03:00
Add location attachment icon with required permissions.
This commit is contained in:
parent
f4cfb5d6d3
commit
03a4194047
7 changed files with 58 additions and 16 deletions
|
@ -42,6 +42,10 @@
|
|||
android:name="android.permission.WRITE_CALENDAR"
|
||||
tools:node="remove" />
|
||||
|
||||
<!-- Location Sharing -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<!-- Jitsi SDK is now API23+ -->
|
||||
<uses-sdk tools:overrideLibrary="org.jitsi.meet.sdk,com.oney.WebRTCModule,com.learnium.RNDeviceInfo,com.reactnativecommunity.asyncstorage,com.ocetnik.timer,com.calendarevents,com.reactnativecommunity.netinfo,com.kevinresol.react_native_default_preference,com.rnimmersive,com.corbt.keepawake,com.BV.LinearGradient,com.horcrux.svg,com.oblador.performance,com.reactnativecommunity.slider,com.brentvatne.react" />
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ val PERMISSIONS_FOR_MEMBERS_SEARCH = listOf(Manifest.permission.READ_CONTACTS)
|
|||
val PERMISSIONS_FOR_ROOM_AVATAR = listOf(Manifest.permission.CAMERA)
|
||||
val PERMISSIONS_FOR_WRITING_FILES = listOf(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
val PERMISSIONS_FOR_PICKING_CONTACT = listOf(Manifest.permission.READ_CONTACTS)
|
||||
val PERMISSIONS_FOR_LOCATION_SHARING = listOf(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
|
||||
val PERMISSIONS_EMPTY = emptyList<String>()
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import com.amulyakhare.textdrawable.util.ColorGenerator
|
|||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.getMeasurements
|
||||
import im.vector.app.core.utils.PERMISSIONS_EMPTY
|
||||
import im.vector.app.core.utils.PERMISSIONS_FOR_LOCATION_SHARING
|
||||
import im.vector.app.core.utils.PERMISSIONS_FOR_PICKING_CONTACT
|
||||
import im.vector.app.core.utils.PERMISSIONS_FOR_TAKING_PHOTO
|
||||
import im.vector.app.databinding.ViewAttachmentTypeSelectorBinding
|
||||
|
@ -77,6 +78,7 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
views.attachmentAudioButton.configure(Type.AUDIO)
|
||||
views.attachmentContactButton.configure(Type.CONTACT)
|
||||
views.attachmentPollButton.configure(Type.POLL)
|
||||
views.attachmentLocationButton.configure(Type.LOCATION)
|
||||
width = LinearLayout.LayoutParams.MATCH_PARENT
|
||||
height = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
animationStyle = 0
|
||||
|
@ -110,7 +112,8 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
animateButtonIn(views.attachmentAudioButton, 0)
|
||||
animateButtonIn(views.attachmentContactButton, ANIMATION_DURATION / 4)
|
||||
animateButtonIn(views.attachmentStickersButton, ANIMATION_DURATION / 2)
|
||||
animateButtonIn(views.attachmentPollButton, ANIMATION_DURATION / 4)
|
||||
animateButtonIn(views.attachmentPollButton, ANIMATION_DURATION / 2)
|
||||
animateButtonIn(views.attachmentLocationButton, ANIMATION_DURATION / 4)
|
||||
}
|
||||
|
||||
override fun dismiss() {
|
||||
|
@ -124,13 +127,14 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
|
||||
fun setAttachmentVisibility(type: Type, isVisible: Boolean) {
|
||||
when (type) {
|
||||
Type.CAMERA -> views.attachmentCameraButtonContainer
|
||||
Type.GALLERY -> views.attachmentGalleryButtonContainer
|
||||
Type.FILE -> views.attachmentFileButtonContainer
|
||||
Type.STICKER -> views.attachmentStickersButtonContainer
|
||||
Type.AUDIO -> views.attachmentAudioButtonContainer
|
||||
Type.CONTACT -> views.attachmentContactButtonContainer
|
||||
Type.POLL -> views.attachmentPollButtonContainer
|
||||
Type.CAMERA -> views.attachmentCameraButtonContainer
|
||||
Type.GALLERY -> views.attachmentGalleryButtonContainer
|
||||
Type.FILE -> views.attachmentFileButtonContainer
|
||||
Type.STICKER -> views.attachmentStickersButtonContainer
|
||||
Type.AUDIO -> views.attachmentAudioButtonContainer
|
||||
Type.CONTACT -> views.attachmentContactButtonContainer
|
||||
Type.POLL -> views.attachmentPollButtonContainer
|
||||
Type.LOCATION -> views.attachmentLocationButtonContainer
|
||||
}.let {
|
||||
it.isVisible = isVisible
|
||||
}
|
||||
|
@ -230,6 +234,7 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
STICKER(PERMISSIONS_EMPTY),
|
||||
AUDIO(PERMISSIONS_EMPTY),
|
||||
CONTACT(PERMISSIONS_FOR_PICKING_CONTACT),
|
||||
POLL(PERMISSIONS_EMPTY)
|
||||
POLL(PERMISSIONS_EMPTY),
|
||||
LOCATION(PERMISSIONS_FOR_LOCATION_SHARING)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2207,18 +2207,19 @@ class RoomDetailFragment @Inject constructor(
|
|||
|
||||
private fun launchAttachmentProcess(type: AttachmentTypeSelectorView.Type) {
|
||||
when (type) {
|
||||
AttachmentTypeSelectorView.Type.CAMERA -> attachmentsHelper.openCamera(
|
||||
AttachmentTypeSelectorView.Type.CAMERA -> attachmentsHelper.openCamera(
|
||||
activity = requireActivity(),
|
||||
vectorPreferences = vectorPreferences,
|
||||
cameraActivityResultLauncher = attachmentCameraActivityResultLauncher,
|
||||
cameraVideoActivityResultLauncher = attachmentCameraVideoActivityResultLauncher
|
||||
)
|
||||
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)
|
||||
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)
|
||||
AttachmentTypeSelectorView.Type.LOCATION -> Timber.d("On location attachment clicked")
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="14"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M7,0C3.13,0 0,3.2152 0,7.1905C0,11.4741 4.42,17.3806 6.24,19.6302C6.64,20.1233 7.37,20.1233 7.77,19.6302C9.58,17.3806 14,11.4741 14,7.1905C14,3.2152 10.87,0 7,0ZM7,9.7586C5.62,9.7586 4.5,8.6081 4.5,7.1905C4.5,5.773 5.62,4.6225 7,4.6225C8.38,4.6225 9.5,5.773 9.5,7.1905C9.5,8.6081 8.38,9.7586 7,9.7586Z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
|
@ -194,6 +194,27 @@
|
|||
android:importantForAccessibility="no"
|
||||
android:text="@string/attachment_type_poll" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/attachmentLocationButtonContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/attachmentLocationButton"
|
||||
style="@style/AttachmentTypeSelectorButton"
|
||||
android:contentDescription="@string/attachment_type_location"
|
||||
android:src="@drawable/ic_attachment_location_white"
|
||||
tools:background="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
style="@style/AttachmentTypeSelectorLabel"
|
||||
android:importantForAccessibility="no"
|
||||
android:text="@string/attachment_type_location" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
|
|
@ -2466,6 +2466,7 @@
|
|||
<string name="attachment_type_gallery">"Gallery"</string>
|
||||
<string name="attachment_type_sticker">"Sticker"</string>
|
||||
<string name="attachment_type_poll">Poll</string>
|
||||
<string name="attachment_type_location">Location</string>
|
||||
<string name="rotate_and_crop_screen_title">Rotate and crop</string>
|
||||
<string name="error_handling_incoming_share">Couldn\'t handle share data</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue