mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 13:37:29 +01:00
Allow to refresh the entire library info (fixing empty covers after restoring backups). Closes #462
This commit is contained in:
@@ -101,7 +101,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
swipe_refresh.setDistanceToTriggerSync((2 * 64 * resources.displayMetrics.density).toInt())
|
||||
swipe_refresh.setOnRefreshListener {
|
||||
if (!LibraryUpdateService.isRunning(context)) {
|
||||
LibraryUpdateService.start(context, true, category)
|
||||
LibraryUpdateService.start(context, category)
|
||||
context.toast(R.string.updating_category)
|
||||
}
|
||||
// It can be a very long operation, so we disable swipe refresh and show a toast.
|
||||
|
||||
@@ -241,7 +241,7 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
||||
}
|
||||
R.id.action_library_display_mode -> swapDisplayMode()
|
||||
R.id.action_update_library -> {
|
||||
LibraryUpdateService.start(activity, true)
|
||||
LibraryUpdateService.start(activity)
|
||||
}
|
||||
R.id.action_edit_categories -> {
|
||||
val intent = CategoryActivity.newIntent(activity)
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||
import eu.kanade.tachiyomi.data.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.util.plusAssign
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
@@ -38,6 +39,8 @@ class SettingsAdvancedFragment : SettingsFragment() {
|
||||
|
||||
private val clearCookies by lazy { findPreference(getString(R.string.pref_clear_cookies_key)) }
|
||||
|
||||
private val refreshMetadata by lazy { findPreference(getString(R.string.pref_refresh_library_metadata_key)) }
|
||||
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
super.onViewCreated(view, savedState)
|
||||
|
||||
@@ -57,6 +60,11 @@ class SettingsAdvancedFragment : SettingsFragment() {
|
||||
clearDatabase()
|
||||
true
|
||||
}
|
||||
|
||||
refreshMetadata.setOnPreferenceClickListener {
|
||||
LibraryUpdateService.start(context, details = true)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearChapterCache() {
|
||||
|
||||
@@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.widget.preference.LibraryColumnsDialog
|
||||
import eu.kanade.tachiyomi.widget.preference.SimpleDialogPreference
|
||||
import net.xpece.android.support.preference.MultiSelectListPreference
|
||||
import rx.Observable
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SettingsGeneralFragment : SettingsFragment(),
|
||||
@@ -76,6 +77,15 @@ class SettingsGeneralFragment : SettingsFragment(),
|
||||
true
|
||||
}
|
||||
|
||||
updateRestriction.setOnPreferenceChangeListener { preference, newValue ->
|
||||
// Post to event looper to allow the preference to be updated.
|
||||
subscriptions += Observable.fromCallable {
|
||||
LibraryUpdateTrigger.setupTask(context)
|
||||
}.subscribeOn(AndroidSchedulers.mainThread()).subscribe()
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
val dbCategories = db.getCategories().executeAsBlocking()
|
||||
categoryUpdate.apply {
|
||||
entries = dbCategories.map { it.name }.toTypedArray()
|
||||
|
||||
Reference in New Issue
Block a user