diff --git a/app/src/main/java/com/hippo/ehviewer/EhApplication.java b/app/src/main/java/com/hippo/ehviewer/EhApplication.java index d56872679..e5d182263 100644 --- a/app/src/main/java/com/hippo/ehviewer/EhApplication.java +++ b/app/src/main/java/com/hippo/ehviewer/EhApplication.java @@ -146,6 +146,9 @@ public class EhApplication extends RecordingApplication implements Thread.Uncaug if (null != dir) { FileUtils.deleteContent(dir); } + + // Add .nomedia to external temp dir + CommonOperations.ensureNoMediaFile(UniFile.fromFile(AppConfig.getExternalTempDir())); } private void update() { diff --git a/app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java b/app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java index 6633c49c6..19432379f 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java @@ -846,7 +846,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan return; } - File dir = AppConfig.getExternalImageDir(); + File dir = AppConfig.getExternalTempDir(); if (null == dir) { Toast.makeText(this, R.string.error_cant_create_temp_file, Toast.LENGTH_SHORT).show(); return; @@ -871,17 +871,15 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan Uri uri = new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) .authority(BuildConfig.FILE_PROVIDER_AUTHORITY) - .appendPath("image") + .appendPath("temp") .appendPath(filename) .build(); + Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.setType(mimeType); startActivity(Intent.createChooser(intent, getString(R.string.share_image))); - - // Sync media store - sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, file.getUri())); } private void saveImage(int page) { diff --git a/app/src/main/res/xml/filepaths.xml b/app/src/main/res/xml/filepaths.xml index 75c866696..d6e6bc0a4 100644 --- a/app/src/main/res/xml/filepaths.xml +++ b/app/src/main/res/xml/filepaths.xml @@ -17,6 +17,6 @@ - +