Prevent duplicate positions in gradient fills
diff --git a/.gitignore b/.gitignore
index 8b570cf..be0bf3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
+.idea/deploymentTargetDropDown.xml
# Gradle
.idea/**/gradle.xml
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 2842237..ac4ba28 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -1,6 +1,10 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
+ <inspection_tool class="ForCanBeForeach" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="REPORT_INDEXED_LOOP" value="false" />
+ <option name="ignoreUntypedCollections" value="false" />
+ </inspection_tool>
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
<option name="previewFile" value="true" />
</inspection_tool>
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java
index 3899b0f..3f295ab 100644
--- a/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java
+++ b/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java
@@ -72,8 +72,13 @@
double value = array.get(i);
switch (i % 4) {
case 0:
- // position
- positions[colorIndex] = (float) value;
+ // Positions should monotonically increase. If they don't, it can cause rendering problems on some phones.
+ // https://github.com/airbnb/lottie-android/issues/1675
+ if (colorIndex > 0 && positions[colorIndex - 1] >= (float) value) {
+ positions[colorIndex] = (float) value + 0.01f;
+ } else {
+ positions[colorIndex] = (float) value;
+ }
break;
case 1:
r = (int) (value * 255);