diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index 7846ff7ae..d4b80ad65 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit class DownloadCache(private val context: Context, private val provider: DownloadProvider, private val sourceManager: SourceManager = Injekt.get(), - preferences: PreferencesHelper = Injekt.get()) { + private val preferences: PreferencesHelper = Injekt.get()) { /** * The interval after which this cache should be invalidated. 1 hour shouldn't cause major @@ -42,24 +42,23 @@ class DownloadCache(private val context: Context, /** * The root directory for downloads. */ - private var rootDir = setRootDir(preferences.downloadsDirectory().getOrDefault()) + private var rootDir = RootDirectory(getDirectoryFromPreference()) init { - setRootDir(preferences.downloadsDirectory().getOrDefault()) preferences.downloadsDirectory().asObservable() .skip(1) - .subscribe { setRootDir(it) } + .subscribe { + lastRenew = 0L // invalidate cache + rootDir = RootDirectory(getDirectoryFromPreference()) + } } /** - * Sets the root downloads directory and invalidates the cache. - * - * @param directory the downloads directory in [Uri] format. + * Returns the downloads directory from the user's preferences. */ - private fun setRootDir(directory: String): RootDirectory { - rootDir = RootDirectory(UniFile.fromUri(context, Uri.parse(directory))) - lastRenew = 0L - return rootDir + private fun getDirectoryFromPreference(): UniFile { + val dir = preferences.downloadsDirectory().getOrDefault() + return UniFile.fromUri(context, Uri.parse(dir)) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index a670a54c3..99c4fa897 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -429,7 +429,7 @@ class LibraryController( presenter.onOpenManga() router.pushController(RouterTransaction.with(MangaController(manga)) - .pushChangeHandler(FadeChangeHandler()) + .pushChangeHandler(FadeChangeHandler(false)) .popChangeHandler(FadeChangeHandler())) } diff --git a/app/src/main/res/layout/chapters_controller.xml b/app/src/main/res/layout/chapters_controller.xml index f3f521de9..2f2d19d56 100644 --- a/app/src/main/res/layout/chapters_controller.xml +++ b/app/src/main/res/layout/chapters_controller.xml @@ -1,11 +1,11 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> \ No newline at end of file + android:layout_height="match_parent" + android:background="?android:attr/colorBackground" /> \ No newline at end of file