diff --git a/matisse/src/main/java/com/zhihu/matisse/internal/entity/CaptureStrategy.java b/matisse/src/main/java/com/zhihu/matisse/internal/entity/CaptureStrategy.java index 7e1fcaa92..c4de7cacf 100644 --- a/matisse/src/main/java/com/zhihu/matisse/internal/entity/CaptureStrategy.java +++ b/matisse/src/main/java/com/zhihu/matisse/internal/entity/CaptureStrategy.java @@ -19,9 +19,15 @@ public class CaptureStrategy { public final boolean isPublic; public final String authority; + public final String directory; public CaptureStrategy(boolean isPublic, String authority) { + this(isPublic, authority, null); + } + + public CaptureStrategy(boolean isPublic, String authority, String directory) { this.isPublic = isPublic; this.authority = authority; + this.directory = directory; } } diff --git a/matisse/src/main/java/com/zhihu/matisse/internal/utils/MediaStoreCompat.java b/matisse/src/main/java/com/zhihu/matisse/internal/utils/MediaStoreCompat.java index cc0fc47c5..1621b8745 100644 --- a/matisse/src/main/java/com/zhihu/matisse/internal/utils/MediaStoreCompat.java +++ b/matisse/src/main/java/com/zhihu/matisse/internal/utils/MediaStoreCompat.java @@ -117,6 +117,9 @@ private File createImageFile() throws IOException { } else { storageDir = mContext.get().getExternalFilesDir(Environment.DIRECTORY_PICTURES); } + if (mCaptureStrategy.directory != null) { + storageDir = new File(storageDir, mCaptureStrategy.directory); + } // Avoid joining path components manually File tempFile = new File(storageDir, imageFileName);