feat:add animation image to image demo

This commit is contained in:
pengfei.zhou 2019-11-21 14:15:43 +08:00
parent ec854ebe71
commit bf5f187621
2 changed files with 29 additions and 3 deletions

View File

@ -55,7 +55,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
api 'com.github.pengfeizhou:jsc4a:0.1.0' api 'com.github.pengfeizhou:jsc4a:0.1.0'
implementation 'com.squareup.okhttp3:okhttp:4.2.1' implementation 'com.squareup.okhttp3:okhttp:4.2.1'
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.2.0' implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.3.1'
api 'org.nanohttpd:nanohttpd:2.3.1' api 'org.nanohttpd:nanohttpd:2.3.1'
implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.google.code.gson:gson:2.8.6'
api "com.google.android.material:material:1.0.0" api "com.google.android.material:material:1.0.0"

View File

@ -1,6 +1,6 @@
import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType } from "doric"; import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType } from "doric";
import { colors, label } from "./utils"; import { colors, label } from "./utils";
const imageUrl = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574244792703&di=c49ed8cd284c367fa8f00065a85428bd&imgtype=0&src=http%3A%2F%2Fimg3.iqilu.com%2Fdata%2Fattachment%2Fforum%2F201308%2F21%2F201709zikkhkjh7dgfi9f0.jpg' const imageUrl = 'https://img.zcool.cn/community/01e75b5da933daa801209e1ffa4649.jpg@1280w_1l_2o_100sh.jpg'
@Entry @Entry
class ImageDemo extends Panel { class ImageDemo extends Panel {
build(rootView: Group): void { build(rootView: Group): void {
@ -14,6 +14,33 @@ class ImageDemo extends Panel {
textAlignment: gravity().center(), textAlignment: gravity().center(),
height: 50, height: 50,
}), }),
label('Gif'),
image({
imageUrl: "https://misc.aotu.io/ONE-SUNDAY/world-cup_2014_42.gif",
scaleType: ScaleType.ScaleToFill,
loadCallback: function (ret) {
log('this')
log('loadCallback', ret)
}
}),
label('APNG'),
image({
imageUrl: "https://misc.aotu.io/ONE-SUNDAY/world_cup_2014_42.png",
loadCallback: (ret) => {
}
}),
label('WebP'),
image({
imageUrl: "https://misc.aotu.io/ONE-SUNDAY/world_cup_2014_42.webp",
loadCallback: (ret) => {
}
}),
label('Lossy WebP'),
image({
imageUrl: "https://misc.aotu.io/ONE-SUNDAY/world_cup_2014_42_lossy.webp",
loadCallback: (ret) => {
}
}),
label('ScaleToFill'), label('ScaleToFill'),
image({ image({
imageUrl, imageUrl,
@ -26,7 +53,6 @@ class ImageDemo extends Panel {
scaleType: ScaleType.ScaleToFill, scaleType: ScaleType.ScaleToFill,
layoutConfig: layoutConfig().exactly(), layoutConfig: layoutConfig().exactly(),
loadCallback: (ret) => { loadCallback: (ret) => {
log('loadCallback', ret)
} }
}), }),
label('ScaleAspectFit'), label('ScaleAspectFit'),