mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 20:19:05 +01:00
Performance improvements for library filters
This commit is contained in:
@@ -378,17 +378,21 @@ public class DownloadManager {
|
||||
savePageList(download.source, download.manga, download.chapter, download.pages);
|
||||
}
|
||||
|
||||
// Get the absolute path to the chapter directory
|
||||
public File getAbsoluteChapterDirectory(Source source, Manga manga, Chapter chapter) {
|
||||
public File getAbsoluteMangaDirectory(Source source, Manga manga) {
|
||||
String chapterRelativePath = source.getName() +
|
||||
File.separator +
|
||||
manga.title.replaceAll("[^\\sa-zA-Z0-9.-]", "_") +
|
||||
File.separator +
|
||||
chapter.name.replaceAll("[^\\sa-zA-Z0-9.-]", "_");
|
||||
manga.title.replaceAll("[^\\sa-zA-Z0-9.-]", "_");
|
||||
|
||||
return new File(preferences.getDownloadsDirectory(), chapterRelativePath);
|
||||
}
|
||||
|
||||
// Get the absolute path to the chapter directory
|
||||
public File getAbsoluteChapterDirectory(Source source, Manga manga, Chapter chapter) {
|
||||
String chapterRelativePath = chapter.name.replaceAll("[^\\sa-zA-Z0-9.-]", "_");
|
||||
|
||||
return new File(getAbsoluteMangaDirectory(source, manga), chapterRelativePath);
|
||||
}
|
||||
|
||||
// Shortcut for the method above
|
||||
private File getAbsoluteChapterDirectory(Download download) {
|
||||
return getAbsoluteChapterDirectory(download.source, download.manga, download.chapter);
|
||||
|
||||
@@ -11,6 +11,10 @@ import eu.kanade.tachiyomi.data.source.base.Source
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
||||
fun <T> Preference<T>.getOrDefault(): T {
|
||||
return get() ?: defaultValue()!!
|
||||
}
|
||||
|
||||
class PreferencesHelper(private val context: Context) {
|
||||
|
||||
private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
Reference in New Issue
Block a user