mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 21:01:51 +01:00
exclude LocalSource in last used sources
Also fixing shortcuts for missing covers Also no longer updating shortcuts after exiting reader
This commit is contained in:
parent
4ea72c8963
commit
c5e922334c
@ -31,7 +31,6 @@ import eu.kanade.tachiyomi.util.chapter.ChapterFilter
|
||||
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
||||
import eu.kanade.tachiyomi.util.storage.DiskUtil
|
||||
import eu.kanade.tachiyomi.util.system.ImageUtil
|
||||
import eu.kanade.tachiyomi.util.manga.MangaShortcutManager
|
||||
import eu.kanade.tachiyomi.util.system.executeOnIO
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
@ -58,8 +57,7 @@ class ReaderPresenter(
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val chapterFilter: ChapterFilter = Injekt.get(),
|
||||
private val mangaShortcutManager: MangaShortcutManager = Injekt.get()
|
||||
private val chapterFilter: ChapterFilter = Injekt.get()
|
||||
) : BasePresenter<ReaderActivity>() {
|
||||
|
||||
/**
|
||||
@ -155,7 +153,6 @@ class ReaderPresenter(
|
||||
saveChapterProgress(currentChapters.currChapter)
|
||||
saveChapterHistory(currentChapters.currChapter)
|
||||
}
|
||||
mangaShortcutManager.updateShortcuts()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,6 +28,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.databinding.BrowseControllerBinding
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.LocalSource
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
||||
import eu.kanade.tachiyomi.ui.extension.SettingsExtensionsController
|
||||
@ -440,11 +441,15 @@ class BrowseController :
|
||||
*/
|
||||
private fun openCatalogue(source: CatalogueSource, controller: BrowseSourceController) {
|
||||
preferences.lastUsedCatalogueSource().set(source.id)
|
||||
if (source !is LocalSource) {
|
||||
val list = preferences.lastUsedSources().get().toMutableSet()
|
||||
list.removeAll { it.startsWith("${source.id}:") }
|
||||
list.add("${source.id}:${Date().time}")
|
||||
val sortedList = list.filter { it.split(":").size == 2 }.sortedByDescending { it.split(":").last().toLong() }
|
||||
preferences.lastUsedSources().set(sortedList.subList(0, min(sortedList.size, 2)).toSet())
|
||||
val sortedList = list.filter { it.split(":").size == 2 }
|
||||
.sortedByDescending { it.split(":").last().toLong() }
|
||||
preferences.lastUsedSources()
|
||||
.set(sortedList.subList(0, min(sortedList.size, 2)).toSet())
|
||||
}
|
||||
router.pushController(controller.withFadeTransaction())
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,10 @@ class MangaShortcutManager(
|
||||
null
|
||||
}
|
||||
|
||||
ShortcutInfo.Builder(context, "Manga-${item.id?.toString() ?: item.title}")
|
||||
ShortcutInfo.Builder(
|
||||
context,
|
||||
"Manga-${item.id?.toString() ?: item.title}"
|
||||
)
|
||||
.setShortLabel(item.title)
|
||||
.setLongLabel(item.title)
|
||||
.setIcon(
|
||||
@ -124,7 +127,12 @@ class MangaShortcutManager(
|
||||
} else {
|
||||
Icon.createWithBitmap(bitmap)
|
||||
}
|
||||
else Icon.createWithResource(context, R.drawable.ic_extension_update_24dp)
|
||||
else {
|
||||
Icon.createWithResource(
|
||||
context,
|
||||
R.drawable.sc_extensions_48dp
|
||||
)
|
||||
}
|
||||
)
|
||||
.setIntent(
|
||||
Intent(
|
||||
|
@ -3,7 +3,7 @@
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/actionBarTintColor">
|
||||
android:tint="?attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M18,2H6c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zM6,4h5v8l-2.5,-1.5L6,12V4z"/>
|
||||
|
Loading…
Reference in New Issue
Block a user