Show signature images in sent messages

This commit is contained in:
M66B
2020-02-23 19:45:05 +01:00
parent 0dbcc687cc
commit 43a892cc9e
2 changed files with 70 additions and 38 deletions

View File

@@ -834,6 +834,31 @@ public class Helper {
out.write(buf, 0, len);
}
static long copy(Context context, Uri uri, File file) throws IOException {
long size = 0;
InputStream is = null;
OutputStream os = null;
try {
is = context.getContentResolver().openInputStream(uri);
os = new FileOutputStream(file);
byte[] buffer = new byte[Helper.BUFFER_SIZE];
for (int len = is.read(buffer); len != -1; len = is.read(buffer)) {
size += len;
os.write(buffer, 0, len);
}
} finally {
try {
if (is != null)
is.close();
} finally {
if (os != null)
os.close();
}
}
return size;
}
static long getAvailableStorageSpace() {
StatFs stats = new StatFs(Environment.getDataDirectory().getAbsolutePath());
return stats.getAvailableBlocksLong() * stats.getBlockSizeLong();