mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 21:58:34 +03:00
Add logging to controller lifecycle to help reproducing bugs
This commit is contained in:
parent
5efc02a238
commit
ba4807f62c
1 changed files with 22 additions and 1 deletions
|
@ -12,6 +12,7 @@ import com.bluelinelabs.conductor.ControllerChangeType
|
||||||
import com.bluelinelabs.conductor.RestoreViewOnCreateController
|
import com.bluelinelabs.conductor.RestoreViewOnCreateController
|
||||||
import kotlinx.android.extensions.LayoutContainer
|
import kotlinx.android.extensions.LayoutContainer
|
||||||
import kotlinx.android.synthetic.*
|
import kotlinx.android.synthetic.*
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateController(bundle),
|
abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateController(bundle),
|
||||||
LayoutContainer {
|
LayoutContainer {
|
||||||
|
@ -21,6 +22,22 @@ abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateContr
|
||||||
override fun postCreateView(controller: Controller, view: View) {
|
override fun postCreateView(controller: Controller, view: View) {
|
||||||
onViewCreated(view)
|
onViewCreated(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun preCreateView(controller: Controller) {
|
||||||
|
Timber.d("Create view for ${controller.instance()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun preAttach(controller: Controller, view: View) {
|
||||||
|
Timber.d("Attach view for ${controller.instance()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun preDetach(controller: Controller, view: View) {
|
||||||
|
Timber.d("Detach view for ${controller.instance()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun preDestroyView(controller: Controller, view: View) {
|
||||||
|
Timber.d("Destroy view for ${controller.instance()}")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +80,10 @@ abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateContr
|
||||||
(activity as? AppCompatActivity)?.supportActionBar?.title = getTitle()
|
(activity as? AppCompatActivity)?.supportActionBar?.title = getTitle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun Controller.instance(): String {
|
||||||
|
return "${javaClass.simpleName}@${Integer.toHexString(hashCode())}"
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workaround for disappearing menu items when collapsing an expandable item like a SearchView.
|
* Workaround for disappearing menu items when collapsing an expandable item like a SearchView.
|
||||||
* This method should be removed when fixed upstream.
|
* This method should be removed when fixed upstream.
|
||||||
|
|
Loading…
Reference in a new issue