mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Revert "Always save pages/covers in subfolders"
This reverts commit 7733c46ffc
.
This commit is contained in:
parent
fed555d69d
commit
a9840d6b4a
5 changed files with 29 additions and 7 deletions
|
@ -237,6 +237,8 @@ class PreferencesHelper(val context: Context) {
|
|||
|
||||
fun downloadOnlyOverWifi() = prefs.getBoolean(Keys.downloadOnlyOverWifi, true)
|
||||
|
||||
fun folderPerManga() = flowPrefs.getBoolean("create_folder_per_manga", false)
|
||||
|
||||
fun librarySearchSuggestion() = flowPrefs.getString(Keys.librarySearchSuggestion, "")
|
||||
|
||||
fun showLibrarySearchSuggestions() = flowPrefs.getBoolean(Keys.showLibrarySearchSuggestions, false)
|
||||
|
|
|
@ -853,12 +853,19 @@ class MangaDetailsPresenter(
|
|||
|
||||
fun saveCover(): Boolean {
|
||||
return try {
|
||||
val baseDir = Environment.getExternalStorageDirectory().absolutePath +
|
||||
File.separator + Environment.DIRECTORY_PICTURES +
|
||||
File.separator + preferences.context.getString(R.string.app_name)
|
||||
val directory =
|
||||
File(baseDir + File.separator + DiskUtil.buildValidFilename(manga.title))
|
||||
val directory = if (preferences.folderPerManga().get()) {
|
||||
val baseDir = Environment.getExternalStorageDirectory().absolutePath +
|
||||
File.separator + Environment.DIRECTORY_PICTURES +
|
||||
File.separator + preferences.context.getString(R.string.app_name)
|
||||
|
||||
File(baseDir + File.separator + DiskUtil.buildValidFilename(manga.title))
|
||||
} else {
|
||||
File(
|
||||
Environment.getExternalStorageDirectory().absolutePath +
|
||||
File.separator + Environment.DIRECTORY_PICTURES +
|
||||
File.separator + preferences.context.getString(R.string.app_name),
|
||||
)
|
||||
}
|
||||
val file = saveCover(directory)
|
||||
DiskUtil.scanMedia(preferences.context, file)
|
||||
true
|
||||
|
|
|
@ -817,8 +817,11 @@ class ReaderViewModel(
|
|||
val baseDir = Environment.getExternalStorageDirectory().absolutePath +
|
||||
File.separator + Environment.DIRECTORY_PICTURES +
|
||||
File.separator + context.getString(R.string.app_name)
|
||||
val destDir =
|
||||
val destDir = if (preferences.folderPerManga().get()) {
|
||||
File(baseDir + File.separator + DiskUtil.buildValidFilename(manga.title))
|
||||
} else {
|
||||
File(baseDir)
|
||||
}
|
||||
|
||||
// Copy file in background.
|
||||
viewModelScope.launchNonCancellable {
|
||||
|
@ -848,8 +851,11 @@ class ReaderViewModel(
|
|||
val baseDir = Environment.getExternalStorageDirectory().absolutePath +
|
||||
File.separator + Environment.DIRECTORY_PICTURES +
|
||||
File.separator + context.getString(R.string.app_name)
|
||||
val destDir =
|
||||
val destDir = if (preferences.folderPerManga().get()) {
|
||||
File(baseDir + File.separator + DiskUtil.buildValidFilename(manga.title))
|
||||
} else {
|
||||
File(baseDir)
|
||||
}
|
||||
|
||||
try {
|
||||
val file = saveImages(firstPage, secondPage, isLTR, bg, destDir, manga)
|
||||
|
|
|
@ -395,6 +395,11 @@ class SettingsReaderController : SettingsController() {
|
|||
titleRes = R.string.show_on_long_press
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
bindTo(preferences.folderPerManga())
|
||||
titleRes = R.string.save_pages_separately
|
||||
summaryRes = R.string.create_folders_by_manga_title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -502,6 +502,8 @@
|
|||
<string name="automatic_orientation">Automatic (based on orientation)</string>
|
||||
<string name="actions">Actions</string>
|
||||
<string name="show_on_long_press">Show on long press</string>
|
||||
<string name="save_pages_separately">Save pages in separate folders</string>
|
||||
<string name="create_folders_by_manga_title">Creates folders according to manga title</string>
|
||||
<string name="pref_hide_threshold">Sensitivity for hiding menu on scroll</string>
|
||||
<string name="pref_highest">Highest</string>
|
||||
<string name="pref_high">High</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue