From 1cc6c5c059fe438a2f81895299aefbdef72947f8 Mon Sep 17 00:00:00 2001 From: Gabriel Peal Date: Mon, 26 Jul 2021 23:01:00 -0700 Subject: [PATCH] [Compose] Make LottieCompositionSpec an inline class --- build.gradle | 2 +- .../airbnb/lottie/compose/LottieCompositionSpec.kt | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index ac07f82211..255d4d384c 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ buildscript { } dependencies { classpath 'org.ajoberstar:grgit:1.9.3' - classpath 'com.android.tools.build:gradle:7.0.0-beta05' + classpath 'com.android.tools.build:gradle:7.0.0-rc01' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath 'org.ajoberstar:grgit:1.9.3' classpath "net.ltgt.gradle:gradle-errorprone-plugin:2.0.1" diff --git a/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieCompositionSpec.kt b/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieCompositionSpec.kt index e12f808db9..9444a5b5ea 100644 --- a/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieCompositionSpec.kt +++ b/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieCompositionSpec.kt @@ -5,12 +5,12 @@ package com.airbnb.lottie.compose * A [com.airbnb.lottie.LottieComposition] is the stateless parsed version of a Lottie json file and is * passed into [rememberLottieComposition] or [LottieAnimation]. */ -sealed class LottieCompositionSpec { +sealed interface LottieCompositionSpec { /** * Load an animation from res/raw. */ - data class RawRes(@androidx.annotation.RawRes val resId: Int) : LottieCompositionSpec() + inline class RawRes(@androidx.annotation.RawRes val resId: Int) : LottieCompositionSpec /** * Load an animation from the internet. Lottie has a default network stack that will use @@ -23,22 +23,22 @@ sealed class LottieCompositionSpec { * passing this spec directly into [LottieAnimation] because it can fail and you want to * make sure that you properly handle the failures and/or retries. */ - data class Url(val url: String) : LottieCompositionSpec() + inline class Url(val url: String) : LottieCompositionSpec /** * Load an animation from an arbitrary file. Make sure that your app has permissions to read it * or else this may fail. */ - data class File(val fileName: String) : LottieCompositionSpec() + inline class File(val fileName: String) : LottieCompositionSpec /** * Load an animation from the assets directory of your app. This isn't type safe like [RawRes] * so make sure that the path to your animation is correct this will fail. */ - data class Asset(val assetName: String) : LottieCompositionSpec() + inline class Asset(val assetName: String) : LottieCompositionSpec /** * Load an animation from its json string. */ - data class JsonString(val jsonString: String) : LottieCompositionSpec() -} \ No newline at end of file + inline class JsonString(val jsonString: String) : LottieCompositionSpec +}