applyToActivityIfAvailable

open fun applyToActivityIfAvailable(@NonNull activity: Activity, @NonNull colorContrastOptions: ColorContrastOptions)

Applies contrast to the given activity.

Note that this method does not guarantee the consistency of contrast throughout the app. If you want contrast to be updated automatically when a different contrast level is selected in the system, please use #applyToActivitiesIfAvailable(Application, ColorContrastOptions).

Parameters

activity

The target activity.

colorContrastOptions

The color contrast options object that specifies the theme overlay resource IDs for medium and high contrast mode.