From 6e497d80cc6eb2501dbeda375da246fbb21fcf00 Mon Sep 17 00:00:00 2001 From: Oupson Date: Wed, 24 Feb 2021 16:26:04 +0100 Subject: [PATCH] Test if time is decoded correctly Fix some problems in documentation --- .../apng/ApngDecoderInstrumentedTest.kt | 1 + .../java/oupson/apng/decoder/ApngDecoder.kt | 20 +++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apng_library/src/androidTest/java/oupson/apng/ApngDecoderInstrumentedTest.kt b/apng_library/src/androidTest/java/oupson/apng/ApngDecoderInstrumentedTest.kt index c8255d3..0b333c1 100644 --- a/apng_library/src/androidTest/java/oupson/apng/ApngDecoderInstrumentedTest.kt +++ b/apng_library/src/androidTest/java/oupson/apng/ApngDecoderInstrumentedTest.kt @@ -41,6 +41,7 @@ class ApngDecoderInstrumentedTest { TestCase.assertTrue(areBitmapSimilar(list[0], anim.coverFrame!!)) for (i in 0 until anim.numberOfFrames) { + TestCase.assertEquals(100, anim.getDuration(i)) TestCase.assertTrue( areBitmapSimilar( (anim.getFrame(i) as BitmapDrawable).bitmap, diff --git a/apng_library/src/main/java/oupson/apng/decoder/ApngDecoder.kt b/apng_library/src/main/java/oupson/apng/decoder/ApngDecoder.kt index 28785fc..8da7fc0 100644 --- a/apng_library/src/main/java/oupson/apng/decoder/ApngDecoder.kt +++ b/apng_library/src/main/java/oupson/apng/decoder/ApngDecoder.kt @@ -36,7 +36,7 @@ class ApngDecoder { interface Callback { /** * Function called when the file was successfully decoded. - * @param drawable Can be an [AnimationDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. If it is not an animated image, it is a [Drawable]. + * @param drawable Can be an [ApngDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. If it is not an animated image, it is a [Drawable]. */ fun onSuccess(drawable: Drawable) @@ -87,7 +87,7 @@ class ApngDecoder { } /** - * Decode Apng and return a Drawable who can be an [AnimationDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. + * Decode Apng and return a Drawable who can be an [ApngDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. * @param context Context needed for the animation drawable * @param inStream Input Stream to decode. Will be closed at the end. * @param config Decoder configuration @@ -533,11 +533,11 @@ class ApngDecoder { } /** - * Decode Apng and return a Drawable who can be an [AnimationDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. + * Decode Apng and return a Drawable who can be an [ApngDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. * @param context Context needed for animation drawable. * @param file File to decode. * @param config Decoder configuration - * @return [AnimationDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. If it is not an animated image, it is a [Drawable]. + * @return [ApngDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. If it is not an animated image, it is a [Drawable]. */ @Suppress("unused") @JvmStatic @@ -553,11 +553,11 @@ class ApngDecoder { ) /** - * Decode Apng and return a Drawable who can be an [AnimationDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. + * Decode Apng and return a Drawable who can be an [ApngDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. * @param context Context is needed for contentResolver and animation drawable. * @param uri Uri to open. * @param config Decoder configuration - * @return [AnimationDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. + * @return [ApngDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. */ @Suppress("unused") @JvmStatic @@ -575,11 +575,11 @@ class ApngDecoder { } /** - * Decode Apng and return a Drawable who can be an [AnimationDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. + * Decode Apng and return a Drawable who can be an [ApngDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. * @param context Context is needed for contentResolver and animation drawable. * @param res Resource to decode. * @param config Decoder configuration - * @return [AnimationDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. + * @return [ApngDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. */ @Suppress("unused") @JvmStatic @@ -595,11 +595,11 @@ class ApngDecoder { ) /** - * Decode Apng and return a Drawable who can be an [AnimationDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. + * Decode Apng and return a Drawable who can be an [ApngDrawable] if it end successfully. Can also be an [android.graphics.drawable.AnimatedImageDrawable]. * @param context Context is needed for contentResolver and animation drawable. * @param url URL to decode. * @param config Decoder configuration - * @return [AnimationDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. + * @return [ApngDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif. */ @Suppress("unused", "BlockingMethodInNonBlockingContext") @JvmStatic