Dynamic Colors
Utility for applying dynamic colors to application/activities.
Types
Link copied to clipboard
interface OnAppliedCallback
The interface that provides a callback method after dynamic colors have been applied.
Link copied to clipboard
interface Precondition
The interface that provides a precondition to decide if dynamic colors should be applied.
Functions
Link copied to clipboard
Applies dynamic colors to the given activity with the theme overlay designated by the theme attribute
dynamicColorThemeOverlay
.open fun applyIfAvailable(@NonNull activity: Activity, @NonNull precondition: DynamicColors.Precondition)
Applies dynamic colors to the given activity with the theme overlay designated by the theme attribute
dynamicColorThemeOverlay
according to the given precondition.Applies dynamic colors to the given activity with the given theme overlay.
Link copied to clipboard
Applies dynamic colors to all activities with the theme overlay designated by the theme attribute
dynamicColorThemeOverlay
by registering a ActivityLifecycleCallbacks to your application.open fun applyToActivitiesIfAvailable(@NonNull application: Application, @NonNull precondition: DynamicColors.Precondition)
Applies dynamic colors to all activities with the theme overlay designated by the theme attribute
dynamicColorThemeOverlay
according to the given precondition by registering a ActivityLifecycleCallbacks to your application.open fun applyToActivitiesIfAvailable(@NonNull application: Application, @NonNull dynamicColorsOptions: DynamicColorsOptions)
Applies dynamic colors to all activities based on the provided DynamicColorsOptions, by registering a ActivityLifecycleCallbacks to your application.
Applies dynamic colors to all activities with the given theme overlay by registering a to your application.
open fun applyToActivitiesIfAvailable(@NonNull application: Application, @StyleRes theme: Int, @NonNull precondition: DynamicColors.Precondition)
Applies dynamic colors to all activities with the given theme overlay according to the given precondition by registering a ActivityLifecycleCallbacks to your application.
Link copied to clipboard
Applies dynamic colors to the given activity.
open fun applyToActivityIfAvailable(@NonNull activity: Activity, @NonNull dynamicColorsOptions: DynamicColorsOptions)
Applies dynamic colors to the given activity with DynamicColorsOptions provided.
Link copied to clipboard
Returns
true
if dynamic colors are available on the current SDK level.Link copied to clipboard
Wraps the given context with the theme overlay designated by the theme attribute
dynamicColorThemeOverlay
.open fun wrapContextIfAvailable(@NonNull originalContext: Context, @NonNull dynamicColorsOptions: DynamicColorsOptions): Context
Wraps the given context with the given theme overlay provided in DynamicColorsOptions.
Wraps the given context with the given theme overlay.