Projekte
Auf GitHub ansehen Released versions
penfeizhou/APNG4Android
Über uns
Leistungsstarke Android-Unterstützung für animierte PNGs (APNG), animiertes WebP, GIF und animiertes AVIF.
Kreativität und MedienGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- Verlauf wird gesammelt
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
OriginalAnimation Android
- Support APNG & Animated Webp & Gif & AVIF in Android
- Efficient decoder
- Support Drawable usage and glide library module
- Support animation play control
- Support still image
- Low memory usage
中文文档
Released versions 
Usages
Add dependency in build.gradle
repositories {
mavenCentral()
}
Animated WebP
dependencies {
implementation 'com.github.penfeizhou.android.animation:awebp:${VERSION}'
}
APNG
dependencies {
implementation 'com.github.penfeizhou.android.animation:apng:${VERSION}'
}
Gif
dependencies {
implementation 'com.github.penfeizhou.android.animation:gif:${VERSION}'
}
AVIF
dependencies {
implementation 'com.github.penfeizhou.android.animation:avif:${VERSION}'
}
Notice Before Use!
Don't put APNG resources in your drawable or mipmap directory! During the process of release building of an Android app, the aapt tool will zip & modify the frame info of the APNG file, which will lead to an abnormal behavior when playing it. Thus, please put the APNG resources in raw or assets folder instead.
Use
// Load from asset file
AssetStreamLoader assetLoader = new AssetStreamLoader(context, "wheel.png");
// Load form Resource
ResourceStreamLoader resourceLoader = new ResourceStreamLoader(context, R.drawable.sample);
// Load from file
FileStreamLoader fileLoader = new FileStreamLoader("/sdcard/Pictures/1.webp");
// Create APNG Drawable
APNGDrawable apngDrawable = new APNGDrawable(assetLoader);
//Create Animated webp drawable
WebPDrawable webpDrawable = new WebPDrawable(assetLoader);
//Create Animated avif drawable
AVIFDrawable avifDrawable = new AVIFDrawable(assetLoader);
// Auto play
imageView.setImageDrawable(apngDrawable);
// Not needed.default controlled by content
apngDrawable.setLoopLimit(10);
// Implement Animatable2Compat
drawable.registerAnimationCallback(new Animatable2Compat.AnimationCallback() {
@Override
public void onAnimationStart(Drawable drawable) {
super.onAnimationStart(drawable);
}
});
Glide support
Add dependency in build.gradle
repositories {
...
mavenCentral()
}
dependencies {
implementation 'com.github.penfeizhou.android.animation:glide-plugin:${VERSION}'
}
Direct use
Glide.with(imageView).load("https://misc.aotu.io/ONE-SUNDAY/SteamEngine.png").into(imageView);
Glide.with(imageView).load("https://isparta.github.io/compare-webp/image/gif_webp/webp/2.webp").into(imageView);
Welcome to join the talk

Star History
Ähnliche Projekte entdecken
Wird geladen…