51 lines
1.4 KiB
Haxe
51 lines
1.4 KiB
Haxe
package demo;
|
|
|
|
import haxework.net.JsonLoader;
|
|
import demo.popup.ColorPopup;
|
|
import haxework.App;
|
|
import haxework.view.frame.FrameSwitcher;
|
|
import haxework.view.IGroupView;
|
|
import haxework.view.IView;
|
|
import haxework.view.ToggleButtonView;
|
|
import haxework.view.VGroupView;
|
|
import haxework.log.TraceLogger;
|
|
|
|
@:template class DemoView extends VGroupView {
|
|
@:view var switcher:FrameSwitcher;
|
|
@:view var tabs:IGroupView;
|
|
|
|
private function init():Void {
|
|
switcher.change("list_form");
|
|
}
|
|
|
|
private function onFrameSwitch(frame:IView<Dynamic>):Void {
|
|
for (view in tabs.views) cast(view, ToggleButtonView).on = view.id == frame.id;
|
|
}
|
|
|
|
private function choiceColor():Void {
|
|
new ColorPopup()
|
|
.show()
|
|
.then(function(color) Theme.setColor(color))
|
|
.catchError(function(e) {});
|
|
}
|
|
}
|
|
|
|
class Demo extends App {
|
|
|
|
public static function main() {
|
|
L.push(new TraceLogger());
|
|
|
|
var app = new App();
|
|
app.resources.image.put("logo", HaxeLogo.resolve());
|
|
Theme.setColor(0x33aa33);
|
|
app.start(new DemoView());
|
|
|
|
new JsonLoader().GET("http://umix.tv/channel/data2/renova.json")
|
|
.then(function(data:Array<Model>) {
|
|
app.resources.any.put("data", data);
|
|
app.resources.any.put("data50", Util.marray(data, 50));
|
|
})
|
|
.catchError(function(error) trace(error));
|
|
}
|
|
}
|