Skip to content
Snippets Groups Projects
Commit 3ab2489f authored by Kamal Bramwell's avatar Kamal Bramwell
Browse files

Added logic to rotate photos according to exif data

parent 0374ae2d
No related branches found
No related tags found
No related merge requests found
...@@ -121,7 +121,8 @@ abstract class MediaProviderActivity : ...@@ -121,7 +121,8 @@ abstract class MediaProviderActivity :
} }
private fun correctPhotoOrientation(image: Bitmap, uri: Uri) { private fun correctPhotoOrientation(image: Bitmap, uri: Uri) {
val ei = ExifInterface(uri.path!!) val inputStream = contentResolver.openInputStream(uri) ?: return
val ei = ExifInterface(inputStream)
val orientation = ei.getAttributeInt( val orientation = ei.getAttributeInt(
ExifInterface.TAG_ORIENTATION, ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_UNDEFINED ExifInterface.ORIENTATION_UNDEFINED
......
...@@ -25,7 +25,9 @@ import io.xxlabs.messenger.support.util.Utils ...@@ -25,7 +25,9 @@ import io.xxlabs.messenger.support.util.Utils
import io.xxlabs.messenger.ui.dialog.info.InfoDialogUI import io.xxlabs.messenger.ui.dialog.info.InfoDialogUI
import io.xxlabs.messenger.ui.main.chat.ChatMessagesUIController.Companion.ALL_MESSAGES import io.xxlabs.messenger.ui.main.chat.ChatMessagesUIController.Companion.ALL_MESSAGES
import io.xxlabs.messenger.ui.main.chat.ChatMessagesUIController.Companion.MAX_REPLY_PREVIEW_LENGTH import io.xxlabs.messenger.ui.main.chat.ChatMessagesUIController.Companion.MAX_REPLY_PREVIEW_LENGTH
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import timber.log.Timber import timber.log.Timber
import java.util.* import java.util.*
...@@ -514,10 +516,14 @@ abstract class ChatMessagesViewModel<T: ChatMessage> ( ...@@ -514,10 +516,14 @@ abstract class ChatMessagesViewModel<T: ChatMessage> (
override fun getUserId() = preferences.getUserId() override fun getUserId() = preferences.getUserId()
protected fun onMessageSent(resetMessageInput: Boolean = true) { protected fun onMessageSent(resetMessageInput: Boolean = true) {
viewModelScope.launch {
withContext(Dispatchers.Main) {
_beepEvent.value = true _beepEvent.value = true
_vibrateEvent.value = HapticFeedbackConstants.LONG_PRESS _vibrateEvent.value = HapticFeedbackConstants.LONG_PRESS
if (resetMessageInput) resetMessageInput() if (resetMessageInput) resetMessageInput()
} }
}
}
protected open fun resetMessageInput() { protected open fun resetMessageInput() {
reply.value = null reply.value = null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment