[Compose] Upgrade to Alpha 9 (#1699)
diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml
index 9ae44ad..bb7b85e 100644
--- a/.github/workflows/validate.yml
+++ b/.github/workflows/validate.yml
@@ -15,6 +15,11 @@
steps:
- name: Checkout the code
uses: actions/checkout@v2
+ - name: Setup JDK
+ uses: actions/setup-java@v1
+ with:
+ java-version: '11.0.9'
+ java-package: jdk
- name: Run Lint
run: ./gradlew lintDebug
- name: Lint Results
@@ -27,6 +32,11 @@
steps:
- name: Checkout the code
uses: actions/checkout@v2
+ - name: Setup JDK
+ uses: actions/setup-java@v1
+ with:
+ java-version: '11.0.9'
+ java-package: jdk
- name: Run Unit Tests
run: ./gradlew testDebugUnitTest
- name: Lint Results
@@ -41,6 +51,11 @@
steps:
- name: Checkout the code
uses: actions/checkout@v2
+ - name: Setup JDK
+ uses: actions/setup-java@v1
+ with:
+ java-version: '11.0.9'
+ java-package: jdk
- name: "Deploy Snapshot"
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
diff --git a/README.md b/README.md
index eed3221..456f3b1 100644
--- a/README.md
+++ b/README.md
@@ -49,3 +49,7 @@
![lottieVersion](https://maven-badges.herokuapp.com/maven-central/com.airbnb.android/lottie/badge.svg)
Lottie 2.8.0 and above only supports projects that have been migrated to [androidx](https://developer.android.com/jetpack/androidx/). For more information, read Google's [migration guide](https://developer.android.com/jetpack/androidx/migrate).
+
+# Contributing
+
+Because development has started for Lottie Compose, Gradle, and the Android Gradle Plugin will be kept up to date with the latest canaries. This also requires you to use Android Studio Canary builds. [Preview builds](https://developer.android.com/studio/preview) can be installed side by side with stable versions.
diff --git a/build.gradle b/build.gradle
index f7e23b1..b5eadc2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,8 +2,8 @@
buildscript {
ext {
- composeVersion = '1.0.0-alpha08'
- kotlinVersion = '1.4.20'
+ composeVersion = '1.0.0-alpha09'
+ kotlinVersion = '1.4.21'
daggerVersion = '2.30.1'
}
@@ -16,7 +16,7 @@
}
dependencies {
classpath 'org.ajoberstar:grgit:1.9.3'
- classpath 'com.android.tools.build:gradle:4.2.0-alpha15'
+ classpath 'com.android.tools.build:gradle:7.0.0-alpha03'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion"
classpath 'org.ajoberstar:grgit:1.9.3'
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 883054f..743ba8b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
+distributionUrl=https://services.gradle.org/distributions/gradle-6.8-rc-1-all.zip
diff --git a/lottie-compose/build.gradle b/lottie-compose/build.gradle
index b302fa3..0d60d39 100644
--- a/lottie-compose/build.gradle
+++ b/lottie-compose/build.gradle
@@ -50,5 +50,4 @@
api project(':lottie')
implementation "androidx.compose.foundation:foundation:$composeVersion"
implementation "androidx.compose.ui:ui:$composeVersion"
- implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.0-beta01'
}
\ No newline at end of file
diff --git a/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimation.kt b/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimation.kt
index c335ece..58eefee 100644
--- a/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimation.kt
+++ b/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimation.kt
@@ -1,5 +1,6 @@
package com.airbnb.lottie.compose
+import androidx.annotation.FloatRange
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.runtime.Composable
@@ -20,8 +21,6 @@
import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory
import com.airbnb.lottie.LottieDrawable
-import com.airbnb.lottie.utils.Logger
-import com.airbnb.lottie.utils.MiscUtils.lerp
import java.io.FileInputStream
import java.util.concurrent.TimeUnit
import java.util.zip.ZipInputStream
@@ -53,7 +52,6 @@
if (!isDisposed) result = LottieCompositionResult.Success(c)
}.addFailureListener { e ->
if (!isDisposed) {
- Logger.error("Failed to parse composition.", e)
result = LottieCompositionResult.Fail(e)
}
}
@@ -151,3 +149,5 @@
composition ?: return this
return this.then(aspectRatio(composition.bounds.width() / composition.bounds.height().toFloat()))
}
+
+private fun lerp(a: Float, b: Float, @FloatRange(from = 0.0, to = 1.0) percentage: Float) = a + percentage * (b - a)
diff --git a/lottie/build.gradle b/lottie/build.gradle
index 16a135f..515cd15 100644
--- a/lottie/build.gradle
+++ b/lottie/build.gradle
@@ -46,9 +46,9 @@
errorprone "com.google.errorprone:error_prone_core:2.3.2"
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1"
- testImplementation "org.mockito:mockito-core:2.15.0"
- testImplementation 'junit:junit:4.12'
- testImplementation "org.robolectric:robolectric:4.3.1"
+ testImplementation "org.mockito:mockito-core:3.5.13"
+ testImplementation 'junit:junit:4.13.1'
+ testImplementation "org.robolectric:robolectric:4.4"
}
task sourcesJar(type: Jar) {
diff --git a/lottie/src/test/java/com/airbnb/lottie/LottieCompositionFactoryTest.java b/lottie/src/test/java/com/airbnb/lottie/LottieCompositionFactoryTest.java
index 7fee47d..95e0050 100644
--- a/lottie/src/test/java/com/airbnb/lottie/LottieCompositionFactoryTest.java
+++ b/lottie/src/test/java/com/airbnb/lottie/LottieCompositionFactoryTest.java
@@ -3,11 +3,11 @@
import com.airbnb.lottie.model.LottieCompositionCache;
import com.airbnb.lottie.parser.moshi.JsonReader;
-import org.apache.tools.ant.filters.StringInputStream;
import org.junit.Before;
import org.junit.Test;
import org.robolectric.RuntimeEnvironment;
+import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -54,7 +54,7 @@
@Test
public void testLoadJsonReader() {
- JsonReader reader = JsonReader.of(buffer(source(new StringInputStream(JSON))));
+ JsonReader reader = JsonReader.of(buffer(source(new ByteArrayInputStream(JSON.getBytes()))));
LottieResult<LottieComposition> result = LottieCompositionFactory.fromJsonReaderSync(reader, "json");
assertNull(result.getException());
assertNotNull(result.getValue());
@@ -62,7 +62,7 @@
@Test
public void testLoadInvalidJsonReader() {
- JsonReader reader = JsonReader.of(buffer(source(new StringInputStream(NOT_JSON))));
+ JsonReader reader = JsonReader.of(buffer(source(new ByteArrayInputStream(NOT_JSON.getBytes()))));
LottieResult<LottieComposition> result = LottieCompositionFactory.fromJsonReaderSync(reader, "json");
assertNotNull(result.getException());
assertNull(result.getValue());
diff --git a/lottie/src/test/java/com/airbnb/lottie/MeanCalculatorTest.java b/lottie/src/test/java/com/airbnb/lottie/MeanCalculatorTest.java
index 3cc1d78..772eda7 100644
--- a/lottie/src/test/java/com/airbnb/lottie/MeanCalculatorTest.java
+++ b/lottie/src/test/java/com/airbnb/lottie/MeanCalculatorTest.java
@@ -5,8 +5,8 @@
import org.junit.Before;
import org.junit.Test;
-import static org.hamcrest.Matchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
public class MeanCalculatorTest {
diff --git a/lottie/src/test/java/com/airbnb/lottie/PerformanceTrackerTest.java b/lottie/src/test/java/com/airbnb/lottie/PerformanceTrackerTest.java
index f6f0bc2..a541e10 100644
--- a/lottie/src/test/java/com/airbnb/lottie/PerformanceTrackerTest.java
+++ b/lottie/src/test/java/com/airbnb/lottie/PerformanceTrackerTest.java
@@ -7,9 +7,9 @@
import java.util.List;
-import static junit.framework.Assert.assertTrue;
-import static org.hamcrest.Matchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static junit.framework.TestCase.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
public class PerformanceTrackerTest {
diff --git a/lottie/src/test/java/com/airbnb/lottie/utils/GammaEvaluatorTest.java b/lottie/src/test/java/com/airbnb/lottie/utils/GammaEvaluatorTest.java
index d091ba1..d4d833a 100644
--- a/lottie/src/test/java/com/airbnb/lottie/utils/GammaEvaluatorTest.java
+++ b/lottie/src/test/java/com/airbnb/lottie/utils/GammaEvaluatorTest.java
@@ -2,8 +2,8 @@
import org.junit.Test;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
public class GammaEvaluatorTest {
@Test
diff --git a/sample-compose/build.gradle b/sample-compose/build.gradle
index 13dc5c4..ff9ca3d 100644
--- a/sample-compose/build.gradle
+++ b/sample-compose/build.gradle
@@ -65,7 +65,7 @@
implementation "androidx.compose.material:material:$composeVersion"
implementation "androidx.compose.material:material-icons-extended:$composeVersion"
implementation "androidx.compose.ui:ui-tooling:$composeVersion"
- implementation "androidx.navigation:navigation-compose:1.0.0-alpha03"
+ implementation "androidx.navigation:navigation-compose:1.0.0-alpha04"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-beta01'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-beta01'
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/composables/DebouncedCircularProgressIndicator.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/composables/DebouncedCircularProgressIndicator.kt
index 31d31c6..a4132df 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/composables/DebouncedCircularProgressIndicator.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/composables/DebouncedCircularProgressIndicator.kt
@@ -2,13 +2,12 @@
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.MaterialTheme
-import androidx.compose.material.ProgressIndicatorConstants
+import androidx.compose.material.ProgressIndicatorDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.LaunchedTask
-import androidx.compose.runtime.remember
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -20,7 +19,7 @@
modifier: Modifier = Modifier,
delayMs: Long = 1_500L,
color: Color = MaterialTheme.colors.primary,
- strokeWidth: Dp = ProgressIndicatorConstants.DefaultStrokeWidth,
+ strokeWidth: Dp = ProgressIndicatorDefaults.StrokeWidth,
) {
var readyToShow by remember { mutableStateOf(false) }
LaunchedEffect(readyToShow) {
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/lottiefiles/LottieFilesRecentsAndPopularPage.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/lottiefiles/LottieFilesRecentsAndPopularPage.kt
index 4df5209..ff2d248 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/lottiefiles/LottieFilesRecentsAndPopularPage.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/lottiefiles/LottieFilesRecentsAndPopularPage.kt
@@ -1,12 +1,11 @@
package com.airbnb.lottie.sample.compose.lottiefiles
import android.util.Log
-import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.lazy.LazyColumnForIndexed
+import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.FloatingActionButton
import androidx.compose.material.Icon
import androidx.compose.material.icons.Icons
@@ -131,21 +130,22 @@
Column(
modifier = Modifier.then(modifier)
) {
- LazyColumnForIndexed(
- state.results,
+ LazyColumn(
modifier = Modifier.weight(1f)
- ) { index, result ->
- if (index == state.results.size - 1) {
- onActive {
- fetchNextPage()
+ ) {
+ itemsIndexed(state.results) { index, result ->
+ if (index == state.results.size - 1) {
+ onActive {
+ fetchNextPage()
+ }
}
+ AnimationRow(
+ title = result.title,
+ previewUrl = result.preview_url ?: "",
+ previewBackgroundColor = result.bgColor,
+ onClick = { onAnimationClicked(result) }
+ )
}
- AnimationRow(
- title = result.title,
- previewUrl = result.preview_url ?: "",
- previewBackgroundColor = result.bgColor,
- onClick = { onAnimationClicked(result) }
- )
}
}
if (state.fetchException) {
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/lottiefiles/LottieFilesSearchPage.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/lottiefiles/LottieFilesSearchPage.kt
index 5227dfd..25a07f7 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/lottiefiles/LottieFilesSearchPage.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/lottiefiles/LottieFilesSearchPage.kt
@@ -5,7 +5,7 @@
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.lazy.LazyColumnForIndexed
+import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.FloatingActionButton
import androidx.compose.material.Icon
import androidx.compose.material.OutlinedTextField
@@ -142,21 +142,22 @@
label = { Text(stringResource(R.string.query)) },
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp)
)
- LazyColumnForIndexed(
- state.results,
+ LazyColumn(
modifier = Modifier.weight(1f)
- ) { index, result ->
- if (index == state.results.size - 1) {
- onActive {
- fetchNextPage()
+ ) {
+ itemsIndexed(state.results) { index, result ->
+ if (index == state.results.size - 1) {
+ onActive {
+ fetchNextPage()
+ }
}
+ AnimationRow(
+ title = result.title,
+ previewUrl = result.preview_url ?: "",
+ previewBackgroundColor = result.bgColor,
+ onClick = { onAnimationClicked(result) }
+ )
}
- AnimationRow(
- title = result.title,
- previewUrl = result.preview_url ?: "",
- previewBackgroundColor = result.bgColor,
- onClick = { onAnimationClicked(result) }
- )
}
}
if (state.fetchException) {
@@ -175,7 +176,7 @@
@Preview
@Composable
-fun previewSearchPage() {
+fun PreviewSearchPage() {
val data = AnimationDataV2(0, null, "https://assets9.lottiefiles.com/render/k1821vf5.png", "Loading", "")
val state = LottieFilesSearchState(
results = listOf(data, data, data),
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/PlayerViewModel.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/PlayerViewModel.kt
deleted file mode 100644
index 1097404..0000000
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/PlayerViewModel.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.airbnb.lottie.sample.compose.player
-
-import android.app.Application
-import androidx.lifecycle.AndroidViewModel
-import com.airbnb.lottie.sample.compose.api.LottieFilesApi
-import retrofit2.Retrofit
-import retrofit2.converter.moshi.MoshiConverterFactory
-import retrofit2.create
-
-class PlayerViewModel(application: Application) : AndroidViewModel(application) {
- private val retrofit = Retrofit.Builder()
- .baseUrl("https://api.lottiefiles.com/")
- .addConverterFactory(MoshiConverterFactory.create())
- .build()
-
- val api = retrofit.create<LottieFilesApi>()
-}
\ No newline at end of file
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/ToolbarChip.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/ToolbarChip.kt
index 5717ccd..749f2e0 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/ToolbarChip.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/ToolbarChip.kt
@@ -22,7 +22,6 @@
import com.airbnb.lottie.sample.compose.R
import com.airbnb.lottie.sample.compose.ui.Teal
-
@Composable
fun ToolbarChip(
label: String,
diff --git a/sample/build.gradle b/sample/build.gradle
index db18b90..9528c11 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,11 +1,8 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
+apply plugin: 'kotlin-parcelize'
-androidExtensions {
- features = ["parcelize"]
-}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
@@ -14,19 +11,22 @@
}
android {
- compileSdkVersion 29
+ compileSdkVersion 30
defaultConfig {
applicationId "com.airbnb.lottie"
minSdkVersion 16
- targetSdkVersion 29
+ targetSdkVersion 30
versionCode 69
versionName VERSION_NAME
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- vectorDrawables.useSupportLibrary = true
buildConfigField("String", "BITRISE_GIT_BRANCH", "\"" + System.getenv("BITRISE_GIT_BRANCH") + "\"")
buildConfigField("String", "GIT_SHA", "\"" + gitSha + "\"")
buildConfigField("String", "GIT_BRANCH", "\"" + gitBranch + "\"")
+ vectorDrawables.useSupportLibrary = true
+ }
+ buildFeatures {
+ viewBinding true
}
buildTypes {
debug {
@@ -41,11 +41,9 @@
minifyEnabled false
}
}
- viewBinding {
- enabled = true
- }
lintOptions {
ignore 'InvalidPackage'
+ ignore 'VectorDrawableCompat'
textReport true
textOutput 'stdout'
baseline file("lint-baseline.xml")
@@ -85,38 +83,38 @@
kapt "androidx.lifecycle:lifecycle-common-java8:2.2.0"
implementation "com.google.android.material:material:1.2.1"
- implementation 'com.airbnb.android:epoxy:4.0.0-beta6'
- kapt 'com.airbnb.android:epoxy-processor:4.0.0-beta6'
+ implementation 'com.airbnb.android:epoxy:4.2.0'
+ kapt 'com.airbnb.android:epoxy-processor:4.2.0'
implementation 'com.airbnb.android:mvrx:1.5.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
implementation 'com.matthew-tamlin:sliding-intro-screen:3.2.0'
implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.2'
- implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
+ implementation 'com.github.PhilJay:MPAndroidChart:3.1.0'
implementation 'com.amazonaws:aws-android-sdk-s3:2.8.3'
implementation ('com.amazonaws:aws-android-sdk-mobile-client:2.8.3@aar') { transitive = true }
implementation ('com.amazonaws:aws-android-sdk-auth-userpools:2.8.3@aar') { transitive = true }
implementation 'com.google.code.gson:gson:2.8.6'
- implementation 'com.squareup.okhttp3:okhttp:4.8.1'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
- implementation 'com.github.bumptech.glide:glide:4.8.0'
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
debugImplementation("androidx.fragment:fragment-testing:1.3.0-alpha08")
- testImplementation 'junit:junit:4.13'
+ testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test:core:1.3.0-rc01'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
- androidTestImplementation 'com.squareup.okhttp3:okhttp:4.8.1'
+ androidTestImplementation 'com.squareup.okhttp3:okhttp:4.9.0'
androidTestImplementation 'io.jsonwebtoken:jjwt:0.9.0'
androidTestImplementation "org.mockito:mockito-android:2.28.2"
androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
diff --git a/sample/src/main/kotlin/com/airbnb/lottie/samples/DynamicActivity.kt b/sample/src/main/kotlin/com/airbnb/lottie/samples/DynamicActivity.kt
index 495803e..704e666 100644
--- a/sample/src/main/kotlin/com/airbnb/lottie/samples/DynamicActivity.kt
+++ b/sample/src/main/kotlin/com/airbnb/lottie/samples/DynamicActivity.kt
@@ -4,12 +4,12 @@
import android.graphics.PointF
import android.os.Bundle
import android.util.Log
+import androidx.annotation.FloatRange
import androidx.appcompat.app.AppCompatActivity
import com.airbnb.lottie.LottieProperty
import com.airbnb.lottie.model.KeyPath
import com.airbnb.lottie.samples.databinding.DynamicActivityBinding
import com.airbnb.lottie.samples.utils.viewBinding
-import com.airbnb.lottie.utils.MiscUtils
private val COLORS = arrayOf(
0xff5a5f,
@@ -81,7 +81,7 @@
} else if (endY > startY) {
endY += EXTRA_JUMP[extraJumpIndex]
}
- point.set(startX, MiscUtils.lerp(startY, endY, frameInfo.interpolatedKeyframeProgress))
+ point.set(startX, lerp(startY, endY, frameInfo.interpolatedKeyframeProgress))
point
}
}
@@ -92,6 +92,8 @@
binding.jumpHeight.text = "Extra jump height ${EXTRA_JUMP[extraJumpIndex]}"
}
+ fun lerp(a: Float, b: Float, @FloatRange(from = 0.0, to = 1.0) percentage: Float) = a + percentage * (b - a)
+
companion object {
val TAG = DynamicActivity::class.simpleName
}
diff --git a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationData.kt b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationData.kt
index e324c27..6234362 100644
--- a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationData.kt
+++ b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationData.kt
@@ -2,7 +2,7 @@
import android.os.Parcelable
import com.airbnb.lottie.samples.utils.toColorIntSafe
-import kotlinx.android.parcel.Parcelize
+import kotlinx.parcelize.Parcelize
@Parcelize
data class AnimationData(
diff --git a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationDataV2.kt b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationDataV2.kt
index f892d77..5075042 100644
--- a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationDataV2.kt
+++ b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationDataV2.kt
@@ -2,7 +2,7 @@
import android.os.Parcelable
import com.airbnb.lottie.samples.utils.toColorIntSafe
-import kotlinx.android.parcel.Parcelize
+import kotlinx.parcelize.Parcelize
@Parcelize
data class AnimationDataV2(
diff --git a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationResponse.kt b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationResponse.kt
index b05d50e..c5d3897 100644
--- a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationResponse.kt
+++ b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/AnimationResponse.kt
@@ -1,7 +1,7 @@
package com.airbnb.lottie.samples.model
import android.os.Parcelable
-import kotlinx.android.parcel.Parcelize
+import kotlinx.parcelize.Parcelize
// This is a lint bug
@SuppressWarnings("ParcelCreator")
diff --git a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/CompositionArgs.kt b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/CompositionArgs.kt
index c34dbc0..1544a35 100644
--- a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/CompositionArgs.kt
+++ b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/CompositionArgs.kt
@@ -3,8 +3,8 @@
import android.annotation.SuppressLint
import android.net.Uri
import android.os.Parcelable
-import kotlinx.android.parcel.IgnoredOnParcel
-import kotlinx.android.parcel.Parcelize
+import kotlinx.parcelize.IgnoredOnParcel
+import kotlinx.parcelize.Parcelize
@SuppressLint("ParcelCreator")
@Parcelize
diff --git a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/UserInfo.kt b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/UserInfo.kt
index 6a209af..66c6a7d 100644
--- a/sample/src/main/kotlin/com/airbnb/lottie/samples/model/UserInfo.kt
+++ b/sample/src/main/kotlin/com/airbnb/lottie/samples/model/UserInfo.kt
@@ -1,7 +1,7 @@
package com.airbnb.lottie.samples.model
import android.os.Parcelable
-import kotlinx.android.parcel.Parcelize
+import kotlinx.parcelize.Parcelize
// This is a lint bug
@SuppressWarnings("ParcelCreator")