Class DynamicTheme
- All Implemented Interfaces:
DynamicListener
,DynamicResolver
,DynamicProductFlavor
It must be initialized before using any activity or widget as they are heavily dependent on this class to generate colors dynamically.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
Constant values for the theme styles version. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key for the theme preference.static final int
Default accent color used by this theme if no color is supplied.static final int
Default primary color used by this theme if no color is supplied.static final int
Default dark primary color used by this theme if no color is supplied.static final int
Default primary color used by this theme if no color is supplied.static final float
Default shift amount to generate the darker color.static final int
Default text primary color used by this theme if no color is supplied.static final int
Default text secondary color used by this theme if no color is supplied.static final long
Normal delay in milliseconds for updating the views.static final long
Theme change delay in milliseconds which will be useful in some situations like changing the app theme, updating the widgets, etc.static final int
Default font scale for the theme. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDynamicListener
(DynamicListener listener) Add a dynamic listener to receive the various callbacks.attach
(DynamicListener localListener) Attach a local dynamic listener to this theme.attach
(DynamicListener localListener, LayoutInflater.Factory2 layoutInflater) Attach a local dynamic listener to this theme.void
Remove all the dynamic listeners and themes.void
Copy the supplied theme data to the clipboard and show aSnackbar
.void
copyThemeString
(Context context, String theme) Copy the supplied theme string to the clipboard and show aSnackbar
.void
deleteLocalTheme
(DynamicListener listener) Delete the supplied listener theme from the shared preferences.Generates default theme according to the current settings.int
generateErrorColor
(int primary, int secondary) Generates error color according to the supplied colors.int
generateStrokeColor
(int color) Generates stroke color according to the supplied color.int
generateSurfaceColor
(int color) Generates surface color according to the supplied color.int
generateSystemColor
(int color) Generates dark variant of the supplied color.int
generateSystemSecondaryColor
(int color) Generates tint of the supplied color.get()
Get the theme according to the current state.get
(boolean resolve) Get the theme according to the supplied parameter.Get the theme used by the application.Get the dynamic colors used by this resolver.getColors
(boolean resolve) Get the dynamic colors used by this resolver.Returns the context used by this listener.Get the default theme according to the current state.getDefault
(boolean resolve) Get the default theme according to the supplied parameter.Get the default theme used by the application.int
getDefaultBackgroundColor
(boolean night) Generates default background color according to the application theme.int
getDefaultColor
(int colorType) This method will be called to resolve the default color according to it's type.int
Returns the default contrast with color to tint the background aware views accordingly.Get the default theme used by the local context.Returns the resolver used by the dynamic theme.AppTheme<?>
This method will be called to return the dynamic app theme for this listener.Returns the saved dynamic themes currently in use or to be resumed later.Get the main thread handler.static DynamicTheme
Retrieves the singleton instance ofDynamicTheme
.Get the application listener used by this theme.getLocal()
Get the theme used by the local context.Get the local listener used by this theme.Get the local listener used by this theme.getLocalTheme
(DynamicListener listener) Returns the supplied listener theme from the shared preferences.int
Get the local theme styles version.Returns end time for the night theme.Returns start time for the night theme.Get the power manager used by the application.Class<?>
Get the preview activity used by this manager.Get the theme used by the remote elements.getRemoteTheme
(String theme) Returns the dynamic remote theme from the JSON string.int
This method will be called to get the intended theme styles version for this listener.int
getSystemContrast
(int fallback) Try to get the contrast from the system.int
getSystemThemeRes
(DynamicListener listener, AppTheme<?> theme) Returns the style resource used by the system.getTheme()
Get the dynamic theme instance used by this resolver.Returns the dynamic app theme from the JSON string.int
This method will be called to return the theme style resource for this listener.int
getThemeRes
(AppTheme<?> theme) This method will be called to return the theme style resource for this listener.Get the UI mode manager used by the application.int
Get the application theme styles version.int
getWidgetCornerRadius
(int fallback) Try to get the corner radius for the widget background from the system.getWidgetTheme
(String theme) Returns the dynamic widget theme from the JSON string.void
initialize
(DynamicListener listener, DynamicResolver dynamicResolver) Initialize this class with default values.static void
initializeInstance
(DynamicListener listener, DynamicResolver dynamicResolver) Initialize theme when application starts.Initialize remote colors according to the base colors.void
invalidTheme
(Context context) Show a invalid themeSnackbar
.boolean
Returns whether to apply the dynamic colors for this listener.boolean
Returns whether the dynamic colors are enabled for this listener.boolean
isDynamicListener
(DynamicListener listener) Checks whether a dynamic listener is already registered.boolean
isNight()
Checks for the night time.boolean
isNight
(int theme) Checks for the night time according to the supplied value.boolean
Checks for the night time according to the supplied value.boolean
isNightMode
(boolean resolve) Checks whether the night mode is enabled for this listener.boolean
Returns whether to register a shared preferences listener for this listener.boolean
Returns whether the power save mode is enabled.boolean
Returns whether the dynamic colors should be extracted from the system for this listener.boolean
Checks whether the system night mode is enabled.boolean
Returns whether the dynamic colors should be extracted from the wallpaper for this listener.void
onAutoThemeChanged
(boolean context) This method will be called when the auto theme change event occurs according to the time.void
Set the initialized instance tonull
when app terminates for better theme results when theme is changed.void
onDynamicChanged
(boolean context, boolean recreate) This method will be called when the dynamic change event occurs (like theme, locale, etc.).void
onDynamicColorsChanged
(DynamicColors colors, boolean context) This method will be called when the dynamic color change event occurs according to the wallpaper.void
onDynamicConfigurationChanged
(boolean locale, boolean fontScale, boolean orientation, boolean uiMode, boolean density) This method will be called when the dynamic configuration change event occurs (like locale, font scale, orientation, ui mode, etc.).void
onLocalDestroy
(DynamicListener listener) Set the initialized instance tonull
when local destroys for better theme results when theme is changed.void
This method will be called when the navigation bar theme has been changed.void
onPowerSaveModeChanged
(boolean powerSaveMode) This method will be called when the power save mode has been changed.void
Recreate local activity to update all the views with new theme.void
removeDynamicListener
(DynamicListener listener) Remove a dynamic listener.int
resolveAppTheme
(int theme, int night, boolean data) Resolves current theme according to the supplied implementation.int
resolveAppTheme
(String theme, String night, boolean data) Resolves current theme according to the supplied implementation.int
resolveBackgroundAware
(int backgroundAware) Resolve background aware according to the constant value.int
resolveColorType
(int colorType) Resolve color according to the color type.boolean
resolveNightTheme
(int theme, int implementation, boolean data) Resolves night theme according to the selected implementation.boolean
resolveNightTheme
(String theme, String implementation, boolean data) Resolves night theme according to the selected implementation.int
resolveSystemColor
(boolean isNight) Resolves system color according to the API level and night mode.int
Resolves the theme version according to the attached local.void
Save the local context theme in shared preferences.void
Show a theme savedSnackbar
.void
setDynamicResolver
(DynamicResolver resolver) Sets the resolver used by the dynamic theme.void
setDynamicThemeWork
(boolean enqueue) Sets the dynamic theme work to schedule auto theme event according to the time.setListener
(DynamicListener listener) Set the application listener for this theme.setLocalTheme
(int themeRes, AppTheme<?> theme) Initialize colors from the supplied local dynamic app theme.setLocalThemeRes
(int themeRes, AppTheme<?> theme) Initialize colors from the supplied local theme resource.void
setLocalVersion
(int version) Set the local theme styles version.boolean
Returns whether the navigation bar theme should be applied for the activity.void
setPreviewActivity
(Class<?> previewActivity) Sets the preview activity for this instance.setRemoteTheme
(AppTheme<?> theme) Initialize colors from the supplied remote dynamic app theme.Initialize colors from the supplied dynamic app theme.setThemeRes
(int themeRes, AppTheme<?> theme, boolean initializeRemoteColors) Initialize colors from the supplied theme resource.void
setVersion
(int version) Set the application theme styles version.void
setWallpaperColors
(boolean enable, boolean context) Sets theWallpaperManager.OnColorsChangedListener
to enable dynamic colors from the wallpaper on API 27 and above.toString()
-
Field Details
-
ADS_PREF_THEME_KEY
Key for the theme preference.- See Also:
-
DELAY_NORMAL
public static final long DELAY_NORMALNormal delay in milliseconds for updating the views.- See Also:
-
DELAY_THEME_CHANGE
public static final long DELAY_THEME_CHANGETheme change delay in milliseconds which will be useful in some situations like changing the app theme, updating the widgets, etc.- See Also:
-
COLOR_SHIFT_DARK_DEFAULT
public static final float COLOR_SHIFT_DARK_DEFAULTDefault shift amount to generate the darker color.- See Also:
-
COLOR_BACKGROUND_DEFAULT
Default primary color used by this theme if no color is supplied. -
COLOR_PRIMARY_DEFAULT
Default primary color used by this theme if no color is supplied. -
COLOR_PRIMARY_DARK_DEFAULT
Default dark primary color used by this theme if no color is supplied. -
COLOR_ACCENT_DEFAULT
Default accent color used by this theme if no color is supplied. -
COLOR_TEXT_PRIMARY_DEFAULT
Default text primary color used by this theme if no color is supplied.- See Also:
-
COLOR_TEXT_SECONDARY_DEFAULT
Default text secondary color used by this theme if no color is supplied.- See Also:
-
FONT_SCALE_DEFAULT
public static final int FONT_SCALE_DEFAULTDefault font scale for the theme.- See Also:
-
-
Method Details
-
setDynamicThemeWork
public void setDynamicThemeWork(boolean enqueue) Sets the dynamic theme work to schedule auto theme event according to the time.- Parameters:
enqueue
-true
to enqueue the dynamic theme work.
-
setWallpaperColors
public void setWallpaperColors(boolean enable, boolean context) Sets theWallpaperManager.OnColorsChangedListener
to enable dynamic colors from the wallpaper on API 27 and above. Otherwise, use the custom implementation for older API levels.- Parameters:
enable
-true
to enable wallpaper colors listener.context
-true
if there is a context change and it must be reinitialized.- See Also:
-
getInstance
Retrieves the singleton instance ofDynamicTheme
.Must be called before accessing the public methods.
- Returns:
- The singleton instance of
DynamicTheme
.
-
getHandler
Get the main thread handler.- Returns:
- The main thread handler.
-
initializeRemoteColors
Initialize remote colors according to the base colors.They can be set individually by calling the appropriate methods.
- Returns:
- The
DynamicTheme
object to allow for chaining of calls to set methods.
-
resolveBackgroundAware
public int resolveBackgroundAware(int backgroundAware) Resolve background aware according to the constant value.- Parameters:
backgroundAware
- The background aware to be resolved.- Returns:
- The resolved background aware value.
Either
Theme.BackgroundAware.ENABLE
orTheme.BackgroundAware.DISABLE
. - See Also:
-
resolveColorType
Resolve color according to the color type.- Parameters:
colorType
- The color type to be resolved.- Returns:
- The resolved color value.
- See Also:
-
getVersion
public int getVersion()Get the application theme styles version.- Returns:
- The application theme styles version.
-
setVersion
public void setVersion(int version) Set the application theme styles version.- Parameters:
version
- The version to be set.
-
getLocalVersion
public int getLocalVersion()Get the local theme styles version.- Returns:
- The local theme styles version.
-
setLocalVersion
public void setLocalVersion(int version) Set the local theme styles version.- Parameters:
version
- The version to be set.
-
resolveVersion
public int resolveVersion()Resolves the theme version according to the attached local.- Returns:
- The theme version according to the attached local.
- See Also:
-
getListener
Get the application listener used by this theme.- Returns:
- The application context used by this theme.
-
getLocalListener
Get the local listener used by this theme.- Returns:
- The local listener used by this theme.
-
getLocalContext
Get the local listener used by this theme.- Returns:
- The local listener used by this theme.
-
getUiModeManager
Get the UI mode manager used by the application.- Returns:
- The UI mode manager used by the application.
-
getPowerManager
Get the power manager used by the application.- Returns:
- The power manager used by the application.
-
isPowerSaveMode
public boolean isPowerSaveMode()Returns whether the power save mode is enabled.- Returns:
true
if the power save mode is enabled.
-
getDefaultApplication
Get the default theme used by the application.- Returns:
- The default theme used by the application.
-
getApplication
Get the theme used by the application.- Returns:
- The theme used by the application.
-
getDefaultLocal
Get the default theme used by the local context.- Returns:
- The default theme used by the local context.
-
getLocal
Get the theme used by the local context.- Returns:
- The theme used by the local context.
-
getRemote
Get the theme used by the remote elements.- Returns:
- The theme used by the remote elements.
-
getDynamicThemes
Returns the saved dynamic themes currently in use or to be resumed later.- Returns:
- The saved dynamic themes currently in use or to be resumed later.
-
getPreviewActivity
Get the preview activity used by this manager.- Returns:
- The preview activity used by this manager.
-
setPreviewActivity
Sets the preview activity for this instance.- Parameters:
previewActivity
- The preview activity class to be set.
-
get
Get the theme according to the supplied parameter.Either application theme or local theme.
- Parameters:
resolve
-true
to resolve the local theme if present.- Returns:
- The theme according to the supplied parameter.
-
get
Get the theme according to the current state.Either application theme or local theme.
- Returns:
- The theme according to the current state.
-
getDefault
Get the default theme according to the supplied parameter.Either default application theme or default local theme.
- Parameters:
resolve
-true
to resolve the default local theme if present.- Returns:
- The default theme according to the supplied parameter.
-
getDefault
Get the default theme according to the current state.Either default application theme or default local theme.
- Returns:
- The default theme according to the current state.
- See Also:
-
recreateLocal
public void recreateLocal()Recreate local activity to update all the views with new theme. -
onDestroy
public void onDestroy()Set the initialized instance tonull
when app terminates for better theme results when theme is changed. -
getDefaultBackgroundColor
Generates default background color according to the application theme.- Parameters:
night
-true
if the night mode is enabled.- Returns:
- The generated background color.
-
getSystemContrast
public int getSystemContrast(int fallback) Try to get the contrast from the system.- Parameters:
fallback
- The fallback contrast to be used in case of any issues.- Returns:
- The contrast from the system.
-
getWidgetCornerRadius
Try to get the corner radius for the widget background from the system.- Parameters:
fallback
- The fallback radius to be used in case of any issues.- Returns:
- The corner radius for the widget background from the system.
-
getDefaultContrastWith
Returns the default contrast with color to tint the background aware views accordingly.- Returns:
- The default contrast with color.
-
generateDefaultTheme
Generates default theme according to the current settings.- Returns:
- The generated default theme.
-
generateStrokeColor
Generates stroke color according to the supplied color.- Parameters:
color
- The color to generate the stroke color.- Returns:
- The generated stroke color.
-
generateSurfaceColor
Generates surface color according to the supplied color.- Parameters:
color
- The color to generate the surface color.- Returns:
- The generated surface color.
-
generateErrorColor
Generates error color according to the supplied colors.- Parameters:
primary
- The primary color to generate the error color.secondary
- The secondary color to generate the error color.- Returns:
- The generated error color.
-
generateSystemColor
Generates dark variant of the supplied color.- Parameters:
color
- The color to generate the dark variant.- Returns:
- The generated dark variant of the color.
-
generateSystemSecondaryColor
Generates tint of the supplied color.- Parameters:
color
- The color to generate the tint.- Returns:
- The generated tint of the color.
-
getDynamicResolver
Returns the resolver used by the dynamic theme.- Returns:
- The resolver used by the dynamic theme.
-
clearDynamicListeners
public void clearDynamicListeners()Remove all the dynamic listeners and themes. -
getProductFlavor
- Specified by:
getProductFlavor
in interfaceDynamicProductFlavor
-
getContext
Description copied from interface:DynamicListener
Returns the context used by this listener.- Specified by:
getContext
in interfaceDynamicListener
- Returns:
- The context used by this listener.
-
getRequiredThemeVersion
public int getRequiredThemeVersion()Description copied from interface:DynamicListener
This method will be called to get the intended theme styles version for this listener.- Specified by:
getRequiredThemeVersion
in interfaceDynamicListener
- Returns:
- The intended theme styles version for this listener.
-
isNightMode
public boolean isNightMode(boolean resolve) Description copied from interface:DynamicListener
Checks whether the night mode is enabled for this listener.- Specified by:
isNightMode
in interfaceDynamicListener
- Parameters:
resolve
-true
to resolve based on the theme data.- Returns:
true
if the night mode is enabled for this listener.
-
getThemeRes
Description copied from interface:DynamicListener
This method will be called to return the theme style resource for this listener.Override this method to supply your own customised style.
- Specified by:
getThemeRes
in interfaceDynamicListener
- Returns:
- The theme style resource for this listener.
- See Also:
-
getDynamicTheme
Description copied from interface:DynamicListener
This method will be called to return the dynamic app theme for this listener.Override this method to supply your own customised theme.
- Specified by:
getDynamicTheme
in interfaceDynamicListener
- Returns:
- The dynamic app theme for this listener.
-
isDynamicColors
public boolean isDynamicColors()Description copied from interface:DynamicListener
Returns whether the dynamic colors are enabled for this listener.- Specified by:
isDynamicColors
in interfaceDynamicListener
- Returns:
true
if the dynamic colors are enabled for this listener.
-
isDynamicColor
public boolean isDynamicColor()Description copied from interface:DynamicListener
Returns whether to apply the dynamic colors for this listener.- Specified by:
isDynamicColor
in interfaceDynamicListener
- Returns:
true
if the dynamic colors should be applied for this listener.
-
isSystemColor
public boolean isSystemColor()Description copied from interface:DynamicListener
Returns whether the dynamic colors should be extracted from the system for this listener.- Specified by:
isSystemColor
in interfaceDynamicListener
- Returns:
true
if the dynamic colors should be extracted from the system for this listener
-
isWallpaperColor
public boolean isWallpaperColor()Description copied from interface:DynamicListener
Returns whether the dynamic colors should be extracted from the wallpaper for this listener.- Specified by:
isWallpaperColor
in interfaceDynamicListener
- Returns:
true
if the dynamic colors should be extracted from the wallpaper for this listener
-
getDefaultColor
Description copied from interface:DynamicListener
This method will be called to resolve the default color according to it's type.It is useful in resolving the color if the default theme also has auto values.
- Specified by:
getDefaultColor
in interfaceDynamicListener
- Parameters:
colorType
- The color type to be resolved.- Returns:
- The resolved default color according to the color type.
- See Also:
-
onDynamicChanged
public void onDynamicChanged(boolean context, boolean recreate) Description copied from interface:DynamicListener
This method will be called when the dynamic change event occurs (like theme, locale, etc.).Recreate the activity or application here to adapt changes.
- Specified by:
onDynamicChanged
in interfaceDynamicListener
- Parameters:
context
-true
if there is a context change and it must be reinitialized.recreate
-true
if listener must be recreated to adapt the changes.
-
onDynamicConfigurationChanged
public void onDynamicConfigurationChanged(boolean locale, boolean fontScale, boolean orientation, boolean uiMode, boolean density) Description copied from interface:DynamicListener
This method will be called when the dynamic configuration change event occurs (like locale, font scale, orientation, ui mode, etc.).It will provide more control on
DynamicListener.onDynamicChanged(boolean, boolean)
method call.- Specified by:
onDynamicConfigurationChanged
in interfaceDynamicListener
- Parameters:
locale
-true
if locale is changed.fontScale
-true
if font scale is changed.orientation
-true
if there is an orientation change.uiMode
-true
if ui mode is changed.density
-true
if configuration density is changed.- See Also:
-
onAutoThemeChanged
public void onAutoThemeChanged(boolean context) Description copied from interface:DynamicListener
This method will be called when the auto theme change event occurs according to the time.Recreate the activity or application here to adapt changes.
- Specified by:
onAutoThemeChanged
in interfaceDynamicListener
- Parameters:
context
-true
if there is a context change and it must be reinitialized.
-
onPowerSaveModeChanged
public void onPowerSaveModeChanged(boolean powerSaveMode) Description copied from interface:DynamicListener
This method will be called when the power save mode has been changed.It will be called only on API 21 and above.
- Specified by:
onPowerSaveModeChanged
in interfaceDynamicListener
- Parameters:
powerSaveMode
-true
if the device is in power save mode.
-
toString
-
saveLocalTheme
public void saveLocalTheme()Save the local context theme in shared preferences. -
getTheme
Returns the dynamic app theme from the JSON string.- Parameters:
theme
- The dynamic app theme JSON string to be converted.- Returns:
- The dynamic app theme from the JSON string.
-
getWidgetTheme
Returns the dynamic widget theme from the JSON string.- Parameters:
theme
- The dynamic widget theme JSON string to be converted.- Returns:
- The dynamic widget theme from the JSON string.
-
getRemoteTheme
Returns the dynamic remote theme from the JSON string.- Parameters:
theme
- The dynamic remote theme JSON string to be converted.- Returns:
- The dynamic remote theme from the JSON string.
-
getTheme
Description copied from interface:DynamicResolver
Get the dynamic theme instance used by this resolver.- Specified by:
getTheme
in interfaceDynamicResolver
- Returns:
- The dynamic theme instance used by this resolver.
-
getColors
Description copied from interface:DynamicResolver
Get the dynamic colors used by this resolver.- Specified by:
getColors
in interfaceDynamicResolver
- Parameters:
resolve
-true
to resolve the dynamic colors.- Returns:
- The dynamic colors used by this resolver.
-
getColors
Description copied from interface:DynamicResolver
Get the dynamic colors used by this resolver.- Specified by:
getColors
in interfaceDynamicResolver
- Returns:
- The dynamic colors used by this resolver.
-
isSystemNightMode
public boolean isSystemNightMode()Description copied from interface:DynamicResolver
Checks whether the system night mode is enabled.- Specified by:
isSystemNightMode
in interfaceDynamicResolver
- Returns:
true
if the system night mode is enabled.
-
resolveSystemColor
public int resolveSystemColor(boolean isNight) Description copied from interface:DynamicResolver
Resolves system color according to the API level and night mode.- Specified by:
resolveSystemColor
in interfaceDynamicResolver
- Parameters:
isNight
-true
to resolve the night color.- Returns:
- The system UI color according to the Android version and night mode.
-
isNight
public boolean isNight()Description copied from interface:DynamicResolver
Checks for the night time.Useful to apply themes based on the day and night.
- Specified by:
isNight
in interfaceDynamicResolver
- Returns:
true
if it is night.
-
isNight
public boolean isNight(int theme) Description copied from interface:DynamicResolver
Checks for the night time according to the supplied value.Useful to apply themes based on the day and night.
- Specified by:
isNight
in interfaceDynamicResolver
- Parameters:
theme
- The integer value of the theme.- Returns:
true
if it is night.
-
isNight
Description copied from interface:DynamicResolver
Checks for the night time according to the supplied value.Useful to apply themes based on the day and night.
- Specified by:
isNight
in interfaceDynamicResolver
- Parameters:
theme
- The string value of the theme.- Returns:
true
if it is night.
-
getNightTimeStart
Description copied from interface:DynamicResolver
Returns start time for the night theme.- Specified by:
getNightTimeStart
in interfaceDynamicResolver
- Returns:
- The start time for the night theme.
-
getNightTimeEnd
Description copied from interface:DynamicResolver
Returns end time for the night theme.- Specified by:
getNightTimeEnd
in interfaceDynamicResolver
- Returns:
- The end time for the night theme.
-
resolveNightTheme
public boolean resolveNightTheme(int theme, int implementation, boolean data) Description copied from interface:DynamicResolver
Resolves night theme according to the selected implementation.- Specified by:
resolveNightTheme
in interfaceDynamicResolver
- Parameters:
theme
- The app theme to resolve the auto night theme.implementation
- The implementation for the night theme.data
-true
to resolve based on the theme data.- Returns:
true
if the night theme is enabled according to the selected implementation.
-
resolveNightTheme
Description copied from interface:DynamicResolver
Resolves night theme according to the selected implementation.- Specified by:
resolveNightTheme
in interfaceDynamicResolver
- Parameters:
theme
- The app theme to resolve the auto night theme.implementation
- The implementation for the night theme.data
-true
to resolve based on the theme data.- Returns:
true
if the night theme is enabled according to the selected implementation.
-
resolveAppTheme
public int resolveAppTheme(int theme, int night, boolean data) Description copied from interface:DynamicResolver
Resolves current theme according to the supplied implementation.- Specified by:
resolveAppTheme
in interfaceDynamicResolver
- Parameters:
theme
- The theme to be resolved.night
- The implementation for the night theme.data
-true
to resolve based on the theme data.- Returns:
- The resolved theme constant according to the supplied implementation.
- See Also:
-
resolveAppTheme
Description copied from interface:DynamicResolver
Resolves current theme according to the supplied implementation.- Specified by:
resolveAppTheme
in interfaceDynamicResolver
- Parameters:
theme
- The theme to be resolved.night
- The implementation for the night theme.data
-true
to resolve based on the theme data.- Returns:
- The resolved theme constant according to the supplied implementation.
- See Also:
-
copyThemeString
Copy the supplied theme string to the clipboard and show aSnackbar
.- Parameters:
context
- The context to get theClipboardManager
.theme
- The theme string to be copied.
-
copyTheme
Copy the supplied theme data to the clipboard and show aSnackbar
.- Parameters:
context
- The context to get theClipboardManager
.theme
- The theme data to be copied.
-
saveTheme
Show a theme savedSnackbar
.- Parameters:
context
- The context to get theSnackbar
.
-
invalidTheme
Show a invalid themeSnackbar
.- Parameters:
context
- The context to get theSnackbar
.