Browse Source

Correct Kotlin types in avatar catalog and crop coordinates

master
evgeny 5 days ago
parent
commit
a221452cb6
  1. 2
      tools/chatgui-android/app/src/main/java/com/utun/chat/data/AvatarProtocol.kt
  2. 4
      tools/chatgui-android/app/src/main/java/com/utun/chat/ui/components/AvatarCropDialog.kt

2
tools/chatgui-android/app/src/main/java/com/utun/chat/data/AvatarProtocol.kt

@ -56,7 +56,7 @@ object AvatarProtocol {
}
val remote = ByteArray(path).also { b.get(it) }; b.position(b.position() + target)
val body = ByteArray(payload).also { b.get(it) }
return Reply(id, group, server, owner, command, status, size, hash(hash), fileType, cursor, version, more,
return Reply(id, group, server, owner, command, status, size, hash(hash), fileType, cursor, version, more!=0,
String(remote, Charsets.UTF_8), body)
}
data class Entry(val file: String, val mtime: Long)

4
tools/chatgui-android/app/src/main/java/com/utun/chat/ui/components/AvatarCropDialog.kt

@ -103,8 +103,8 @@ fun AvatarCropDialog(uri: Uri, onCancel: () -> Unit, onConfirm: (File, AvatarCro
TextButton(onClick=onCancel) { Text(stringResource(R.string.cancel)) }
TextButton(enabled=image!=null && source!=null && side>0,onClick={
val selected=requireNotNull(image)
val crop=AvatarCrop((selected.width*scale-side-2*dx)/(2*scale*selected.width),
(selected.height*scale-side-2*dy)/(2*scale*selected.height),
val crop=AvatarCrop(((selected.width*scale-side-2*dx)/(2*scale*selected.width)).toDouble(),
((selected.height*scale-side-2*dy)/(2*scale*selected.height)).toDouble(),
side.toDouble()/scale/selected.width,side.toDouble()/scale/selected.height)
handedOver=true; onConfirm(requireNotNull(source),crop)
}) { Text(stringResource(R.string.avatar_upload)) }

Loading…
Cancel
Save