erikblomqvist

snoppen

Jan 9th, 2014
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var defaultFontSize = 14;
  2.  
  3. // Set the background color to non-black to see the status bar
  4. // Or set the Window statusBarStyle property to a non-default value
  5. Ti.UI.setBackgroundColor('#232a35');
  6.  
  7. function StyledWindow(title) {
  8.     var win = Ti.UI.createWindow({
  9.         // Remove the status bar
  10.         // fullscreen: true,
  11.         // Moves the Window below the status bar
  12.         statusBarStyle: Titanium.UI.iPhone.StatusBar.LIGHT_CONTENT,
  13.         top: 0
  14.     });
  15.    
  16.     return win;
  17. };
  18.  
  19. var artWindow = Ti.UI.createView({
  20.     backgroundColor: '#232a35',
  21.     height: 59,
  22.     top: 0
  23. });
  24.  
  25. var profileIcon = Ti.UI.createImageView({
  26.     image: 'img/[email protected]',
  27.     left:15, bottom: 14,
  28.     width:12, height:14
  29. });
  30. artWindow.add(profileIcon);
  31.  
  32. var flowLabel = Ti.UI.createLabel({
  33.     color:'white',
  34.     font:{fontFamily:'Lato-Bold', fontSize:defaultFontSize+2},
  35.     text:'Flöde',
  36.     textAlign: 'center',
  37.     bottom: 14
  38. });
  39. artWindow.add(flowLabel);
  40.  
  41. var win = new StyledWindow('Articles');
  42.  
  43. win.add(artWindow);
  44.  
  45. var searchArea = Ti.UI.createView({
  46.     backgroundColor: '#fff',
  47.     font:{fontFamily:'Lato-Regular', fontSize:defaultFontSize+4},
  48.     height: 161,
  49.     top: 59
  50. });
  51.  
  52. var searchBar = Ti.UI.createSearchBar({
  53.     barColor:'#fff',
  54.     font:{fontFamily:'Lato-Regular', fontSize:defaultFontSize+4},
  55.     color: '#858688',
  56.     showCancel:true,
  57.     top: 0,
  58.     height:48,
  59.     value: 'Sök dryck…'
  60. });
  61. searchArea.add(searchBar);
  62.  
  63. var searchCategories = Ti.UI.createLabel({
  64.     color:'#858688',
  65.     font:{fontFamily:'Lato-Regular', fontSize:defaultFontSize+3},
  66.     text:'Kategorier',
  67.     top: 49, left: 10,
  68.     height: 48,
  69.     textAlign: 'left',
  70.     verticalAlign: 'center'
  71. });
  72. searchArea.add(searchCategories);
  73.  
  74. var searchSlider = Ti.UI.createSlider({
  75.     top: 113,
  76.     min: 1, max: 1000,
  77.     width: '94%',
  78.     tintColor: '#4cbbc8',
  79.     value: 80
  80. });
  81.  
  82. var searchSliderLabel = Ti.UI.createLabel({
  83.     text:'Pris < ' + searchSlider.value + ' kr',
  84.     color:'#858688',
  85.     font:{fontFamily:'Lato-Regular', fontSize:defaultFontSize+3},
  86.     top: 78, left: 10,
  87.     height: 48,
  88.     textAlign: 'left',
  89.     verticalAlign: 'center'
  90. });
  91.  
  92. searchSlider.addEventListener('change', function(e) {
  93.     searchSliderLabel.text = 'Pris < ' + String.format("%3.1f", e.value) + ' kr';
  94. });
  95.  
  96. searchArea.add(searchSliderLabel);
  97. searchArea.add(searchSlider);
  98.  
  99. win.add(searchArea);
  100.  
  101. var tableData = [];
  102.  
  103. var subHeader = Ti.UI.createTableViewRow({
  104.     backgroundColor: '#2e353f',
  105.     height:35
  106. });
  107.  
  108. var subFlowLabel = Ti.UI.createLabel({
  109.     color:'white',
  110.     font:{fontFamily:'Lato-Bold', fontSize:defaultFontSize},
  111.     text:'Dessa borde du tycka asamycket om', //Bättre copy!
  112.     textAlign: 'center',
  113.     verticalAlign: 'center'
  114. });
  115. subHeader.add(subFlowLabel);
  116.  
  117. tableData.push(subHeader);
  118.  
  119. for (var i=1; i<=20; i++){
  120.     var row = Ti.UI.createTableViewRow({
  121.         className:'forumEvent', // used to improve table performance
  122.         selectedBackgroundColor:'white',
  123.         rowIndex:i, // custom property, useful for determining the row during events
  124.         height:123
  125.     });
  126.    
  127.     var stretchBgRedwine = Ti.UI.createImageView({
  128.         image: 'img/stretchbg_redwine.jpg',
  129.         left:0, top:0,
  130.         width:7, height:123
  131.     });
  132.     row.add(stretchBgRedwine);
  133.    
  134.     var labelProductCategory = Ti.UI.createLabel({
  135.         color:'#212a38',
  136.         font:{fontFamily:'Lato-Bold', fontSize:defaultFontSize-3},
  137.         text:'RÖTT VIN',
  138.         left:23, top: 19
  139.     });
  140.     row.add(labelProductCategory);
  141.  
  142.     var labelProductName = Ti.UI.createLabel({
  143.         color:'#212a38',
  144.         font:{fontFamily:'Lato-Black', fontSize:defaultFontSize+4},
  145.         text:'1884 Reservado',
  146.         left:23, top: 45
  147.     });
  148.     row.add(labelProductName);
  149.  
  150.     var labelProductSubname = Ti.UI.createLabel({
  151.         color:'#212a38',
  152.         font:{fontFamily:'Lato-Black', fontSize:defaultFontSize+2},
  153.         text:'Pinot Noir',
  154.         left:23, top: 67
  155.     });
  156.     row.add(labelProductSubname);
  157.  
  158.     var labelProductInfo = Ti.UI.createLabel({
  159.         color:'#72767c',
  160.         font:{fontFamily:'Lato-Bold', fontSize:defaultFontSize-3},
  161.         text:'PRIS 97 kr    ALKOHOL 13 %    APK 1,0',
  162.         left:23, top: 97
  163.     });
  164.     row.add(labelProductInfo);
  165.  
  166.     var flowArrow = Ti.UI.createImageView({
  167.         image: 'img/flowarrow.png',
  168.         right:10, top:53,
  169.         width:10, height:17
  170.     });
  171.     row.add(flowArrow);
  172.    
  173.     tableData.push(row);
  174. }
  175.  
  176. var tableView = Ti.UI.createTableView({
  177.     backgroundColor:'white',
  178.     top: 220,
  179.     data:tableData
  180. });
  181.  
  182. win.add(tableView);
  183.  
  184. win.open();
Advertisement
Add Comment
Please, Sign In to add comment