mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 01:48:24 +01:00
Add help shortcut for source migration (closes #3951)
This commit is contained in:
parent
d548c690d6
commit
56c19e57a9
@ -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/"
|
||||
}
|
||||
}
|
||||
|
11
app/src/main/res/menu/source_migration.xml
Normal file
11
app/src/main/res/menu/source_migration.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_source_migration_help"
|
||||
android:icon="@drawable/ic_help_24dp"
|
||||
android:title="@string/migration_help_guide"
|
||||
app:iconTint="?attr/colorOnPrimary"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
</menu>
|
@ -621,6 +621,7 @@
|
||||
<string name="recent_manga_time">Ch. %1$s - %2$s</string>
|
||||
|
||||
<!-- Source migration screen -->
|
||||
<string name="migration_help_guide">Source migration guide</string>
|
||||
<string name="migration_info">Tap to select the source to migrate from</string>
|
||||
<string name="migration_dialog_what_to_include">Select data to include</string>
|
||||
<string name="migration_selection_prompt">Select a source to migrate from</string>
|
||||
|
Loading…
Reference in New Issue
Block a user