|
@@ -1,14 +1,19 @@
|
|
|
package eu.kanade.tachiyomi.ui.browse.migration.sources
|
|
|
|
|
|
import android.view.LayoutInflater
|
|
|
+import android.view.Menu
|
|
|
+import android.view.MenuInflater
|
|
|
+import android.view.MenuItem
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
|
|
+import eu.kanade.tachiyomi.R
|
|
|
import eu.kanade.tachiyomi.databinding.MigrationSourcesControllerBinding
|
|
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
|
|
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
|
|
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationMangaController
|
|
|
+import eu.kanade.tachiyomi.util.system.openInBrowser
|
|
|
|
|
|
class MigrationSourcesController :
|
|
|
NucleusController<MigrationSourcesControllerBinding, MigrationSourcesPresenter>(),
|
|
@@ -16,6 +21,10 @@ class MigrationSourcesController :
|
|
|
|
|
|
private var adapter: SourceAdapter? = null
|
|
|
|
|
|
+ init {
|
|
|
+ setHasOptionsMenu(true)
|
|
|
+ }
|
|
|
+
|
|
|
override fun createPresenter(): MigrationSourcesPresenter {
|
|
|
return MigrationSourcesPresenter()
|
|
|
}
|
|
@@ -39,6 +48,17 @@ class MigrationSourcesController :
|
|
|
super.onDestroyView(view)
|
|
|
}
|
|
|
|
|
|
+ override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
|
|
+ inflater.inflate(R.menu.source_migration, menu)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
|
+ when (item.itemId) {
|
|
|
+ R.id.action_source_migration_help -> activity?.openInBrowser(HELP_URL)
|
|
|
+ }
|
|
|
+ return super.onOptionsItemSelected(item)
|
|
|
+ }
|
|
|
+
|
|
|
fun setSources(sourcesWithManga: List<SourceItem>) {
|
|
|
adapter?.updateDataSet(sourcesWithManga)
|
|
|
}
|
|
@@ -49,4 +69,8 @@ class MigrationSourcesController :
|
|
|
parentController!!.router.pushController(controller.withFadeTransaction())
|
|
|
return false
|
|
|
}
|
|
|
+
|
|
|
+ companion object {
|
|
|
+ const val HELP_URL = "https://tachiyomi.org/help/guides/source-migration/"
|
|
|
+ }
|
|
|
}
|