mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 19:55:11 +01:00
Extension api only called when bringing up the extensions sheet
This commit is contained in:
parent
09a8ec6ffa
commit
3e40105232
@ -160,6 +160,9 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
||||
if (state == BottomSheetBehavior.STATE_COLLAPSED) 1f else 0f
|
||||
showingExtenions = state == BottomSheetBehavior.STATE_EXPANDED
|
||||
setTitle()
|
||||
if (state == BottomSheetBehavior.STATE_EXPANDED)
|
||||
ext_bottom_sheet.fetchOnlineExtensionsIfNeeded()
|
||||
else ext_bottom_sheet.shouldCallApi = true
|
||||
activity?.invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
@ -177,6 +180,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
||||
|
||||
fun showExtensions() {
|
||||
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
ext_bottom_sheet.fetchOnlineExtensionsIfNeeded()
|
||||
}
|
||||
|
||||
fun toggleExtensions() {
|
||||
@ -184,6 +188,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
||||
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
} else {
|
||||
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
ext_bottom_sheet.fetchOnlineExtensionsIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ open class ExtensionBottomPresenter(
|
||||
private var currentDownloads = hashMapOf<String, InstallStep>()
|
||||
|
||||
fun onCreate() {
|
||||
extensionManager.findAvailableExtensions()
|
||||
// extensionManager.findAvailableExtensions()
|
||||
bindToExtensionsObservable()
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,9 @@ ExtensionAdapter.OnButtonClickListener,
|
||||
ExtensionTrustDialog.Listener {
|
||||
|
||||
var sheetBehavior: BottomSheetBehavior<*>? = null
|
||||
lateinit var autoCheckItem: AutoCheckItem
|
||||
private lateinit var autoCheckItem: AutoCheckItem
|
||||
|
||||
var shouldCallApi = true
|
||||
|
||||
/**
|
||||
* Adapter containing the list of manga from the catalogue.
|
||||
@ -71,6 +73,7 @@ ExtensionAdapter.OnButtonClickListener,
|
||||
sheet_layout.setOnClickListener {
|
||||
if (sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) {
|
||||
sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
fetchOnlineExtensionsIfNeeded()
|
||||
} else {
|
||||
sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
}
|
||||
@ -78,6 +81,13 @@ ExtensionAdapter.OnButtonClickListener,
|
||||
presenter.getExtensionUpdateCount()
|
||||
}
|
||||
|
||||
fun fetchOnlineExtensionsIfNeeded() {
|
||||
if (shouldCallApi) {
|
||||
presenter.findAvailableExtensions()
|
||||
shouldCallApi = false
|
||||
}
|
||||
}
|
||||
|
||||
fun updateExtTitle() {
|
||||
val extCount = presenter.getExtensionUpdateCount()
|
||||
title_text.text = if (extCount == 0) context.getString(R.string.label_extensions)
|
||||
|
Loading…
Reference in New Issue
Block a user