Skip to content

Commit

Permalink
[Compose] Make LottieCompositionSpec an inline class (#1855)
Browse files Browse the repository at this point in the history
Also update to rc01
  • Loading branch information
gpeal authored Jul 27, 2021
1 parent 7e44570 commit de7515d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
inline class JsonString(val jsonString: String) : LottieCompositionSpec
}

0 comments on commit de7515d

Please sign in to comment.