Clean up controller viewbinding creation
Based on https://github.com/Jays2Kings/tachiyomiJ2K/blob/master/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/BaseController.kt (cherry picked from commit cab919d74c2a00fd450c915a4d7fddc29c44927e) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt
This commit is contained in:
parent
d37b24adb1
commit
aa56698dac
@ -19,7 +19,8 @@ import timber.log.Timber
|
|||||||
abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
|
abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
|
||||||
RestoreViewOnCreateController(bundle) {
|
RestoreViewOnCreateController(bundle) {
|
||||||
|
|
||||||
lateinit var binding: VB
|
protected lateinit var binding: VB
|
||||||
|
private set
|
||||||
|
|
||||||
lateinit var viewScope: CoroutineScope
|
lateinit var viewScope: CoroutineScope
|
||||||
|
|
||||||
@ -51,11 +52,12 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedViewState: Bundle?): View {
|
abstract fun createBinding(inflater: LayoutInflater): VB
|
||||||
return inflateView(inflater, container)
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract fun inflateView(inflater: LayoutInflater, container: ViewGroup): View
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedViewState: Bundle?): View {
|
||||||
|
binding = createBinding(inflater)
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
|
||||||
open fun onViewCreated(view: View) {}
|
open fun onViewCreated(view: View) {}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.browse
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import com.bluelinelabs.conductor.Controller
|
import com.bluelinelabs.conductor.Controller
|
||||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||||
@ -51,10 +50,7 @@ class BrowseController :
|
|||||||
return resources!!.getString(R.string.browse)
|
return resources!!.getString(R.string.browse)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = PagerControllerBinding.inflate(inflater)
|
||||||
binding = PagerControllerBinding.inflate(inflater)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
@ -5,7 +5,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||||
@ -57,18 +56,16 @@ open class ExtensionController :
|
|||||||
return ExtensionPresenter()
|
return ExtensionPresenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = ExtensionControllerBinding.inflate(inflater)
|
||||||
binding = ExtensionControllerBinding.inflate(inflater)
|
|
||||||
|
override fun onViewCreated(view: View) {
|
||||||
|
super.onViewCreated(view)
|
||||||
|
|
||||||
binding.recycler.applyInsetter {
|
binding.recycler.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
padding()
|
padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
binding.swipeRefresh.isRefreshing = true
|
binding.swipeRefresh.isRefreshing = true
|
||||||
binding.swipeRefresh.refreshes()
|
binding.swipeRefresh.refreshes()
|
||||||
|
@ -12,7 +12,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.view.ContextThemeWrapper
|
import androidx.appcompat.view.ContextThemeWrapper
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
@ -65,15 +64,9 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater): ExtensionDetailControllerBinding {
|
||||||
val themedInflater = inflater.cloneInContext(getPreferenceThemeContext())
|
val themedInflater = inflater.cloneInContext(getPreferenceThemeContext())
|
||||||
binding = ExtensionDetailControllerBinding.inflate(themedInflater)
|
return ExtensionDetailControllerBinding.inflate(themedInflater)
|
||||||
binding.extensionPrefsRecycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createPresenter(): ExtensionDetailsPresenter {
|
override fun createPresenter(): ExtensionDetailsPresenter {
|
||||||
@ -88,6 +81,12 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.extensionPrefsRecycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val extension = presenter.extension ?: return
|
val extension = presenter.extension ?: return
|
||||||
val context = view.context
|
val context = view.context
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import android.os.Bundle
|
|||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.view.ContextThemeWrapper
|
import androidx.appcompat.view.ContextThemeWrapper
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.preference.DialogPreference
|
import androidx.preference.DialogPreference
|
||||||
@ -46,10 +45,9 @@ class SourcePreferencesController(bundle: Bundle? = null) :
|
|||||||
bundleOf(SOURCE_ID to sourceId)
|
bundleOf(SOURCE_ID to sourceId)
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater): SourcePreferencesControllerBinding {
|
||||||
val themedInflater = inflater.cloneInContext(getPreferenceThemeContext())
|
val themedInflater = inflater.cloneInContext(getPreferenceThemeContext())
|
||||||
binding = SourcePreferencesControllerBinding.inflate(themedInflater)
|
return SourcePreferencesControllerBinding.inflate(themedInflater)
|
||||||
return binding.root
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createPresenter(): SourcePreferencesPresenter {
|
override fun createPresenter(): SourcePreferencesPresenter {
|
||||||
|
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.browse.latest
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import dev.chrisbanes.insetter.applyInsetter
|
import dev.chrisbanes.insetter.applyInsetter
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
@ -32,23 +31,6 @@ open class LatestController :
|
|||||||
*/
|
*/
|
||||||
protected var adapter: LatestAdapter? = null
|
protected var adapter: LatestAdapter? = null
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiate the view with [R.layout.global_search_controller].
|
|
||||||
*
|
|
||||||
* @param inflater used to load the layout xml.
|
|
||||||
* @param container containing parent views.
|
|
||||||
* @return inflated view
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = LatestControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTitle(): String? {
|
override fun getTitle(): String? {
|
||||||
return applicationContext?.getString(R.string.latest)
|
return applicationContext?.getString(R.string.latest)
|
||||||
}
|
}
|
||||||
@ -82,6 +64,8 @@ open class LatestController :
|
|||||||
onMangaClick(manga)
|
onMangaClick(manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun createBinding(inflater: LayoutInflater): LatestControllerBinding = LatestControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the view is created
|
* Called when the view is created
|
||||||
*
|
*
|
||||||
@ -90,6 +74,12 @@ open class LatestController :
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adapter = LatestAdapter(this)
|
adapter = LatestAdapter(this)
|
||||||
|
|
||||||
// Create recycler and set adapter.
|
// Create recycler and set adapter.
|
||||||
|
@ -6,7 +6,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
@ -46,18 +45,16 @@ class PreMigrationController(bundle: Bundle? = null) :
|
|||||||
|
|
||||||
override fun getTitle() = view?.context?.getString(R.string.select_sources)
|
override fun getTitle() = view?.context?.getString(R.string.select_sources)
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = PreMigrationControllerBinding.inflate(inflater)
|
||||||
binding = PreMigrationControllerBinding.inflate(inflater)
|
|
||||||
|
override fun onViewCreated(view: View) {
|
||||||
|
super.onViewCreated(view)
|
||||||
|
|
||||||
binding.recycler.applyInsetter {
|
binding.recycler.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
padding()
|
padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
val ourAdapter = adapter ?: MigrationSourceAdapter(
|
val ourAdapter = adapter ?: MigrationSourceAdapter(
|
||||||
getEnabledSources().map { MigrationSourceItem(it, isEnabled(it.id.toString())) },
|
getEnabledSources().map { MigrationSourceItem(it, isEnabled(it.id.toString())) },
|
||||||
|
@ -8,7 +8,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
@ -84,24 +83,23 @@ class MigrationListController(bundle: Bundle? = null) :
|
|||||||
|
|
||||||
private val throttleManager = EHentaiThrottleManager()
|
private val throttleManager = EHentaiThrottleManager()
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = MigrationListControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTitle(): String {
|
override fun getTitle(): String {
|
||||||
return resources?.getString(R.string.migration) + " (${adapter?.items?.count {
|
return resources?.getString(R.string.migration) + " (${adapter?.items?.count {
|
||||||
it.manga.migrationStatus != MigrationStatus.RUNNING
|
it.manga.migrationStatus != MigrationStatus.RUNNING
|
||||||
}}/${adapter?.itemCount ?: 0})"
|
}}/${adapter?.itemCount ?: 0})"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun createBinding(inflater: LayoutInflater) = MigrationListControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setTitle()
|
setTitle()
|
||||||
val config = this.config ?: return
|
val config = this.config ?: return
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.browse.migration.manga
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import dev.chrisbanes.insetter.applyInsetter
|
import dev.chrisbanes.insetter.applyInsetter
|
||||||
@ -52,18 +51,16 @@ class MigrationMangaController :
|
|||||||
return MigrationMangaPresenter(sourceId)
|
return MigrationMangaPresenter(sourceId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = MigrationMangaControllerBinding.inflate(inflater)
|
||||||
binding = MigrationMangaControllerBinding.inflate(inflater)
|
|
||||||
|
override fun onViewCreated(view: View) {
|
||||||
|
super.onViewCreated(view)
|
||||||
|
|
||||||
binding.recycler.applyInsetter {
|
binding.recycler.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
padding()
|
padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
adapter = MigrationMangaAdapter(this)
|
adapter = MigrationMangaAdapter(this)
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
|
@ -5,7 +5,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import dev.chrisbanes.insetter.applyInsetter
|
import dev.chrisbanes.insetter.applyInsetter
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
@ -42,18 +41,16 @@ class MigrationSourcesController :
|
|||||||
return MigrationSourcesPresenter()
|
return MigrationSourcesPresenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = MigrationSourcesControllerBinding.inflate(inflater)
|
||||||
binding = MigrationSourcesControllerBinding.inflate(inflater)
|
|
||||||
|
override fun onViewCreated(view: View) {
|
||||||
|
super.onViewCreated(view)
|
||||||
|
|
||||||
binding.recycler.applyInsetter {
|
binding.recycler.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
padding()
|
padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
adapter = SourceAdapter(this)
|
adapter = SourceAdapter(this)
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
|
@ -9,7 +9,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
@ -88,25 +87,16 @@ class SourceController(bundle: Bundle? = null) :
|
|||||||
return SourcePresenter(/* SY --> */ controllerMode = mode /* SY <-- */)
|
return SourcePresenter(/* SY --> */ controllerMode = mode /* SY <-- */)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun createBinding(inflater: LayoutInflater) = SourceMainControllerBinding.inflate(inflater)
|
||||||
* Initiate the view with [R.layout.source_main_controller].
|
|
||||||
*
|
override fun onViewCreated(view: View) {
|
||||||
* @param inflater used to load the layout xml.
|
super.onViewCreated(view)
|
||||||
* @param container containing parent views.
|
|
||||||
* @return inflated view.
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = SourceMainControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
binding.recycler.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
padding()
|
padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
adapter = SourceAdapter(this)
|
adapter = SourceAdapter(this)
|
||||||
|
|
||||||
|
@ -159,10 +159,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
|||||||
// SY <--
|
// SY <--
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = SourceControllerBinding.inflate(inflater)
|
||||||
binding = SourceControllerBinding.inflate(inflater)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
@ -6,7 +6,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -51,22 +50,7 @@ open class GlobalSearchController(
|
|||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun createBinding(inflater: LayoutInflater) = GlobalSearchControllerBinding.inflate(inflater)
|
||||||
* Initiate the view with [R.layout.global_search_controller].
|
|
||||||
*
|
|
||||||
* @param inflater used to load the layout xml.
|
|
||||||
* @param container containing parent views.
|
|
||||||
* @return inflated view
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = GlobalSearchControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTitle(): String? {
|
override fun getTitle(): String? {
|
||||||
return presenter.query
|
return presenter.query
|
||||||
@ -143,6 +127,12 @@ open class GlobalSearchController(
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adapter = GlobalSearchAdapter(this)
|
adapter = GlobalSearchAdapter(this)
|
||||||
|
|
||||||
// Create recycler and set adapter.
|
// Create recycler and set adapter.
|
||||||
|
@ -5,7 +5,6 @@ import android.view.LayoutInflater
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -74,18 +73,6 @@ open class IndexController :
|
|||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiate the view with [R.layout.latest_controller].
|
|
||||||
*
|
|
||||||
* @param inflater used to load the layout xml.
|
|
||||||
* @param container containing parent views.
|
|
||||||
* @return inflated view
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = IndexControllerBinding.inflate(inflater)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTitle(): String? {
|
override fun getTitle(): String? {
|
||||||
return source!!.name
|
return source!!.name
|
||||||
}
|
}
|
||||||
@ -139,6 +126,8 @@ open class IndexController :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun createBinding(inflater: LayoutInflater) = IndexControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the view is created
|
* Called when the view is created
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,6 @@ import android.view.LayoutInflater
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -68,21 +67,7 @@ class CategoryController :
|
|||||||
return resources?.getString(R.string.action_edit_categories)
|
return resources?.getString(R.string.action_edit_categories)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun createBinding(inflater: LayoutInflater) = CategoriesControllerBinding.inflate(inflater)
|
||||||
* Returns the view of this controller.
|
|
||||||
*
|
|
||||||
* @param inflater The layout inflater to create the view from XML.
|
|
||||||
* @param container The parent view for this one.
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = CategoriesControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after view inflation. Used to initialize the view.
|
* Called after view inflation. Used to initialize the view.
|
||||||
@ -92,6 +77,12 @@ class CategoryController :
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adapter = CategoryAdapter(this@CategoryController)
|
adapter = CategoryAdapter(this@CategoryController)
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
binding.recycler.setHasFixedSize(true)
|
binding.recycler.setHasFixedSize(true)
|
||||||
|
@ -4,7 +4,6 @@ import android.view.LayoutInflater
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -68,21 +67,7 @@ class BiometricTimesController :
|
|||||||
return resources?.getString(R.string.biometric_lock_times)
|
return resources?.getString(R.string.biometric_lock_times)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun createBinding(inflater: LayoutInflater) = CategoriesControllerBinding.inflate(inflater)
|
||||||
* Returns the view of this controller.
|
|
||||||
*
|
|
||||||
* @param inflater The layout inflater to create the view from XML.
|
|
||||||
* @param container The parent view for this one.
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = CategoriesControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after view inflation. Used to initialize the view.
|
* Called after view inflation. Used to initialize the view.
|
||||||
@ -92,6 +77,12 @@ class BiometricTimesController :
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adapter = BiometricTimesAdapter(this@BiometricTimesController)
|
adapter = BiometricTimesAdapter(this@BiometricTimesController)
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
binding.recycler.setHasFixedSize(true)
|
binding.recycler.setHasFixedSize(true)
|
||||||
|
@ -5,7 +5,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -74,21 +73,7 @@ class SortTagController :
|
|||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun createBinding(inflater: LayoutInflater) = CategoriesControllerBinding.inflate(inflater)
|
||||||
* Returns the view of this controller.
|
|
||||||
*
|
|
||||||
* @param inflater The layout inflater to create the view from XML.
|
|
||||||
* @param container The parent view for this one.
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = CategoriesControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after view inflation. Used to initialize the view.
|
* Called after view inflation. Used to initialize the view.
|
||||||
@ -98,6 +83,12 @@ class SortTagController :
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adapter = SortTagAdapter(this@SortTagController)
|
adapter = SortTagAdapter(this@SortTagController)
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
binding.recycler.setHasFixedSize(true)
|
binding.recycler.setHasFixedSize(true)
|
||||||
|
@ -4,7 +4,6 @@ import android.view.LayoutInflater
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -65,21 +64,7 @@ class RepoController :
|
|||||||
return resources?.getString(R.string.action_edit_repos)
|
return resources?.getString(R.string.action_edit_repos)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun createBinding(inflater: LayoutInflater) = CategoriesControllerBinding.inflate(inflater)
|
||||||
* Returns the view of this controller.
|
|
||||||
*
|
|
||||||
* @param inflater The layout inflater to create the view from XML.
|
|
||||||
* @param container The parent view for this one.
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = CategoriesControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after view inflation. Used to initialize the view.
|
* Called after view inflation. Used to initialize the view.
|
||||||
@ -89,6 +74,12 @@ class RepoController :
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adapter = RepoAdapter(this@RepoController)
|
adapter = RepoAdapter(this@RepoController)
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
binding.recycler.setHasFixedSize(true)
|
binding.recycler.setHasFixedSize(true)
|
||||||
|
@ -4,7 +4,6 @@ import android.view.LayoutInflater
|
|||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -66,21 +65,7 @@ class SourceCategoryController :
|
|||||||
return resources?.getString(R.string.action_edit_categories)
|
return resources?.getString(R.string.action_edit_categories)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun createBinding(inflater: LayoutInflater) = CategoriesControllerBinding.inflate(inflater)
|
||||||
* Returns the view of this controller.
|
|
||||||
*
|
|
||||||
* @param inflater The layout inflater to create the view from XML.
|
|
||||||
* @param container The parent view for this one.
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = CategoriesControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after view inflation. Used to initialize the view.
|
* Called after view inflation. Used to initialize the view.
|
||||||
@ -90,6 +75,12 @@ class SourceCategoryController :
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adapter = SourceCategoryAdapter(this@SourceCategoryController)
|
adapter = SourceCategoryAdapter(this@SourceCategoryController)
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
binding.recycler.setHasFixedSize(true)
|
binding.recycler.setHasFixedSize(true)
|
||||||
|
@ -5,7 +5,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
@ -55,15 +54,7 @@ class DownloadController :
|
|||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = DownloadControllerBinding.inflate(inflater)
|
||||||
binding = DownloadControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createPresenter(): DownloadPresenter {
|
override fun createPresenter(): DownloadPresenter {
|
||||||
return DownloadPresenter()
|
return DownloadPresenter()
|
||||||
@ -76,6 +67,12 @@ class DownloadController :
|
|||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if download queue is empty and update information accordingly.
|
// Check if download queue is empty and update information accordingly.
|
||||||
setInformationView()
|
setInformationView()
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
@ -194,18 +193,16 @@ class LibraryController(
|
|||||||
return LibraryPresenter()
|
return LibraryPresenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = LibraryControllerBinding.inflate(inflater)
|
||||||
binding = LibraryControllerBinding.inflate(inflater)
|
|
||||||
|
override fun onViewCreated(view: View) {
|
||||||
|
super.onViewCreated(view)
|
||||||
|
|
||||||
binding.actionToolbar.applyInsetter {
|
binding.actionToolbar.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
margin(bottom = true)
|
margin(bottom = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
adapter = LibraryAdapter(this)
|
adapter = LibraryAdapter(this)
|
||||||
binding.libraryPager.adapter = adapter
|
binding.libraryPager.adapter = adapter
|
||||||
|
@ -17,7 +17,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.animation.DecelerateInterpolator
|
import android.view.animation.DecelerateInterpolator
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
@ -276,8 +275,11 @@ class MangaController :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = MangaControllerBinding.inflate(inflater)
|
||||||
binding = MangaControllerBinding.inflate(inflater)
|
|
||||||
|
override fun onViewCreated(view: View) {
|
||||||
|
super.onViewCreated(view)
|
||||||
|
|
||||||
binding.recycler.applyInsetter {
|
binding.recycler.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
padding()
|
padding()
|
||||||
@ -288,11 +290,6 @@ class MangaController :
|
|||||||
margin(bottom = true)
|
margin(bottom = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
if (manga == null || source == null) return
|
if (manga == null || source == null) return
|
||||||
val adapters: MutableList<RecyclerView.Adapter<out RecyclerView.ViewHolder>?> = mutableListOf()
|
val adapters: MutableList<RecyclerView.Adapter<out RecyclerView.ViewHolder>?> = mutableListOf()
|
||||||
|
@ -7,7 +7,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
@ -72,18 +71,16 @@ class HistoryController :
|
|||||||
return HistoryPresenter()
|
return HistoryPresenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = HistoryControllerBinding.inflate(inflater)
|
||||||
binding = HistoryControllerBinding.inflate(inflater)
|
|
||||||
|
override fun onViewCreated(view: View) {
|
||||||
|
super.onViewCreated(view)
|
||||||
|
|
||||||
binding.recycler.applyInsetter {
|
binding.recycler.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
padding()
|
padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
|
|
||||||
// Initialize adapter
|
// Initialize adapter
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
|
@ -5,7 +5,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@ -71,8 +70,10 @@ class UpdatesController :
|
|||||||
return UpdatesPresenter()
|
return UpdatesPresenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun createBinding(inflater: LayoutInflater) = UpdatesControllerBinding.inflate(inflater)
|
||||||
binding = UpdatesControllerBinding.inflate(inflater)
|
|
||||||
|
override fun onViewCreated(view: View) {
|
||||||
|
super.onViewCreated(view)
|
||||||
binding.recycler.applyInsetter {
|
binding.recycler.applyInsetter {
|
||||||
type(navigationBars = true) {
|
type(navigationBars = true) {
|
||||||
padding()
|
padding()
|
||||||
@ -83,11 +84,7 @@ class UpdatesController :
|
|||||||
margin(bottom = true)
|
margin(bottom = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
|
||||||
super.onViewCreated(view)
|
|
||||||
view.context.notificationManager.cancel(Notifications.ID_NEW_CHAPTERS)
|
view.context.notificationManager.cancel(Notifications.ID_NEW_CHAPTERS)
|
||||||
|
|
||||||
// Init RecyclerView and adapter
|
// Init RecyclerView and adapter
|
||||||
|
@ -6,7 +6,6 @@ import android.view.Menu
|
|||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
@ -33,17 +32,7 @@ class SettingsSearchController :
|
|||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
override fun createBinding(inflater: LayoutInflater) = SettingsSearchControllerBinding.inflate(inflater)
|
||||||
* Initiate the view with [R.layout.settings_search_controller].
|
|
||||||
*
|
|
||||||
* @param inflater used to load the layout xml.
|
|
||||||
* @param container containing parent views.
|
|
||||||
* @return inflated view
|
|
||||||
*/
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = SettingsSearchControllerBinding.inflate(inflater)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTitle(): String? {
|
override fun getTitle(): String? {
|
||||||
return presenter.query
|
return presenter.query
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
package exh.ui.base
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.annotation.LayoutRes
|
|
||||||
import androidx.viewbinding.ViewBinding
|
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
import kotlinx.coroutines.cancel
|
|
||||||
import kotlin.coroutines.CoroutineContext
|
|
||||||
|
|
||||||
abstract class BaseExhController<VB : ViewBinding>(bundle: Bundle? = null) : BaseController<VB>(bundle), CoroutineScope {
|
|
||||||
abstract val layoutId: Int
|
|
||||||
@LayoutRes get
|
|
||||||
|
|
||||||
override val coroutineContext: CoroutineContext = Job() + Dispatchers.Default
|
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
return inflater.inflate(layoutId, container, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
|
|
||||||
cancel()
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,6 @@ package exh.ui.batchadd
|
|||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
@ -20,85 +19,80 @@ import rx.subscriptions.CompositeSubscription
|
|||||||
* Batch add screen
|
* Batch add screen
|
||||||
*/
|
*/
|
||||||
class BatchAddController : NucleusController<EhFragmentBatchAddBinding, BatchAddPresenter>() {
|
class BatchAddController : NucleusController<EhFragmentBatchAddBinding, BatchAddPresenter>() {
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = EhFragmentBatchAddBinding.inflate(inflater)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTitle() = activity!!.getString(R.string.batch_add)
|
override fun getTitle() = activity!!.getString(R.string.batch_add)
|
||||||
|
|
||||||
override fun createPresenter() = BatchAddPresenter()
|
override fun createPresenter() = BatchAddPresenter()
|
||||||
|
|
||||||
|
override fun createBinding(inflater: LayoutInflater) = EhFragmentBatchAddBinding.inflate(inflater)
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
with(view) {
|
binding.btnAddGalleries.clicks()
|
||||||
binding.btnAddGalleries.clicks()
|
.onEach {
|
||||||
.onEach {
|
addGalleries(binding.galleriesBox.text.toString())
|
||||||
addGalleries(binding.galleriesBox.text.toString())
|
}
|
||||||
|
.launchIn(viewScope)
|
||||||
|
|
||||||
|
binding.progressDismissBtn.clicks()
|
||||||
|
.onEach {
|
||||||
|
presenter.currentlyAddingRelay.call(BatchAddPresenter.STATE_PROGRESS_TO_INPUT)
|
||||||
|
}
|
||||||
|
.launchIn(viewScope)
|
||||||
|
|
||||||
|
val progressSubscriptions = CompositeSubscription()
|
||||||
|
|
||||||
|
presenter.currentlyAddingRelay
|
||||||
|
.onBackpressureBuffer()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeUntilDestroy {
|
||||||
|
progressSubscriptions.clear()
|
||||||
|
if (it == BatchAddPresenter.STATE_INPUT_TO_PROGRESS) {
|
||||||
|
showProgress(binding)
|
||||||
|
progressSubscriptions += presenter.progressRelay
|
||||||
|
.onBackpressureBuffer()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.combineLatest(presenter.progressTotalRelay) { progress, total ->
|
||||||
|
// Show hide dismiss button
|
||||||
|
binding.progressDismissBtn.visibility =
|
||||||
|
if (progress == total) {
|
||||||
|
View.VISIBLE
|
||||||
|
} else {
|
||||||
|
View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
formatProgress(progress, total)
|
||||||
|
}.subscribeUntilDestroy {
|
||||||
|
binding.progressText.text = it
|
||||||
|
}
|
||||||
|
|
||||||
|
progressSubscriptions += presenter.progressTotalRelay
|
||||||
|
.onBackpressureBuffer()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeUntilDestroy {
|
||||||
|
binding.progressBar.max = it
|
||||||
|
}
|
||||||
|
|
||||||
|
progressSubscriptions += presenter.progressRelay
|
||||||
|
.onBackpressureBuffer()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeUntilDestroy {
|
||||||
|
binding.progressBar.progress = it
|
||||||
|
}
|
||||||
|
|
||||||
|
presenter.eventRelay
|
||||||
|
?.onBackpressureBuffer()
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
?.subscribeUntilDestroy {
|
||||||
|
binding.progressLog.append("$it\n")
|
||||||
|
}?.let {
|
||||||
|
progressSubscriptions += it
|
||||||
|
}
|
||||||
|
} else if (it == BatchAddPresenter.STATE_PROGRESS_TO_INPUT) {
|
||||||
|
hideProgress(binding)
|
||||||
|
presenter.currentlyAddingRelay.call(BatchAddPresenter.STATE_IDLE)
|
||||||
}
|
}
|
||||||
.launchIn(viewScope)
|
}
|
||||||
|
|
||||||
binding.progressDismissBtn.clicks()
|
|
||||||
.onEach {
|
|
||||||
presenter.currentlyAddingRelay.call(BatchAddPresenter.STATE_PROGRESS_TO_INPUT)
|
|
||||||
}
|
|
||||||
.launchIn(viewScope)
|
|
||||||
|
|
||||||
val progressSubscriptions = CompositeSubscription()
|
|
||||||
|
|
||||||
presenter.currentlyAddingRelay
|
|
||||||
.onBackpressureBuffer()
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribeUntilDestroy {
|
|
||||||
progressSubscriptions.clear()
|
|
||||||
if (it == BatchAddPresenter.STATE_INPUT_TO_PROGRESS) {
|
|
||||||
showProgress(binding)
|
|
||||||
progressSubscriptions += presenter.progressRelay
|
|
||||||
.onBackpressureBuffer()
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.combineLatest(presenter.progressTotalRelay) { progress, total ->
|
|
||||||
// Show hide dismiss button
|
|
||||||
binding.progressDismissBtn.visibility =
|
|
||||||
if (progress == total) {
|
|
||||||
View.VISIBLE
|
|
||||||
} else {
|
|
||||||
View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
formatProgress(progress, total)
|
|
||||||
}.subscribeUntilDestroy {
|
|
||||||
binding.progressText.text = it
|
|
||||||
}
|
|
||||||
|
|
||||||
progressSubscriptions += presenter.progressTotalRelay
|
|
||||||
.onBackpressureBuffer()
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribeUntilDestroy {
|
|
||||||
binding.progressBar.max = it
|
|
||||||
}
|
|
||||||
|
|
||||||
progressSubscriptions += presenter.progressRelay
|
|
||||||
.onBackpressureBuffer()
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribeUntilDestroy {
|
|
||||||
binding.progressBar.progress = it
|
|
||||||
}
|
|
||||||
|
|
||||||
presenter.eventRelay
|
|
||||||
?.onBackpressureBuffer()
|
|
||||||
?.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
?.subscribeUntilDestroy {
|
|
||||||
binding.progressLog.append("$it\n")
|
|
||||||
}?.let {
|
|
||||||
progressSubscriptions += it
|
|
||||||
}
|
|
||||||
} else if (it == BatchAddPresenter.STATE_PROGRESS_TO_INPUT) {
|
|
||||||
hideProgress(binding)
|
|
||||||
presenter.currentlyAddingRelay.call(BatchAddPresenter.STATE_IDLE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val EhFragmentBatchAddBinding.progressViews
|
private val EhFragmentBatchAddBinding.progressViews
|
||||||
|
@ -3,7 +3,6 @@ package exh.ui.metadata
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import dev.chrisbanes.insetter.applyInsetter
|
import dev.chrisbanes.insetter.applyInsetter
|
||||||
@ -50,16 +49,6 @@ class MetadataViewController : NucleusController<MetadataViewControllerBinding,
|
|||||||
return manga?.title
|
return manga?.title
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = MetadataViewControllerBinding.inflate(inflater)
|
|
||||||
binding.recycler.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createPresenter(): MetadataViewPresenter {
|
override fun createPresenter(): MetadataViewPresenter {
|
||||||
return MetadataViewPresenter(
|
return MetadataViewPresenter(
|
||||||
manga!!,
|
manga!!,
|
||||||
@ -67,9 +56,17 @@ class MetadataViewController : NucleusController<MetadataViewControllerBinding,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun createBinding(inflater: LayoutInflater) = MetadataViewControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
binding.recycler.applyInsetter {
|
||||||
|
type(navigationBars = true) {
|
||||||
|
padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (manga == null || source == null) return
|
if (manga == null || source == null) return
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context, LinearLayoutManager.VERTICAL, false)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context, LinearLayoutManager.VERTICAL, false)
|
||||||
adapter = MetadataViewAdapter(data)
|
adapter = MetadataViewAdapter(data)
|
||||||
|
@ -3,7 +3,6 @@ package exh.ui.smartsearch
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
|
||||||
import eu.kanade.tachiyomi.databinding.EhSmartSearchBinding
|
import eu.kanade.tachiyomi.databinding.EhSmartSearchBinding
|
||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
@ -28,15 +27,12 @@ class SmartSearchController(bundle: Bundle? = null) : NucleusController<EhSmartS
|
|||||||
ARG_SMART_SEARCH_CONFIG
|
ARG_SMART_SEARCH_CONFIG
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
|
||||||
binding = EhSmartSearchBinding.inflate(inflater)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTitle() = source?.name.orEmpty()
|
override fun getTitle() = source?.name.orEmpty()
|
||||||
|
|
||||||
override fun createPresenter() = SmartSearchPresenter(source!!, smartSearchConfig!!)
|
override fun createPresenter() = SmartSearchPresenter(source!!, smartSearchConfig!!)
|
||||||
|
|
||||||
|
override fun createBinding(inflater: LayoutInflater) = EhSmartSearchBinding.inflate(inflater)
|
||||||
|
|
||||||
override fun onViewCreated(view: View) {
|
override fun onViewCreated(view: View) {
|
||||||
super.onViewCreated(view)
|
super.onViewCreated(view)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user