feat:add RefreshableDemo for Android

This commit is contained in:
pengfei.zhou
2019-11-26 10:31:17 +08:00
parent c766e57c83
commit 362ec833c9
9 changed files with 318 additions and 5 deletions

View File

@@ -12,4 +12,5 @@ export default [
'src/StorageDemo',
'src/NavigatorDemo',
'src/NavbarDemo',
'src/RefreshableDemo',
]

View File

@@ -0,0 +1,72 @@
import { refreshable, Group, Panel, navbar, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, modal, IText, network, navigator } from "doric";
import { title, label, colors } from "./utils";
@Entry
class RefreshableDemo extends Panel {
build(rootView: Group): void {
let refreshView = refreshable({
layoutConfig: layoutConfig().atmost(),
header: text({
text: "This is Header",
width: 100,
height: 100,
layoutConfig: layoutConfig().exactly(),
}),
content: scroller(vlayout([
title("Refreshable Demo"),
label('start Refresh').apply({
width: 300,
height: 50,
bgColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().exactly(),
onClick: () => {
refreshView.setRefreshing(context, true)
}
} as IText),
label('stop Refresh').apply({
width: 300,
height: 50,
bgColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().exactly(),
onClick: () => {
refreshView.setRefreshing(context, false)
}
} as IText),
label('Enable Refresh').apply({
width: 300,
height: 50,
bgColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().exactly(),
onClick: () => {
refreshView.setRefreshable(context, true)
}
} as IText),
label('Disable Refresh').apply({
width: 300,
height: 50,
bgColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().exactly(),
onClick: () => {
refreshView.setRefreshable(context, false)
}
} as IText),
]).apply({
layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
layoutConfig: layoutConfig().atmost(),
})
}).in(rootView)
}
}