diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-11-01 00:57:47 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-11-01 00:57:47 +0300 |
commit | e62ccdb14629c4ee3c7bdce9235d01714d768ead (patch) | |
tree | 0debd2914cf2b6eb1882b35c86ff5463d73c46ce /app/src/main/java/it/niedermann/nextcloud/deck/util | |
parent | 0a58eeec26919c5d2d44bfe6b8258a4d04ff0636 (diff) |
Make actual image capturing work
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/util')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java | 6 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java b/app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java index 9b177c60d..6a7807d50 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java @@ -63,7 +63,7 @@ public class AttachmentUtil { if (inputStream == null) { throw new IOException("Could not open input stream for " + currentUri.getPath()); } - final File cacheFile = getTempCacheFile(context, accountId, localCardId, UriUtils.getDisplayNameForUri(currentUri, context)); + final File cacheFile = getTempCacheFile(context, "attachments/account-" + accountId + "/card-" + (localCardId == null ? "pending-creation" : localCardId) + '/' + UriUtils.getDisplayNameForUri(currentUri, context)); final FileOutputStream outputStream = new FileOutputStream(cacheFile); byte[] buffer = new byte[4096]; @@ -78,8 +78,8 @@ public class AttachmentUtil { /** * Creates a new {@link File} */ - public static File getTempCacheFile(@NonNull Context context, long accountId, Long localCardId, String fileName) throws IOException { - File cacheFile = new File(context.getApplicationContext().getFilesDir().getAbsolutePath() + "/attachments/account-" + accountId + "/card-" + (localCardId == null ? "pending-creation" : localCardId) + '/' + fileName); + public static File getTempCacheFile(@NonNull Context context, String fileName) throws IOException { + File cacheFile = new File(context.getApplicationContext().getFilesDir().getAbsolutePath() + "/" + fileName); DeckLog.verbose("- Full path for new cache file: " + cacheFile.getAbsolutePath()); diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java b/app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java index 0390bf96d..04694a058 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java @@ -6,6 +6,7 @@ import java.util.Locale; public class MimeTypeUtil { + public static final String IMAGE_JPEG = "image/jpeg"; public static final String TEXT_PLAIN = "text/plain"; public static final String TEXT_VCARD = "text/vcard"; public static final String APPLICATION_PDF = "application/pdf"; |