main

square/leakcanary

Last updated at: 29/12/2023 09:38

Screen.kt

TLDR

This file defines the Screen class, which is an abstract class used for navigation purposes and creating views.

Classes

Screen

The Screen class is an abstract class used for navigation purposes. It replaces Fragments, MVP, MVC, MVVM, MVMVMVM, and other classes by providing a single class for defining screen locations and building views. It extends the Serializable interface.

createView(container: ViewGroup): View

This method is abstract and is used to create a view for the screen. It takes a ViewGroup as a parameter, which represents the container where the view will be attached. This method needs to be implemented by the derived classes.

package leakcanary.internal.navigation

import android.view.View
import android.view.ViewGroup
import java.io.Serializable

/**
 * Replaces Fragments, MVP, MVC, MVVM, MVMVMVM and everything else in just one tiny class.
 * A screen is a location to go to, and it can build a view to display.
 */
internal abstract class Screen : Serializable {

  abstract fun createView(container: ViewGroup): View
}