var app_name="0387878700000056";
var js_path=APPLI_PATH+app_name+"/gadget/";
var support_multiuser=false;
try{
var userprof=system.user_profile.get({"mhc":{}});
if(typeof(userprof.mhc.multiuser_supported)=="boolean")
support_multiuser=userprof.mhc.multiuser_supported;}catch(e){}
var gadget=new Gadget();
var MSG=load_pkg_lang(js_path+"lang",app_name);
var list=[
{label:"",color:[0,0,0,220],image:APPLI_PATH+PRODUCT_ID+"/gadget/gadget_mystream_a.png"},
{label:MSG("LT_MYSTRM_RECOMMEND"),color:[126,194,230,220],image:APPLI_PATH+app_name+"/gadget/2.jpg"},
{label:MSG("LT_MYSTRM_POPULAR"),color:[135,208,171,220],image:APPLI_PATH+app_name+"/gadget/9.jpg"},
];
try{
if(support_multiuser){
list.push({label:MSG("LT_MYSTRM_FAVORITE"),color:[241,166,120,220],image:APPLI_PATH+app_name+"/gadget/4.jpg"});}
}catch(e){}
gadget.init=function()
{

var background=new gbox({width:this.$width,height:this.$height,color:[0,0,0,255]});
this.anim=new container({});
this.anim.components=[
new gimage({width:this.$width,height:this.$height,src:list[0].image}),
new gimage({width:this.$width,height:this.$height,}),
];
var label=new container({
translate:[0,101,-0.2],
components:[
this.label_back=new gbox({visible_p:false,width:this.$width,height:30,color:[0,0,0,160]}),
this.label_text=new gtext({width:400,font_size:18,color:[255,255,255,255],
align:CENTER,omitter:"..."}),
]});
this.title_back=new gbox({width:this.$width,height:40,color:[0,0,0,160],
translate:[0,-232*0.5+20,-0.6],
});
this.title_text=new gtext({translate:[0,-94,-0.2],width:400,font_size:32,
align:CENTER,omitter:"...",color:[255,255,255,255],
text:this._getTitle(),
});

this.components.push(background,this.anim,label,this.title_back,this.title_text);};
var mycount=0;
var delta=15*10;
var sleep=50;
gadget.animation=function (cnt){
var ret=false;
mycount=(mycount+1)%(list.length*delta);
this.label_back.visible_p=(this.label_text.text!="");
var id=~~(mycount/delta);
var next=(id+1)%list.length;
var image=list[id].image;
if(this.anim.components[1].src!=image){
this.anim.components[1].src=image;
this.anim.components[0].src=list[next].image;
this.anim.components[1].color[3]=255;
this.anim.components[0].color[3]=0;
ret=true;}
if((mycount%delta)<sleep)
return ret;
var alpha=~~(5*((mycount%(delta))-sleep));
if(alpha<0)alpha=0;
if(alpha>255)alpha=255;
if(SU_IS_4K){
ret=(this.anim.components[0].color[3]!=255);
this.anim.components[0].color[3]=255;
this.anim.components[1].color[3]=0;}else{
ret=true;
this.anim.components[0].color[3]=255;
this.anim.components[1].color[3]=(255-alpha);}
var text=list[next].label;
if(this.label_text.text!=text)
setf_text(this.label_text,text);
this.label_back.color=list[next].color;
this.label_back.visible_p=(isString(text)&&text.length>0)||(this.label_text.text!="");
return ret;};
gadget.freeResource=function(bool){
gimageResource(this.anim.components[0],bool);
gimageResource(this.anim.components[1],bool);
gimageResource(this.anim.components[1],bool);
gtextResource(this.label_text,bool);
gtextResource(this.title_text,bool);};
gadget.launchApl=function(locked_panel,report)
{
weblink.set({"launch_from":weblink.CODE.ICON});
return apputil.launch_apl(app_name,null,locked_panel,report,null,"mystream");};
return gadget;
