Implements FS#111: Compress resized picture with PNG format
This commit is contained in:
parent
0e2cd3e142
commit
2a14176b80
2 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
###Conversations+ ChangeLog
|
###Conversations+ ChangeLog
|
||||||
|
|
||||||
####Version 0.0.6
|
####Version 0.0.6
|
||||||
|
* Implements FS#111: Compress resized picture with PNG format
|
||||||
* Fixes FS#107: Account can be edited while online
|
* Fixes FS#107: Account can be edited while online
|
||||||
* Implements FS#77: Open list of resources for own jid
|
* Implements FS#77: Open list of resources for own jid
|
||||||
* Fixes FS#99: Adjust namespace according to XEP-0363
|
* Fixes FS#99: Adjust namespace according to XEP-0363
|
||||||
|
|
|
@ -47,7 +47,7 @@ public final class FileBackend {
|
||||||
extension = "."+parts[parts.length - 1];
|
extension = "."+parts[parts.length - 1];
|
||||||
} else {
|
} else {
|
||||||
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_TEXT) {
|
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_TEXT) {
|
||||||
extension = ".webp";
|
extension = ".png";
|
||||||
} else {
|
} else {
|
||||||
extension = "";
|
extension = "";
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public final class FileBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DownloadableFile compressImageAndCopyToPrivateStorage(Message message, Bitmap scaledBitmap) throws FileCopyException {
|
public static DownloadableFile compressImageAndCopyToPrivateStorage(Message message, Bitmap scaledBitmap) throws FileCopyException {
|
||||||
message.setRelativeFilePath(FileBackend.getPrivateImageDirectoryPath() + message.getUuid() + ".webp");
|
message.setRelativeFilePath(FileBackend.getPrivateImageDirectoryPath() + message.getUuid() + ".png");
|
||||||
DownloadableFile file = getFile(message);
|
DownloadableFile file = getFile(message);
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
OutputStream os = null;
|
OutputStream os = null;
|
||||||
|
@ -128,7 +128,7 @@ public final class FileBackend {
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
os = new FileOutputStream(file);
|
os = new FileOutputStream(file);
|
||||||
|
|
||||||
boolean success = scaledBitmap.compress(Bitmap.CompressFormat.WEBP, 75, os);
|
boolean success = scaledBitmap.compress(Bitmap.CompressFormat.PNG, 75, os);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw new FileCopyException(R.string.error_compressing_image);
|
throw new FileCopyException(R.string.error_compressing_image);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue