diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
index 9ef69e07b..c2d9a03bc 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt
@@ -109,6 +109,8 @@ object PreferenceKeys {
const val downloadOnlyOverWifi = "pref_download_only_over_wifi_key"
+ const val folderPerManga = "create_folder_per_manga"
+
const val numberOfBackups = "backup_slots"
const val backupInterval = "backup_interval"
diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
index 0768487ba..dbe8cb831 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt
@@ -203,6 +203,8 @@ class PreferencesHelper(val context: Context) {
fun downloadOnlyOverWifi() = prefs.getBoolean(Keys.downloadOnlyOverWifi, true)
+ fun folderPerManga() = prefs.getBoolean(Keys.folderPerManga, false)
+
fun numberOfBackups() = flowPrefs.getInt(Keys.numberOfBackups, 1)
fun backupInterval() = flowPrefs.getInt(Keys.backupInterval, 0)
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt
index 6a20fe2ee..a26a34382 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt
@@ -556,11 +556,14 @@ class ReaderPresenter(
notifier.onClear()
// Pictures directory.
- val destDir = File(
- Environment.getExternalStorageDirectory().absolutePath +
+ val baseDir = Environment.getExternalStorageDirectory().absolutePath +
File.separator + Environment.DIRECTORY_PICTURES +
File.separator + context.getString(R.string.app_name)
- )
+ val destDir = if (preferences.folderPerManga()) {
+ File(baseDir + File.separator + manga.title)
+ } else {
+ File(baseDir)
+ }
// Copy file in background.
Observable.fromCallable { saveImage(page, destDir, manga) }
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt
index 48b0eee93..983557119 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt
@@ -27,6 +27,7 @@ import eu.kanade.tachiyomi.util.preference.preference
import eu.kanade.tachiyomi.util.preference.preferenceCategory
import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.titleRes
+import eu.kanade.tachiyomi.util.preference.summaryRes
import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.widget.materialdialogs.QuadStateCheckBox
import eu.kanade.tachiyomi.widget.materialdialogs.listItemsQuadStateMultiChoice
@@ -66,6 +67,12 @@ class SettingsDownloadController : SettingsController() {
titleRes = R.string.pref_download_only_over_wifi
defaultValue = true
}
+ switchPreference {
+ key = Keys.folderPerManga
+ titleRes = R.string.pref_create_folder_per_manga
+ summaryRes = R.string.pref_create_folder_per_manga_summary
+ defaultValue = false
+ }
preferenceCategory {
titleRes = R.string.pref_category_delete_chapters
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 786ebbea8..da7b08ca3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -367,6 +367,8 @@
Auto-download
Download new chapters
Manga in excluded categories will not be downloaded even if they are also in included categories.
+ Saves pages into separate folders
+ Creates folders according to manga title
Update chapter progress after reading