Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
// A java_library Bazel rule with an Android constraint cannot skip these warnings without this
// annotation; another solution would be to create an android_library rule and supply
// AndroidManifest with an SDK set higher than 14.
@SuppressWarnings({"AndroidJdkLibsChecker", "NewApi"})
@SuppressWarnings("NewApi")
public final class DynamicColor {
public final String name;
public final Function<DynamicScheme, TonalPalette> palette;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// A java_library Bazel rule with an Android constraint cannot skip these warnings without this
// annotation; another solution would be to create an android_library rule and supply
// AndroidManifest with an SDK set higher than 14.
@SuppressWarnings({"AndroidJdkLibsChecker", "NewApi"})
@SuppressWarnings("NewApi")
public final class MaterialDynamicColors {

private static final ColorSpec colorSpec = new ColorSpec2025();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ private TemperatureCache() {
* Create a cache that allows calculation of ex. complementary and analogous colors.
*
* @param input Color to find complement/analogous colors of. Any colors will have the same tone,
* and chroma as the input color, modulo any restrictions due to the other hues having lower
* limits on chroma.
* and chroma as the input color, modulo any restrictions due to the other hues having lower
* limits on chroma.
*/
public TemperatureCache(Hct input) {
this.input = input;
Expand Down Expand Up @@ -83,14 +83,12 @@ public Hct getComplement() {
// Find the color in the other section, closest to the inverse percentile
// of the input color. This is the complement.
for (double hueAddend = 0.; hueAddend <= 360.; hueAddend += 1.) {
double hue = MathUtils.sanitizeDegreesDouble(
startHue + directionOfRotation * hueAddend);
double hue = MathUtils.sanitizeDegreesDouble(startHue + directionOfRotation * hueAddend);
if (!isBetween(hue, startHue, endHue)) {
continue;
}
Hct possibleAnswer = getHctsByHue().get((int) Math.round(hue));
double relativeTemp =
(getTempsByHct().get(possibleAnswer) - coldestTemp) / range;
double relativeTemp = (getTempsByHct().get(possibleAnswer) - coldestTemp) / range;
double error = Math.abs(complementRelativeTemp - relativeTemp);
if (error < smallestError) {
smallestError = error;
Expand Down Expand Up @@ -217,8 +215,7 @@ public List<Hct> getAnalogousColors(int count, int divisions) {
*/
public double getRelativeTemperature(Hct hct) {
double range = getTempsByHct().get(getWarmest()) - getTempsByHct().get(getColdest());
double differenceFromColdest =
getTempsByHct().get(hct) - getTempsByHct().get(getColdest());
double differenceFromColdest = getTempsByHct().get(hct) - getTempsByHct().get(getColdest());
// Handle when there's no difference in temperature between warmest and
// coldest: for example, at T100, only one color is available, white.
if (range == 0.) {
Expand Down Expand Up @@ -284,7 +281,7 @@ private List<Hct> getHctsByHue() {
// A java_library Bazel rule with an Android constraint cannot skip these warnings without this
// annotation; another solution would be to create an android_library rule and supply
// AndroidManifest with an SDK set higher than 23.
@SuppressWarnings({"AndroidJdkLibsChecker", "NewApi"})
@SuppressWarnings("NewApi")
private List<Hct> getHctsByTemp() {
if (precomputedHctsByTemp != null) {
return precomputedHctsByTemp;
Expand Down
Loading