mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
chore: Move stuff around
Stuff that's not needed by compose controllers
This commit is contained in:
parent
5f1ab7b8b2
commit
1e4205a793
3 changed files with 51 additions and 42 deletions
|
@ -7,15 +7,11 @@ import eu.kanade.tachiyomi.ui.base.controller.BaseComposeController
|
|||
class ExtensionRepoController :
|
||||
BaseComposeController() {
|
||||
|
||||
override fun getTitle(): String {
|
||||
return "Extension Repos"
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
override fun ScreenContent() {
|
||||
ExtensionRepoScreen(
|
||||
title = getTitle(),
|
||||
title = "Extension Repos",
|
||||
onBackPress = router::handleBack,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -61,9 +61,7 @@ abstract class BaseController(bundle: Bundle? = null) :
|
|||
open fun onViewCreated(view: View) { }
|
||||
|
||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||
if (type.isEnter && isControllerVisible) {
|
||||
setTitle()
|
||||
} else if (type.isEnter) {
|
||||
if (type.isEnter) {
|
||||
view?.alpha = 0f
|
||||
} else {
|
||||
removeQueryListener()
|
||||
|
@ -72,18 +70,6 @@ abstract class BaseController(bundle: Bundle? = null) :
|
|||
super.onChangeStarted(handler, type)
|
||||
}
|
||||
|
||||
open fun getTitle(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
open fun getSearchTitle(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
open fun getBigIcon(): Drawable? {
|
||||
return null
|
||||
}
|
||||
|
||||
open fun canStillGoBack(): Boolean { return false }
|
||||
|
||||
open val mainRecycler: RecyclerView?
|
||||
|
@ -94,28 +80,6 @@ abstract class BaseController(bundle: Bundle? = null) :
|
|||
removeQueryListener(false)
|
||||
}
|
||||
|
||||
fun setTitle() {
|
||||
var parentController = parentController
|
||||
while (parentController != null) {
|
||||
if (parentController is BaseController && parentController.getTitle() != null) {
|
||||
return
|
||||
}
|
||||
parentController = parentController.parentController
|
||||
}
|
||||
|
||||
if (isControllerVisible) {
|
||||
(activity as? AppCompatActivity)?.title = getTitle()
|
||||
(activity as? MainActivity)?.searchTitle = getSearchTitle()
|
||||
val icon = getBigIcon()
|
||||
activityBinding?.bigIconLayout?.isVisible = icon != null
|
||||
if (icon != null) {
|
||||
activityBinding?.bigIcon?.setImageDrawable(getBigIcon())
|
||||
} else {
|
||||
activityBinding?.bigIcon?.setImageDrawable(getBigIcon())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Controller.instance(): String {
|
||||
return "${javaClass.simpleName}@${Integer.toHexString(hashCode())}"
|
||||
}
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
package eu.kanade.tachiyomi.ui.base.controller
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.view.activityBinding
|
||||
import eu.kanade.tachiyomi.util.view.backgroundColor
|
||||
import eu.kanade.tachiyomi.util.view.isControllerVisible
|
||||
|
||||
abstract class BaseLegacyController<VB : ViewBinding>(bundle: Bundle? = null) :
|
||||
BaseController(bundle) {
|
||||
|
@ -22,5 +30,46 @@ abstract class BaseLegacyController<VB : ViewBinding>(bundle: Bundle? = null) :
|
|||
return binding.root
|
||||
}
|
||||
|
||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||
if (type.isEnter && isControllerVisible) {
|
||||
setTitle()
|
||||
}
|
||||
super.onChangeStarted(handler, type)
|
||||
}
|
||||
|
||||
abstract fun createBinding(inflater: LayoutInflater): VB
|
||||
|
||||
open fun getTitle(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
open fun getSearchTitle(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
open fun getBigIcon(): Drawable? {
|
||||
return null
|
||||
}
|
||||
|
||||
fun setTitle() {
|
||||
var parentController = parentController
|
||||
while (parentController != null) {
|
||||
if (parentController is BaseLegacyController<*> && parentController.getTitle() != null) {
|
||||
return
|
||||
}
|
||||
parentController = parentController.parentController
|
||||
}
|
||||
|
||||
if (isControllerVisible) {
|
||||
(activity as? AppCompatActivity)?.title = getTitle()
|
||||
(activity as? MainActivity)?.searchTitle = getSearchTitle()
|
||||
val icon = getBigIcon()
|
||||
activityBinding?.bigIconLayout?.isVisible = icon != null
|
||||
if (icon != null) {
|
||||
activityBinding?.bigIcon?.setImageDrawable(getBigIcon())
|
||||
} else {
|
||||
activityBinding?.bigIcon?.setImageDrawable(getBigIcon())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue