mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Ask for permission before opening the camera (#934)
This commit is contained in:
parent
4335fa4f72
commit
e02430bcd0
3 changed files with 13 additions and 12 deletions
|
@ -11,7 +11,7 @@ Other changes:
|
|||
-
|
||||
|
||||
Bugfix 🐛:
|
||||
-
|
||||
- Ask for permission before opening the camera (#934)
|
||||
|
||||
Translations 🗣:
|
||||
-
|
||||
|
|
|
@ -43,7 +43,9 @@ import im.vector.riotx.R
|
|||
import im.vector.riotx.core.extensions.getMeasurements
|
||||
import im.vector.riotx.core.utils.PERMISSIONS_EMPTY
|
||||
import im.vector.riotx.core.utils.PERMISSIONS_FOR_PICKING_CONTACT
|
||||
import im.vector.riotx.core.utils.PERMISSIONS_FOR_TAKING_PHOTO
|
||||
import im.vector.riotx.core.utils.PERMISSIONS_FOR_WRITING_FILES
|
||||
import im.vector.riotx.features.attachments.AttachmentTypeSelectorView.Callback
|
||||
import kotlin.math.max
|
||||
|
||||
private const val ANIMATION_DURATION = 250
|
||||
|
@ -146,10 +148,10 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
private fun animateWindowInCircular(anchor: View, contentView: View) {
|
||||
val coordinates = getClickCoordinates(anchor, contentView)
|
||||
val animator = ViewAnimationUtils.createCircularReveal(contentView,
|
||||
coordinates.first,
|
||||
coordinates.second,
|
||||
0f,
|
||||
max(contentView.width, contentView.height).toFloat())
|
||||
coordinates.first,
|
||||
coordinates.second,
|
||||
0f,
|
||||
max(contentView.width, contentView.height).toFloat())
|
||||
animator.duration = ANIMATION_DURATION.toLong()
|
||||
animator.start()
|
||||
}
|
||||
|
@ -164,10 +166,10 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
private fun animateWindowOutCircular(anchor: View, contentView: View) {
|
||||
val coordinates = getClickCoordinates(anchor, contentView)
|
||||
val animator = ViewAnimationUtils.createCircularReveal(getContentView(),
|
||||
coordinates.first,
|
||||
coordinates.second,
|
||||
max(getContentView().width, getContentView().height).toFloat(),
|
||||
0f)
|
||||
coordinates.first,
|
||||
coordinates.second,
|
||||
max(getContentView().width, getContentView().height).toFloat(),
|
||||
0f)
|
||||
|
||||
animator.duration = ANIMATION_DURATION.toLong()
|
||||
animator.addListener(object : AnimatorListenerAdapter() {
|
||||
|
@ -222,8 +224,7 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
* The all possible types to pick with their required permissions.
|
||||
*/
|
||||
enum class Type(val permissionsBit: Int) {
|
||||
|
||||
CAMERA(PERMISSIONS_EMPTY),
|
||||
CAMERA(PERMISSIONS_FOR_TAKING_PHOTO),
|
||||
GALLERY(PERMISSIONS_FOR_WRITING_FILES),
|
||||
FILE(PERMISSIONS_FOR_WRITING_FILES),
|
||||
STICKER(PERMISSIONS_EMPTY),
|
||||
|
|
|
@ -1316,7 +1316,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
AttachmentTypeSelectorView.Type.AUDIO -> attachmentsHelper.selectAudio()
|
||||
AttachmentTypeSelectorView.Type.CONTACT -> attachmentsHelper.selectContact()
|
||||
AttachmentTypeSelectorView.Type.STICKER -> vectorBaseActivity.notImplemented("Adding stickers")
|
||||
}
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
// AttachmentsHelper.Callback
|
||||
|
|
Loading…
Reference in a new issue