SeasonalThemeManager

Puts SeasonalThemeOverlay over every activity of the app: snow with the Christmas palette, and the holiday greeting on the first screen opened during a holiday.

Like shake-to-report, this is application-scoped so no activity has to opt in or copy anything. When an activity resumes, a full-size ComposeView is added on top of its content view, once.

The overlay is only ever added above content that already exists. ComponentActivity.setContent reuses the content view's first child when that child is a ComposeView, so an overlay added to an activity that sets its content late (after an asynchronous startup check, for example) was taken over as the activity's own content, without the view tree owners setContent normally installs, and navigation crashed. Activities that have no content yet get the overlay after the layout that follows their setContent. A later setContentView clears the content view, and the overlay is put back on top the same way.

The overlay only draws: a Compose view with no pointer input returns false from dispatchTouchEvent, so every touch reaches the screen underneath. It is also hidden from accessibility services and cannot take focus, so it never interrupts a screen reader or keyboard.

Activities from Google Play services, Play Billing and other SDKs are left alone. They are not the app's screens, and styling them is not ours to do.

Nothing happens until install is called, normally from Application.onCreate.

Constructors

Link copied to clipboard
constructor(application: Application)

Functions

Link copied to clipboard
fun install()

Starts following the app's activities. Calling it again does nothing.

Link copied to clipboard
open override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?)
Link copied to clipboard
open override fun onActivityDestroyed(activity: Activity)
Link copied to clipboard
open override fun onActivityPaused(activity: Activity)
Link copied to clipboard
open fun onActivityPostCreated(activity: Activity, savedInstanceState: Bundle?)
Link copied to clipboard
open fun onActivityPostDestroyed(activity: Activity)
Link copied to clipboard
open fun onActivityPostPaused(activity: Activity)
Link copied to clipboard
open fun onActivityPostResumed(activity: Activity)
Link copied to clipboard
open fun onActivityPostSaveInstanceState(activity: Activity, outState: Bundle)
Link copied to clipboard
open fun onActivityPostStarted(activity: Activity)
Link copied to clipboard
open fun onActivityPostStopped(activity: Activity)
Link copied to clipboard
open fun onActivityPreCreated(activity: Activity, savedInstanceState: Bundle?)
Link copied to clipboard
open fun onActivityPreDestroyed(activity: Activity)
Link copied to clipboard
open fun onActivityPrePaused(activity: Activity)
Link copied to clipboard
open fun onActivityPreResumed(activity: Activity)
Link copied to clipboard
open fun onActivityPreSaveInstanceState(activity: Activity, outState: Bundle)
Link copied to clipboard
open fun onActivityPreStarted(activity: Activity)
Link copied to clipboard
open fun onActivityPreStopped(activity: Activity)
Link copied to clipboard
open override fun onActivityResumed(activity: Activity)
Link copied to clipboard
open override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle)
Link copied to clipboard
open override fun onActivityStarted(activity: Activity)
Link copied to clipboard
open override fun onActivityStopped(activity: Activity)
Link copied to clipboard
fun uninstall()

Stops adding the overlay to activities resumed from now on.