Skip to content

Commit

Permalink
Fixed images scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
glodanif committed Mar 24, 2018
1 parent d477787 commit d31b93d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def final VERSION_CODE = 13
def final VERSION_NAME = '1.0.0'
def final VERSION_CODE = 14
def final VERSION_NAME = '1.0.1'

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ class ChatMessageConverter(private val context: Context, private val displayMetr

val info = message.fileInfo
val actualSize = info?.split("x")
var width = (displayMetrics.widthPixels * .5).toInt()
var width = displayMetrics.widthPixels / 2
var height = width
if (info != null && actualSize != null && actualSize.size == 2 && actualSize[0].toInt() >= 0 && actualSize[1].toInt() >= 0) {
width = actualSize[0].toInt()
height = actualSize[1].toInt()
if (info != null && actualSize != null && actualSize.size == 2) {
val scaledSize = getScaledSize(actualSize[0].toInt(), actualSize[1].toInt())
if (scaledSize.width >= 0 && scaledSize.height >= 0) {
width = scaledSize.width
height = scaledSize.height
}
}

return ChatMessageViewModel(
Expand Down

0 comments on commit d31b93d

Please sign in to comment.