Class DynamicThemeResolver
java.lang.Object
com.pranavpandey.android.dynamic.support.theme.DynamicThemeResolver
- All Implemented Interfaces:
DynamicResolver
A
DynamicResolver
to resolve the theme.-
Constructor Summary
ConstructorDescriptionDynamicThemeResolver
(DynamicTheme theme) Constructor to initialize an object of this class.DynamicThemeResolver
(DynamicTheme theme, DynamicColors colors, DynamicColors colorsLocal) Constructor to initialize an object of this class. -
Method Summary
Modifier and TypeMethodDescriptionGet the dynamic colors used by this resolver.getColors
(boolean resolve) Get the dynamic colors used by this resolver.Returns end time for the night theme.Returns start time for the night theme.getTheme()
Get the dynamic theme instance used by this resolver.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
Checks whether the system night mode is enabled.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.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.
-
Constructor Details
-
Method Details
-
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:
-