An android library to create or display apng
Go to file
Richard Kuiper 0a182b4194
Added duration and loop completed callback
Added CustomAnimationDrawable that provides listener for callbacks.
Added the duration for each frame which can override the png value
Refactored some of the ApngAnimator to reuse code
2018-11-06 14:53:17 +00:00
.idea Move Companion object of APNGFactory to Utils 2018-10-31 12:31:09 +01:00
apng_library Added duration and loop completed callback 2018-11-06 14:53:17 +00:00
app-test Added duration and loop completed callback 2018-11-06 14:53:17 +00:00
gradle/wrapper Initial commit 2018-09-27 22:05:08 +02:00
.gitignore Initial commit 2018-09-27 22:05:08 +02:00
LICENSE Create LICENSE 2018-09-29 21:38:44 +02:00
README.md Update README.md 2018-10-29 16:21:59 +01:00
build.gradle Add jitpack 2018-10-24 13:21:27 +02:00
gradle.properties Initial commit 2018-09-27 22:05:08 +02:00
gradlew Initial commit 2018-09-27 22:05:08 +02:00
gradlew.bat Initial commit 2018-09-27 22:05:08 +02:00
settings.gradle Initial commit 2018-09-27 22:05:08 +02:00

README.md

Kapng-Android

An android library to create or display apng

Exemple of apng :

apng-example

How to use this library :

To load animated png to an imageview :


val imageUrl = "https://upload.wikimedia.org/wikipedia/commons/1/14/Animated_PNG_example_bouncing_beach_ball.png" // image url could be an url, or a file path. You could also load byteArray and file

val animator = ApngAnimator(this).loadInto(imageView)
animator.load(imageUrl)

animator.play()

To create animated png :


val apng = Apng()

val file1 = File("image path 1")
val file2 = File("image path 2")

apng.addFrames(BitmapFactory.decodeByteArray(file1.readBytes(), 0, file1.readBytes().size))
apng.addFrames(BitmapFactory.decodeByteArray(file2.readBytes(), 0, file2.readBytes().size))

val apngByteArray = apng.generateAPNGByteArray()
File("output file path").writeBytes(apngByteArray)

How to install : Via jitpack

repositories {
  maven { url "https://jitpack.io" }
 }
 
 dependencies {
  implementation 'com.github.oupson:Kapng-Android:1.0.2'
 }

Or put the aar file in /libs/ and verify that you have :

 dependencies {
   implementation fileTree(include: ['*.aar'], dir: 'libs')
 }