DynamicColorsOptions.Builder

public static class DynamicColorsOptions.Builder
extends Object

java.lang.Object
   ↳ com.google.android.material.color.DynamicColorsOptions.Builder


Builder class for specifying options when applying dynamic colors.

Summary

Public constructors

Builder()

Public methods

DynamicColorsOptions build()
DynamicColorsOptions.Builder setContentBasedSource(Bitmap contentBasedSource)

Sets the content based source image from which to extract the seed color for the Material color palette.

DynamicColorsOptions.Builder setContentBasedSource(int contentBasedSource)

Sets the content based source color to generate Material color palette.

DynamicColorsOptions.Builder setOnAppliedCallback(DynamicColors.OnAppliedCallback onAppliedCallback)

Sets the callback method for after the dynamic colors have been applied.

DynamicColorsOptions.Builder setPrecondition(DynamicColors.Precondition precondition)

Sets the precondition that decides if dynamic colors should be applied.

DynamicColorsOptions.Builder setThemeOverlay(int themeOverlay)

Sets the resource ID of the theme overlay that provides dynamic color definition.

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

build

public DynamicColorsOptions build ()

Returns
DynamicColorsOptions

setContentBasedSource

public DynamicColorsOptions.Builder setContentBasedSource (Bitmap contentBasedSource)

Sets the content based source image from which to extract the seed color for the Material color palette. Calling this method will clear any source color previously set with #setContentBasedSource(int).

Parameters
contentBasedSource Bitmap

Returns
DynamicColorsOptions.Builder

setContentBasedSource

public DynamicColorsOptions.Builder setContentBasedSource (int contentBasedSource)

Sets the content based source color to generate Material color palette. Calling this method will clear any source bitmap previously set with #setContentBasedSource(Bitmap).

Parameters
contentBasedSource int

Returns
DynamicColorsOptions.Builder

setOnAppliedCallback

public DynamicColorsOptions.Builder setOnAppliedCallback (DynamicColors.OnAppliedCallback onAppliedCallback)

Sets the callback method for after the dynamic colors have been applied.

Parameters
onAppliedCallback DynamicColors.OnAppliedCallback

Returns
DynamicColorsOptions.Builder

setPrecondition

public DynamicColorsOptions.Builder setPrecondition (DynamicColors.Precondition precondition)

Sets the precondition that decides if dynamic colors should be applied.

Parameters
precondition DynamicColors.Precondition

Returns
DynamicColorsOptions.Builder

setThemeOverlay

public DynamicColorsOptions.Builder setThemeOverlay (int themeOverlay)

Sets the resource ID of the theme overlay that provides dynamic color definition.

Parameters
themeOverlay int

Returns
DynamicColorsOptions.Builder