2 * Copyright (c) 2012, Intel Corporation.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 var phoneNumberTextTemplate = {"font" : "bold 40pt Arial", "lineWidth" : 2.5, "fillStyle" : "black", "strokeStyle" : "white", "textAlign" : "center", "textBaseline" : "middle",
11 "shadowOffsetX" : 0, "shadowOffsetY" : 0, "shadowBlur" : 32, "shadowColor" : "rgba(0,100,150, 0.6)"};
14 var sideTextTemplate = {"font" : "bold 40pt Arial", "lineWidth" : 2.5, "fillStyle" : "grey", "strokeStyle" : "white", "textAlign" : "center", "textBaseline" : "middle",
15 "shadowOffsetX" : 0, "shadowOffsetY" : 0, "shadowBlur" : 52, "shadowColor" : "rgba(0, 0, 110, 1.0)"};
17 function addButtonGrid (gridX, gridY, gridWidth, gridHeight)
20 var iconWidth = ((gridWidth - (spacer * 4)) / 3);
21 var iconHeight = ((gridHeight - (spacer * 6)) / 5);
23 var iconXPosition = gridX + spacer;
24 var iconYPosition = gridY + spacer;
25 var firstIconXPosition = iconXPosition;
29 for (var i = 0; i < 12; i++)
47 buttonText = buttonNum.toString();
49 var button = mainPage.addObject(buttonCtx, "button", {"name" : buttonText, "image": images.numberButton, "text" : buttonText, "textTemplate" : buttonTextTemplate, "xLoc" : iconXPosition,
50 "yLoc" : iconYPosition, "width" : iconWidth, "height" : iconHeight} );
52 button.onClick = function(){
53 mainPage.getObj("textArea").textObj.text += this.name;
57 iconXPosition += (iconWidth + spacer);
59 if ((i + 1) % 3 === 0)
61 iconYPosition += (iconHeight + spacer);
62 iconXPosition = firstIconXPosition;
69 button = mainPage.addObject(buttonCtx, "button", {"name" : "del", "image": images.deleteButton, "icon": images.deleteIcon, "iconWidth" : iconHeight * 0.9, "iconHeight" : iconHeight * 0.9,
70 "xLoc" : iconXPosition, "yLoc" : iconYPosition, "width" : iconWidth, "height" : iconHeight} );
71 iconXPosition += (iconWidth + spacer);
72 button.onClick = function(){
73 mainPage.getObj("textArea").textObj.text = mainPage.getObj("textArea").textObj.text.slice(0,-1);
77 button = mainPage.addObject(buttonCtx, "button", {"name" : "call", "image": images.callButton, "icon": images.callIcon, "iconWidth" : iconHeight * 0.9, "iconHeight" : iconHeight * 0.9,
78 "xLoc" : iconXPosition, "yLoc" : iconYPosition, "width" : iconWidth * 2 + spacer, "height" : iconHeight} );
80 button.onClick = function(){
81 var dialNumber = mainPage.getObj("textArea").textObj.text;
84 "api_namespace" : "tizen.ivi.dialer",
86 "command": "dial_number",
90 initCallPage("dialing");
91 updateNumber(dialNumber);
93 currentState = "dialing";
98 function initMainPage()
100 var textAreaHeight = screenHeight / 4;
101 var buttonPadWidth = screenWidth * 0.75;
102 var buttonPadHeight = screenHeight - textAreaHeight - 60;
104 addButtonGrid(20, textAreaHeight + 40, buttonPadWidth, buttonPadHeight);
105 mainPage.addObject(mainCtx, "image", {"name" : "textArea", "image": images.textArea, "text" : "", "textTemplate" : phoneNumberTextTemplate, "xLoc" : 20, "yLoc" : 20, "width" : buttonPadWidth, "height" : textAreaHeight} );
107 mainPage.addObject(mainCtx, "image", {"name" : "buttonBG","image": images.buttonBG, "xLoc" : 20, "yLoc" : textAreaHeight + 40, "width" : buttonPadWidth, "height" : buttonPadHeight} );
109 var myobj = mainPage.addObject(mainCtx, "shape", {"name" : "optionsBG", "xLoc" : 40 + buttonPadWidth, "yLoc" : 0, "width" : (screenWidth * 0.25) - 60, "height" : screenHeight,
110 "fillStyle" : "#51504F", "strokeStyle" : "#373736", "lineWidth" : 5})