|
31 | 31 | // AndroidManifest with an SDK set higher than 14.
|
32 | 32 | @SuppressWarnings({"AndroidJdkLibsChecker", "NewApi"})
|
33 | 33 | public final class MaterialDynamicColors {
|
34 |
| - public MaterialDynamicColors() {} |
| 34 | + /** Optionally use fidelity on most color schemes. */ |
| 35 | + private final boolean isExtendedFidelity; |
| 36 | + |
| 37 | + public MaterialDynamicColors() { |
| 38 | + this.isExtendedFidelity = false; |
| 39 | + } |
| 40 | + |
| 41 | + // Temporary constructor to support extended fidelity experiment. |
| 42 | + // TODO(b/291720794): Once schemes that will permanently use fidelity are identified, |
| 43 | + // remove this and default to the decided behavior. |
| 44 | + public MaterialDynamicColors(boolean isExtendedFidelity) { |
| 45 | + this.isExtendedFidelity = isExtendedFidelity; |
| 46 | + } |
35 | 47 |
|
36 | 48 | @NonNull
|
37 | 49 | public DynamicColor highestSurface(@NonNull DynamicScheme s) {
|
@@ -909,12 +921,17 @@ public DynamicColor textHintInverse() {
|
909 | 921 | "text_hint_inverse", (s) -> s.neutralPalette, (s) -> s.isDark ? 10.0 : 90.0);
|
910 | 922 | }
|
911 | 923 |
|
912 |
| - private static ViewingConditions viewingConditionsForAlbers(DynamicScheme scheme) { |
913 |
| - return ViewingConditions.defaultWithBackgroundLstar(scheme.isDark ? 30.0 : 80.0); |
| 924 | + private boolean isFidelity(DynamicScheme scheme) { |
| 925 | + if (this.isExtendedFidelity |
| 926 | + && scheme.variant != Variant.MONOCHROME |
| 927 | + && scheme.variant != Variant.NEUTRAL) { |
| 928 | + return true; |
| 929 | + } |
| 930 | + return scheme.variant == Variant.FIDELITY || scheme.variant == Variant.CONTENT; |
914 | 931 | }
|
915 | 932 |
|
916 |
| - private static boolean isFidelity(DynamicScheme scheme) { |
917 |
| - return scheme.variant == Variant.FIDELITY || scheme.variant == Variant.CONTENT; |
| 933 | + private static ViewingConditions viewingConditionsForAlbers(DynamicScheme scheme) { |
| 934 | + return ViewingConditions.defaultWithBackgroundLstar(scheme.isDark ? 30.0 : 80.0); |
918 | 935 | }
|
919 | 936 |
|
920 | 937 | private static boolean isMonochrome(DynamicScheme scheme) {
|
|
0 commit comments