Relay extension changes to sources controller (fixes #3002)

This commit is contained in:
arkon 2020-05-01 19:17:37 -04:00
parent cae90ddd08
commit f07fbcc196
3 changed files with 12 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.support.RouterPagerAdapter
import com.google.android.material.badge.BadgeDrawable
import com.google.android.material.tabs.TabLayout
import com.jakewharton.rxrelay.PublishRelay
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.databinding.PagerControllerBinding
@ -41,6 +42,8 @@ class BrowseController :
private val toExtensions = args.getBoolean(TO_EXTENSIONS_EXTRA, false)
val extensionListUpdateRelay: PublishRelay<Boolean> = PublishRelay.create()
private var adapter: BrowseAdapter? = null
override fun getTitle(): String? {

View File

@ -181,7 +181,9 @@ open class ExtensionController :
drawExtensions()
// Update badge on parent controller tab
(parentController as BrowseController).setExtensionUpdateBadge()
val ctrl = parentController as BrowseController
ctrl.setExtensionUpdateBadge()
ctrl.extensionListUpdateRelay.call(true)
}
private fun drawExtensions() {

View File

@ -92,6 +92,12 @@ class SourceController :
adapter?.fastScroller = binding.fastScroller
requestPermissionsSafe(arrayOf(WRITE_EXTERNAL_STORAGE), 301)
// Update list on extension changes (e.g. new installation)
(parentController as BrowseController).extensionListUpdateRelay
.subscribeUntilDestroy {
presenter.updateSources()
}
}
override fun onDestroyView(view: View) {