Class DynamicColors
java.lang.Object
com.pranavpandey.android.dynamic.theme.DynamicColors
- All Implemented Interfaces:
Parcelable
A class to handle dynamic colors generation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Parcelable.Creator<DynamicColors>
Parcelable creator to create from parcel.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ConstructorDescriptionConstructor to initialize an object of this class.DynamicColors
(Parcel in) Read an object of this class from the parcel.DynamicColors
(Map<Integer, Integer> original) Constructor to initialize an object of this class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear original and mutated colors.int
boolean
int
Get the color according to its type from the supplied map.getAll()
Returns all the colors including original, light and dark.getDark()
Get the map of mutated (dark) colors.getLight()
Get the map of mutated (light) colors.int
getMutated
(int colorType, int fallback, DynamicColor<?> theme) Get the mutated color according to its type.getMutated
(DynamicColor<?> theme) Get the map of mutated colors according to the supplied theme.Get the map of original colors.int
getOriginal
(int colorType, int fallback) Get the original color according to its type.void
mutate
(DynamicColor<?> theme) Mutate original colors for the supplied app theme.void
Mutate original colors for the supplied app theme.void
Store the color according to its type in the supplied map.void
put
(Map<Integer, Integer> colors, WallpaperColors newColors) Store the wallpaper colors in the supplied map.void
Store the colors in the supplied map.void
putDark
(int colorType, int color) Store the color according to its type in the mutated (dark) map.void
putDark
(WallpaperColors colors) Store the wallpaper colors in the mutated (dark) map.void
Store the colors in the mutated (dark) map.void
putLight
(int colorType, int color) Store the color according to its type in the mutated (light) map.void
putLight
(WallpaperColors colors) Store the wallpaper colors in the mutated (light) map.void
Store the colors in the mutated (light) map.void
putOriginal
(int colorType, int color) Store the color according to its type in the original map.void
putOriginal
(WallpaperColors colors) Store the wallpaper colors in the original map.void
putOriginal
(Map<Integer, Integer> colors) Store the colors in the original map.toString()
void
writeToParcel
(Parcel dest, int flags)
-
Field Details
-
CREATOR
Parcelable creator to create from parcel.
-
-
Constructor Details
-
DynamicColors
public DynamicColors()Constructor to initialize an object of this class. -
DynamicColors
Constructor to initialize an object of this class.- Parameters:
original
- The original colors to be handled.
-
DynamicColors
Read an object of this class from the parcel.- Parameters:
in
- The parcel to read the values.
-
-
Method Details
-
describeContents
public int describeContents()- Specified by:
describeContents
in interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcel
in interfaceParcelable
-
getOriginal
Get the map of original colors.- Returns:
- The map of original colors.
-
getDark
Get the map of mutated (dark) colors.- Returns:
- The map of mutated (dark) colors.
-
getLight
Get the map of mutated (light) colors.- Returns:
- The map of mutated (light) colors.
-
get
@ColorInt public int get(@NonNull Map<Integer, Integer> colors, int colorType, @ColorInt int fallback) Get the color according to its type from the supplied map.- Parameters:
colors
- The color map to be used.colorType
- The type of the color.fallback
- The fallback color if the request color type is not found.- Returns:
- The color according to its type from the supplied map.
-
getOriginal
Get the original color according to its type.- Parameters:
colorType
- The type of the color.fallback
- The fallback color if the request color type is not found.- Returns:
- The original color according to its type.
-
put
Store the color according to its type in the supplied map.- Parameters:
colors
- The map to store the color.colorType
- The type of the color.color
- The color to be stored.
-
putOriginal
Store the color according to its type in the original map.- Parameters:
colorType
- The type of the color.color
- The color to be stored.
-
putDark
Store the color according to its type in the mutated (dark) map.- Parameters:
colorType
- The type of the color.color
- The color to be stored.
-
putLight
Store the color according to its type in the mutated (light) map.- Parameters:
colorType
- The type of the color.color
- The color to be stored.
-
put
Store the colors in the supplied map.- Parameters:
colors
- The map to store the colors.newColors
- The colors to be stored.
-
putOriginal
Store the colors in the original map.- Parameters:
colors
- The colors to be stored.
-
putDark
Store the colors in the mutated (dark) map.- Parameters:
colors
- The colors to be stored.
-
putLight
Store the colors in the mutated (light) map.- Parameters:
colors
- The colors to be stored.
-
put
Store the wallpaper colors in the supplied map.- Parameters:
colors
- The map to store the colors.newColors
- The wallpaper colors to be stored.
-
putOriginal
Store the wallpaper colors in the original map.- Parameters:
colors
- The wallpaper colors to be stored.
-
putDark
Store the wallpaper colors in the mutated (dark) map.- Parameters:
colors
- The wallpaper colors to be stored.
-
putLight
Store the wallpaper colors in the mutated (light) map.- Parameters:
colors
- The wallpaper colors to be stored.
-
getAll
Returns all the colors including original, light and dark.- Returns:
- All the colors including original, dark and light.
-
clear
public void clear()Clear original and mutated colors. -
equals
-
toString
-