DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


sample_code:view_sys_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sample_code:view_sys_files [2015/09/23 12:30]
stevegarman created
sample_code:view_sys_files [2015/09/24 06:16]
stevegarman added seekbar
Line 5: Line 5:
  
 <code JavaScript sysFiles.js>​ <code JavaScript sysFiles.js>​
 +
 var arr=["/​Sys/​Img/​AScript.png","/​Sys/​Img/​Add.png","/​Sys/​Img/​BarA.png","/​Sys/​Img/​BlackBack.jpg","/​Sys/​Img/​BlueBack.jpg","/​Sys/​Img/​Bulb.png","/​Sys/​Img/​Color.png","/​Sys/​Img/​Connect.png","/​Sys/​Img/​Droid1.png","/​Sys/​Img/​Droid2.png","/​Sys/​Img/​Eagle1.png","/​Sys/​Img/​Eagle2.png","/​Sys/​Img/​Exit.png","/​Sys/​Img/​Explode1.png","/​Sys/​Img/​Explode2.png","/​Sys/​Img/​Explode3.png","/​Sys/​Img/​Explode4.png","/​Sys/​Img/​Explode5.png","/​Sys/​Img/​Files.png","/​Sys/​Img/​Forward.png","/​Sys/​Img/​GreenBack.jpg","/​Sys/​Img/​Hello.png","/​Sys/​Img/​Icon.png","/​Sys/​Img/​JoyPad.png","/​Sys/​Img/​Layout.png","/​Sys/​Img/​Left.png","/​Sys/​Img/​Light.png","/​Sys/​Img/​Mic.png","/​Sys/​Img/​NxtConn.png","/​Sys/​Img/​Pillar.png","/​Sys/​Img/​PillarTop.png","/​Sys/​Img/​Play.png","/​Sys/​Img/​Refresh.png","/​Sys/​Img/​Reverse.png","/​Sys/​Img/​Right.png","/​Sys/​Img/​Settings.png","/​Sys/​Img/​Sky.jpg","/​Sys/​Img/​Sound.png","/​Sys/​Img/​Splat.png","/​Sys/​Img/​Spring.png","/​Sys/​Img/​Sprint.png","/​Sys/​Img/​StarField.jpg","/​Sys/​Img/​Tab.png","/​Sys/​Img/​TabHi.png","/​Sys/​Img/​Tile.png","/​Sys/​Img/​Touch.png","/​Sys/​Img/​Ultra.png","/​Sys/​Img/​VBarA.png","/​Sys/​Img/​VBarB.png","/​Sys/​Img/​VBarC.png","/​Sys/​Img/​Xylophone.png","/​Sys/​Img/​bar_dark.png","/​Sys/​Img/​ioio.png","/​Sys/​Snd/​Bullet.mp3","/​Sys/​Snd/​Explode.mp3","/​Sys/​Snd/​Poing.ogg","/​Sys/​Snd/​Trill.ogg"​] var arr=["/​Sys/​Img/​AScript.png","/​Sys/​Img/​Add.png","/​Sys/​Img/​BarA.png","/​Sys/​Img/​BlackBack.jpg","/​Sys/​Img/​BlueBack.jpg","/​Sys/​Img/​Bulb.png","/​Sys/​Img/​Color.png","/​Sys/​Img/​Connect.png","/​Sys/​Img/​Droid1.png","/​Sys/​Img/​Droid2.png","/​Sys/​Img/​Eagle1.png","/​Sys/​Img/​Eagle2.png","/​Sys/​Img/​Exit.png","/​Sys/​Img/​Explode1.png","/​Sys/​Img/​Explode2.png","/​Sys/​Img/​Explode3.png","/​Sys/​Img/​Explode4.png","/​Sys/​Img/​Explode5.png","/​Sys/​Img/​Files.png","/​Sys/​Img/​Forward.png","/​Sys/​Img/​GreenBack.jpg","/​Sys/​Img/​Hello.png","/​Sys/​Img/​Icon.png","/​Sys/​Img/​JoyPad.png","/​Sys/​Img/​Layout.png","/​Sys/​Img/​Left.png","/​Sys/​Img/​Light.png","/​Sys/​Img/​Mic.png","/​Sys/​Img/​NxtConn.png","/​Sys/​Img/​Pillar.png","/​Sys/​Img/​PillarTop.png","/​Sys/​Img/​Play.png","/​Sys/​Img/​Refresh.png","/​Sys/​Img/​Reverse.png","/​Sys/​Img/​Right.png","/​Sys/​Img/​Settings.png","/​Sys/​Img/​Sky.jpg","/​Sys/​Img/​Sound.png","/​Sys/​Img/​Splat.png","/​Sys/​Img/​Spring.png","/​Sys/​Img/​Sprint.png","/​Sys/​Img/​StarField.jpg","/​Sys/​Img/​Tab.png","/​Sys/​Img/​TabHi.png","/​Sys/​Img/​Tile.png","/​Sys/​Img/​Touch.png","/​Sys/​Img/​Ultra.png","/​Sys/​Img/​VBarA.png","/​Sys/​Img/​VBarB.png","/​Sys/​Img/​VBarC.png","/​Sys/​Img/​Xylophone.png","/​Sys/​Img/​bar_dark.png","/​Sys/​Img/​ioio.png","/​Sys/​Snd/​Bullet.mp3","/​Sys/​Snd/​Explode.mp3","/​Sys/​Snd/​Poing.ogg","/​Sys/​Snd/​Trill.ogg"​]
 +var player,​lay2,​img
 //​Called when application is started. //​Called when application is started.
 function OnStart() function OnStart()
 { {
     app.EnableBackKey(false);​     app.EnableBackKey(false);​
 +    app.SetOrientation("​Portrait"​);​
     //​Create a layout with objects vertically centered.     //​Create a layout with objects vertically centered.
-    lay = app.CreateLayout( "​absolute",​ "​VCenter,​FillXY"​ );​    +    var lay = app.CreateLayout( "​absolute",​ "​VCenter,​FillXY"​ );​    
  
     player = app.CreateMediaPlayer();​      player = app.CreateMediaPlayer();​ 
     player.SetOnReady(playerReady);​     player.SetOnReady(playerReady);​
     //​Create a text label and add it to layout.     //​Create a text label and add it to layout.
-    lst = app.CreateList( arr );​+    var lst = app.CreateList( arr );​
     lst.SetOnTouch(lstOnTouch);​     lst.SetOnTouch(lstOnTouch);​
     lst.SetPosition(0,​0.05);​     lst.SetPosition(0,​0.05);​
Line 26: Line 29:
     lay2=app.CreateLayout("​absolute",""​);​     lay2=app.CreateLayout("​absolute",""​);​
     lay2.SetBackColor("#​ffdddddd"​);​     lay2.SetBackColor("#​ffdddddd"​);​
-    lay2.SetBackground("​/Sys/Img/Sky.jpg","repeat"​);​ +    //property to simulate GetBackColor() 
-    img=app.CreateImage(null,​0.95,​0.95);+    lay2.backColor="#ffdddddd
 +    img=app.CreateImage(null,​0.95,​0.85);
     img.SetOnTouchUp(imgOnTouch);​     img.SetOnTouchUp(imgOnTouch);​
     lay2.AddChild(img);​     lay2.AddChild(img);​
 +    //​seekbar to change background colour
 +    var skb=app.CreateSeekBar(0.95);​
 +    skb.SetRange(15);​
 +    skb.SetValue(13);​
 +    skb.SetOnTouch(skbOnTouch);​
 +    skb.SetPosition(0,​0.85,​0.95)
 +    lay2.AddChild(skb);​
     lay2.SetVisibility("​Hide"​);​     lay2.SetVisibility("​Hide"​);​
     app.AddLayout(lay2);​     app.AddLayout(lay2);​
Line 56: Line 67:
 { {
      lay2.Animate("​SlideToLeft"​);​      lay2.Animate("​SlideToLeft"​);​
 +}
 +function skbOnTouch(value)
 +{
 +     var h = Math.round(value).toString(16);​
 +     var col = "#​ff"​+h+h+h+h+h+h;​
 +     if(lay2.backColor != col)
 +     {
 +        lay2.SetBackColor(col);​
 +        lay2.backColor = col;​
 +     }
 } }
 function playerReady() function playerReady()
sample_code/view_sys_files.txt · Last modified: 2015/09/24 06:16 by stevegarman