PlumberStartupInitializer.kt
TLDR
This file contains the implementation of the PlumberStartupInitializer
class. It is a class that extends the Initializer
interface and is responsible for initializing the Plumber startup process.
Classes
PlumberStartupInitializer
This class is an implementation of the Initializer<PlumberStartupInitializer>
interface. It is responsible for initializing the Plumber startup process by applying Android leak fixes to the application. The create
method is called during startup and receives a Context
object. It casts the Context
to an Application
object and applies the necessary fixes using the AndroidLeakFixes
class. The dependencies
method returns an empty list, indicating that this initializer has no dependencies.
package leakcanary
import android.app.Application
import android.content.Context
import androidx.startup.Initializer
class PlumberStartupInitializer : Initializer<PlumberStartupInitializer> {
override fun create(context: Context) = apply {
val application = context.applicationContext as Application
AndroidLeakFixes.applyFixes(application)
}
override fun dependencies() = emptyList<Class<out Initializer<*>>>()
}