import Panel from "../views/Panel";
import LineLayoutGroup from "../components/LayoutGroup";
import ListenMusicItem from "../item/ListenMusicItem";

export default class ListenMusicPanel extends Panel {
    public get skinKey() { return "ListenMusicPanel" }
    public get groupName() { return "listen_music_panel" }

    public scroller: eui.Scroller;
    public scrollerGroup: eui.Group;
    public list: eui.List;

    onSkinComplete() {
        super.onSkinComplete();
        this.list.itemRenderer = ListenMusicItem;
        let data2 = [];
        for (let i = 0; i <= 1000; i++) {
            data2.push({
                musicName: i.toString(),
                singer: "杨丞琳",
                favorite: true
            });
        }
        this.list.dataProvider = new eui.ArrayCollection(data2);

        /* let list = new LineLayoutGroup();
        list.addChild(new ListenMusicItem({
            musicName: "缺氧",
            singer: "杨丞琳",
            favorite: true
        }));
        list.addChild(new ListenMusicItem({
            musicName: "缺氧",
            singer: "杨丞琳",
            favorite: false
        }));
        list.addChild(new ListenMusicItem({
            musicName: "缺氧",
            singer: "杨丞琳",
            favorite: true
        }));
        list.addChild(new ListenMusicItem({
            musicName: "缺氧4",
            singer: "杨丞琳",
            favorite: false
        }));
        list.addChild(new ListenMusicItem({
            musicName: "缺氧3",
            singer: "杨丞琳",
            favorite: false
        }));
        list.addChild(new ListenMusicItem({
            musicName: "缺氧2",
            singer: "杨丞琳",
            favorite: false
        }));
        list.addChild(new ListenMusicItem({
            musicName: "缺氧",
            singer: "杨丞琳",
            favorite: false
        }));
        list.addChild(new ListenMusicItem({
            musicName: "缺氧33",
            singer: "杨丞琳",
            favorite: true
        }));
        list.addChild(new ListenMusicItem({
            musicName: "缺氧dd",
            singer: "杨丞琳",
            favorite: false
        }));
        this.scroller.viewport = list;
        this.scroller.addChild(list); */
    }
}

let obj = {
    musicName: "0",
    singer: "杨丞琳",
    favorite: true
};

let data = [
    {
        musicName: "缺氧0",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧1",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧2",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧3",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧4",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧5",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧6",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧7",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧8",
        singer: "杨丞琳",
        favorite: true
    },
    {
        musicName: "缺氧9",
        singer: "杨丞琳",
        favorite: true
    },
];