More updates
diff --git a/LottieSample/build.gradle b/LottieSample/build.gradle
index a07b0e6..db18b90 100644
--- a/LottieSample/build.gradle
+++ b/LottieSample/build.gradle
@@ -107,11 +107,11 @@
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
- debugImplementation("androidx.fragment:fragment-testing:1.2.5")
+ debugImplementation("androidx.fragment:fragment-testing:1.3.0-alpha08")
testImplementation 'junit:junit:4.13'
- androidTestImplementation 'androidx.test:core:1.2.0'
+ 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'
diff --git a/LottieSample/src/androidTest/java/com/airbnb/lottie/samples/LottieTest.kt b/LottieSample/src/androidTest/java/com/airbnb/lottie/samples/LottieTest.kt
index 1209304..da9fb95 100644
--- a/LottieSample/src/androidTest/java/com/airbnb/lottie/samples/LottieTest.kt
+++ b/LottieSample/src/androidTest/java/com/airbnb/lottie/samples/LottieTest.kt
@@ -11,7 +11,6 @@
import android.widget.FrameLayout
import android.widget.ImageView
import androidx.core.view.updateLayoutParams
-import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import androidx.test.rule.GrantPermissionRule
@@ -31,28 +30,22 @@
import org.junit.Before
import org.junit.Rule
import org.junit.Test
-import org.junit.runner.RunWith
import java.io.File
import java.io.FileInputStream
import java.util.concurrent.TimeUnit
import java.util.zip.ZipInputStream
-/**
- * Run these with: ./gradlew recordMode screenshotTests
- * If you run that command, it completes successfully, and nothing shows up in git, then you
- * haven't broken anything!
- */
@ExperimentalCoroutinesApi
-@RunWith(AndroidJUnit4::class)
@LargeTest
class LottieTest {
+ @Suppress("DEPRECATION")
@get:Rule
- var snapshotActivityRule = ActivityTestRule(SnapshotTestActivity::class.java)
+ private val snapshotActivityRule = ActivityTestRule(SnapshotTestActivity::class.java)
private val activity get() = snapshotActivityRule.activity
@get:Rule
- var permissionRule = GrantPermissionRule.grant(
+ private val permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)
@@ -62,9 +55,9 @@
private lateinit var snapshotter: HappoSnapshotter
private val bitmapPool by lazy { BitmapPool() }
- private val dummyBitmap by lazy { BitmapFactory.decodeResource(activity.resources, R.drawable.airbnb); }
+ private val dummyBitmap by lazy { BitmapFactory.decodeResource(activity.resources, R.drawable.airbnb) }
- private val filmStripViewPool = ObjectPool<FilmStripView> {
+ private val filmStripViewPool = ObjectPool {
FilmStripView(activity).apply {
setImageAssetDelegate(ImageAssetDelegate { dummyBitmap })
setFontAssetDelegate(object : FontAssetDelegate() {
@@ -96,7 +89,6 @@
}
@Test
- @ObsoleteCoroutinesApi
fun testAll() = runBlocking {
withTimeout(TimeUnit.MINUTES.toMillis(45)) {
snapshotFailure()
@@ -190,7 +182,7 @@
}
private fun listAssets(assets: MutableList<String> = mutableListOf(), pathPrefix: String = ""): List<String> {
- activity.getAssets().list(pathPrefix)?.forEach { animation ->
+ activity.assets.list(pathPrefix)?.forEach { animation ->
val pathWithPrefix = if (pathPrefix.isEmpty()) animation else "$pathPrefix/$animation"
if (!animation.contains('.')) {
listAssets(assets, pathWithPrefix)
@@ -922,9 +914,9 @@
}
private suspend fun testNightMode() {
- var newConfig = Configuration(activity.getResources().getConfiguration())
- newConfig.uiMode = newConfig.uiMode and Configuration.UI_MODE_NIGHT_MASK.inv();
- newConfig.uiMode = newConfig.uiMode or Configuration.UI_MODE_NIGHT_NO;
+ var newConfig = Configuration(activity.resources.configuration)
+ newConfig.uiMode = newConfig.uiMode and Configuration.UI_MODE_NIGHT_MASK.inv()
+ newConfig.uiMode = newConfig.uiMode or Configuration.UI_MODE_NIGHT_NO
val dayContext = activity.createConfigurationContext(newConfig)
var result = LottieCompositionFactory.fromRawResSync(dayContext, R.raw.day_night)
var composition = result.value!!
@@ -939,9 +931,9 @@
LottieCompositionCache.getInstance().clear()
bitmapPool.release(bitmap)
- newConfig = Configuration(activity.getResources().getConfiguration())
- newConfig.uiMode = newConfig.uiMode and Configuration.UI_MODE_NIGHT_MASK.inv();
- newConfig.uiMode = newConfig.uiMode or Configuration.UI_MODE_NIGHT_YES;
+ newConfig = Configuration(activity.resources.configuration)
+ newConfig.uiMode = newConfig.uiMode and Configuration.UI_MODE_NIGHT_MASK.inv()
+ newConfig.uiMode = newConfig.uiMode or Configuration.UI_MODE_NIGHT_YES
val nightContext = activity.createConfigurationContext(newConfig)
result = LottieCompositionFactory.fromRawResSync(nightContext, R.raw.day_night)
composition = result.value!!