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
|
if (state == BottomSheetBehavior.STATE_COLLAPSED) 1f else 0f
|
||||||
showingExtenions = state == BottomSheetBehavior.STATE_EXPANDED
|
showingExtenions = state == BottomSheetBehavior.STATE_EXPANDED
|
||||||
setTitle()
|
setTitle()
|
||||||
|
if (state == BottomSheetBehavior.STATE_EXPANDED)
|
||||||
|
ext_bottom_sheet.fetchOnlineExtensionsIfNeeded()
|
||||||
|
else ext_bottom_sheet.shouldCallApi = true
|
||||||
activity?.invalidateOptionsMenu()
|
activity?.invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +180,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
|||||||
|
|
||||||
fun showExtensions() {
|
fun showExtensions() {
|
||||||
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
||||||
|
ext_bottom_sheet.fetchOnlineExtensionsIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toggleExtensions() {
|
fun toggleExtensions() {
|
||||||
@ -184,6 +188,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
|||||||
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||||
} else {
|
} else {
|
||||||
ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
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>()
|
private var currentDownloads = hashMapOf<String, InstallStep>()
|
||||||
|
|
||||||
fun onCreate() {
|
fun onCreate() {
|
||||||
extensionManager.findAvailableExtensions()
|
// extensionManager.findAvailableExtensions()
|
||||||
bindToExtensionsObservable()
|
bindToExtensionsObservable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,9 @@ ExtensionAdapter.OnButtonClickListener,
|
|||||||
ExtensionTrustDialog.Listener {
|
ExtensionTrustDialog.Listener {
|
||||||
|
|
||||||
var sheetBehavior: BottomSheetBehavior<*>? = null
|
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.
|
* Adapter containing the list of manga from the catalogue.
|
||||||
@ -71,6 +73,7 @@ ExtensionAdapter.OnButtonClickListener,
|
|||||||
sheet_layout.setOnClickListener {
|
sheet_layout.setOnClickListener {
|
||||||
if (sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) {
|
if (sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) {
|
||||||
sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
|
||||||
|
fetchOnlineExtensionsIfNeeded()
|
||||||
} else {
|
} else {
|
||||||
sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||||
}
|
}
|
||||||
@ -78,6 +81,13 @@ ExtensionAdapter.OnButtonClickListener,
|
|||||||
presenter.getExtensionUpdateCount()
|
presenter.getExtensionUpdateCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun fetchOnlineExtensionsIfNeeded() {
|
||||||
|
if (shouldCallApi) {
|
||||||
|
presenter.findAvailableExtensions()
|
||||||
|
shouldCallApi = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun updateExtTitle() {
|
fun updateExtTitle() {
|
||||||
val extCount = presenter.getExtensionUpdateCount()
|
val extCount = presenter.getExtensionUpdateCount()
|
||||||
title_text.text = if (extCount == 0) context.getString(R.string.label_extensions)
|
title_text.text = if (extCount == 0) context.getString(R.string.label_extensions)
|
||||||
|
Loading…
Reference in New Issue
Block a user