Relay extension changes to sources controller (fixes #3002)
This commit is contained in:
parent
cae90ddd08
commit
f07fbcc196
3 changed files with 12 additions and 1 deletions
|
@ -12,6 +12,7 @@ import com.bluelinelabs.conductor.RouterTransaction
|
||||||
import com.bluelinelabs.conductor.support.RouterPagerAdapter
|
import com.bluelinelabs.conductor.support.RouterPagerAdapter
|
||||||
import com.google.android.material.badge.BadgeDrawable
|
import com.google.android.material.badge.BadgeDrawable
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
|
import com.jakewharton.rxrelay.PublishRelay
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.databinding.PagerControllerBinding
|
import eu.kanade.tachiyomi.databinding.PagerControllerBinding
|
||||||
|
@ -41,6 +42,8 @@ class BrowseController :
|
||||||
|
|
||||||
private val toExtensions = args.getBoolean(TO_EXTENSIONS_EXTRA, false)
|
private val toExtensions = args.getBoolean(TO_EXTENSIONS_EXTRA, false)
|
||||||
|
|
||||||
|
val extensionListUpdateRelay: PublishRelay<Boolean> = PublishRelay.create()
|
||||||
|
|
||||||
private var adapter: BrowseAdapter? = null
|
private var adapter: BrowseAdapter? = null
|
||||||
|
|
||||||
override fun getTitle(): String? {
|
override fun getTitle(): String? {
|
||||||
|
|
|
@ -181,7 +181,9 @@ open class ExtensionController :
|
||||||
drawExtensions()
|
drawExtensions()
|
||||||
|
|
||||||
// Update badge on parent controller tab
|
// Update badge on parent controller tab
|
||||||
(parentController as BrowseController).setExtensionUpdateBadge()
|
val ctrl = parentController as BrowseController
|
||||||
|
ctrl.setExtensionUpdateBadge()
|
||||||
|
ctrl.extensionListUpdateRelay.call(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawExtensions() {
|
private fun drawExtensions() {
|
||||||
|
|
|
@ -92,6 +92,12 @@ class SourceController :
|
||||||
adapter?.fastScroller = binding.fastScroller
|
adapter?.fastScroller = binding.fastScroller
|
||||||
|
|
||||||
requestPermissionsSafe(arrayOf(WRITE_EXTERNAL_STORAGE), 301)
|
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) {
|
override fun onDestroyView(view: View) {
|
||||||
|
|
Reference in a new issue