Commit 46e490be authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Removes useless function.

parent 74949a24
......@@ -72,7 +72,6 @@ import chat.rocket.android.util.extensions.circularRevealOrUnreveal
import chat.rocket.android.util.extensions.clearLightStatusBar
import chat.rocket.android.util.extensions.fadeIn
import chat.rocket.android.util.extensions.fadeOut
import chat.rocket.android.util.extensions.getBitmpap
import chat.rocket.android.util.extensions.hideKeyboard
import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.isNotNullNorEmpty
......@@ -345,8 +344,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
if (resultCode == Activity.RESULT_OK) {
when (requestCode) {
REQUEST_CODE_FOR_PERFORM_CAMERA -> takenPhotoUri?.let { uri ->
showCameraImageAttachmentDialog(uri)
REQUEST_CODE_FOR_PERFORM_CAMERA -> takenPhotoUri?.let {
showFileAttachmentDialog(it)
}
REQUEST_CODE_FOR_PERFORM_SAF -> resultData?.data?.let {
showFileAttachmentDialog(it)
......
......@@ -5,7 +5,6 @@ import android.graphics.drawable.Drawable
import android.net.Uri
import androidx.core.view.isVisible
import chat.rocket.android.emoji.internal.GlideApp
import chat.rocket.android.util.extensions.getBitmpap
import chat.rocket.android.util.extensions.getFileName
import chat.rocket.android.util.extensions.getMimeType
import chat.rocket.common.util.ifNull
......@@ -99,43 +98,3 @@ fun ChatRoomFragment.showDrawAttachmentDialog(byteArray: ByteArray) {
cancelButton.setOnClickListener { alertDialog.dismiss() }
alertDialog.show()
}
fun ChatRoomFragment.showCameraImageAttachmentDialog(uri: Uri) {
imagePreview.isVisible = false
audioVideoAttachment.isVisible = false
textFile.isVisible = false
activity?.let { context ->
description.text.clear()
GlideApp
.with(context)
.asBitmap()
.load(uri)
.fitCenter()
.into(object : SimpleTarget<Bitmap>() {
override fun onResourceReady(
resource: Bitmap,
transition: Transition<in Bitmap>?
) {
imagePreview.setImageBitmap(resource)
}
})
imagePreview.isVisible = true
}
sendButton.setOnClickListener {
uri.getBitmpap(requireContext())?.let { bitmap ->
presenter.uploadImage(
chatRoomId,
"image/png",
uri,
bitmap,
(citation ?: "") + description.text.toString())
}
alertDialog.dismiss()
}
cancelButton.setOnClickListener { alertDialog.dismiss() }
alertDialog.show()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment