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
FieldsModifier 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
ConstructorsConstructorDescriptionConstructor 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 TypeMethodDescriptionvoidclear()Clear original and mutated colors.intbooleanintGet 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.intgetMutated(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.intgetOriginal(int colorType, int fallback) Get the original color according to its type.voidmutate(DynamicColor<?> theme) Mutate original colors for the supplied app theme.voidMutate original colors for the supplied app theme.voidStore the color according to its type in the supplied map.voidput(Map<Integer, Integer> colors, WallpaperColors newColors) Store the wallpaper colors in the supplied map.voidStore the colors in the supplied map.voidputDark(int colorType, int color) Store the color according to its type in the mutated (dark) map.voidputDark(WallpaperColors colors) Store the wallpaper colors in the mutated (dark) map.voidStore the colors in the mutated (dark) map.voidputLight(int colorType, int color) Store the color according to its type in the mutated (light) map.voidputLight(WallpaperColors colors) Store the wallpaper colors in the mutated (light) map.voidStore the colors in the mutated (light) map.voidputOriginal(int colorType, int color) Store the color according to its type in the original map.voidputOriginal(WallpaperColors colors) Store the wallpaper colors in the original map.voidputOriginal(Map<Integer, Integer> colors) Store the colors in the original map.toString()voidwriteToParcel(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:
describeContentsin interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcelin 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
-