# HG changeset patch # User Eugene Ostroukhov # Date 1288288831 25200 # Node ID 0b6daedcf7e1b6fd426a7425808b242ddfad38cc Initial commit of two sample projects diff -r 000000000000 -r 0b6daedcf7e1 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,1 @@ +.DS_Store diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/.project Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,28 @@ + + + Eggtimer + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/.settings/.jsdtscope --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/.settings/.jsdtscope Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/.settings/org.eclipse.wst.common.project.facet.core.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/.settings/org.eclipse.wst.common.project.facet.core.xml Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/.settings/org.eclipse.wst.jsdt.ui.superType.container --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/.settings/org.eclipse.wst.jsdt.ui.superType.container Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/.settings/org.eclipse.wst.jsdt.ui.superType.name --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/.settings/org.eclipse.wst.jsdt.ui.superType.name Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,1 @@ +Window \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/.settings/org.symbian.tools.tmw.previewer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/.settings/org.symbian.tools.tmw.previewer.xml Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,9 @@ + + + +portrait +false +1 +WRT 1.1 +360x640 + diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/.settings/org.symbian.tools.tmw.ui.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/.settings/org.symbian.tools.tmw.ui.xml Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/Icon.png Binary file Eggtimer/Icon.png has changed diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/Info.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/Info.plist Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,18 @@ + + + + + DisplayName + Eggtimer + Identifier + org.symbian.eggtimer + Version + 1.0 + AllowNetworkAccess + + MainHTML + index.html + MiniViewEnabled + + + \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/basic.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/basic.css Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,61 @@ +/* + * Add your Stylesheet contents here + */ +#remaining-time { + background-color: olive; + width: 170px; + height: 40px; + position: absolute; + left: 95px; + font-size: xx-large; +} + +#pausestart { + height: 32px; + width: 32px; + position: relative; + right: -138px; + top: -32px; + background-image: url('images/button.png'); +} + +.digits { + width: 3ex; + text-align: center; +} + +#time { + font-weight: bold; + text-align: center; + width: 138px; +} + +#sand { + background-color: yellow; + position: absolute; + top: 0; + bottom: 50%; + width: 100%; + z-index: -1; +} + +#sand-bottom { + background-color: yellow; + position: absolute; + top: 100%; + bottom: 0; + width: 100%; + z-index: -2; +} + +:LINK { + text-decoration: none; + color: black; +} + +#hourglass { + position: absolute; + top: 80px; + left: 70px; + z-index: 100; +} \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/basic.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/basic.js Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,102 @@ +/* + * JavaScript file + */ + +var SETUP_ID = 1; + +var timervalue = 0; +var initialTimer = 0; +var timeoutId = null; + +function init() +{ + showMainWindow(); + widget.setDisplayPortrait(); +} + +function startTimer() { + var hr = parseInt(document.getElementById("hrs").value); + var min = parseInt(document.getElementById("min").value); + var sec = parseInt(document.getElementById("sec").value); + + timervalue = hr * 3600 + min * 60 + sec; + initialTimer = timervalue; + showMainWindow(); + startCountdown(); +} + +function startCountdown() { + if (timeoutId) { + clearInterval(timeoutId); + } + timeoutId = window.setInterval(tick, 1000); + tick(); +} + +function tick() { + if (timervalue > 0) { + timervalue = timervalue - 1; + var hrs = Math.floor(timervalue / 3600); + var mins = Math.floor((timervalue % 3600) / 60); + var sec = timervalue % 60; + + var sz = pad(hrs) + ":" + pad(mins) + ":" + pad(sec); + document.getElementById("timervalue").innerHTML = sz; + document.getElementById("sand").style.top=(50 * (initialTimer-timervalue)/initialTimer).toFixed(0) + "%"; + document.getElementById("sand-bottom").style.top=(50+(50 * timervalue/initialTimer)).toFixed(0) + "%"; + if (timervalue == 0) { + cancelTimer(); + } + } +} + +function pad(num) { + if (num < 10) { + return '0' + num; + } else { + return num; + } +} + +function cancelTimer() { + clearInterval(timeoutId); + timeoutId = 0; + timervalue = 0; + document.getElementById("timervalue").innerHTML = "00:00:00"; + document.getElementById("sand").style.top="50%"; + document.getElementById("sand-bottom").style.top="50%"; +} + +function showMainWindow() { + document.getElementById("main-window").style.display = "inherit"; + document.getElementById("time-setup").style.display = "none"; + var item = new MenuItem("Setup timer", SETUP_ID); + item.onSelect = showTimerSetup; + menu.append(item); + menu.setRightSoftkeyLabel("Exit", null); +} + +function showTimerSetup() { + document.getElementById("main-window").style.display = "none"; + document.getElementById("time-setup").style.display = "inherit"; + var item = menu.getMenuItemById(SETUP_ID); + menu.remove(item); + menu.setRightSoftkeyLabel("Cancel", showMainWindow); +} + +var paused = false; + +function pauseStart() { + if (paused) { + startCountdown(); + document.getElementById("pausestart").style.backgroundPosition = "0px 0px"; + paused = false; + } else { + if (timeoutId) { + window.clearInterval(timeoutId); + timeoutId = null; + } + document.getElementById("pausestart").style.backgroundPosition = "0px 32px"; + paused = true; + } +} \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/images/button.png Binary file Eggtimer/images/button.png has changed diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/images/hourglass.png Binary file Eggtimer/images/hourglass.png has changed diff -r 000000000000 -r 0b6daedcf7e1 Eggtimer/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eggtimer/index.html Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,29 @@ + + + +Hourglass + + + + + + +
+
+ +
 
+
+
+
 
+
 
+ +
+
+
+ Specify time: + :: + +
+ + diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/.project Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,28 @@ + + + Orientation Wallpapers + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/.settings/.jsdtscope --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/.settings/.jsdtscope Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/.settings/org.eclipse.wst.common.project.facet.core.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/.settings/org.eclipse.wst.common.project.facet.core.xml Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/.settings/org.eclipse.wst.jsdt.ui.superType.container --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/.settings/org.eclipse.wst.jsdt.ui.superType.container Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/.settings/org.eclipse.wst.jsdt.ui.superType.name --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/.settings/org.eclipse.wst.jsdt.ui.superType.name Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,1 @@ +Window \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/.settings/org.symbian.tools.tmw.previewer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/.settings/org.symbian.tools.tmw.previewer.xml Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,10 @@ + + + +portrait +true +1 +WRT 1.1 +360x640 +DisplayUpwards + diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/.settings/org.symbian.tools.tmw.ui.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/.settings/org.symbian.tools.tmw.ui.xml Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,2 @@ + + \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/Icon.png Binary file Orientation Wallpapers/Icon.png has changed diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/Info.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/Info.plist Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,18 @@ + + + + + DisplayName + Orientation Wallpapers + Identifier + com.company.OrientationWallpapers + Version + 1.0 + AllowNetworkAccess + + MainHTML + index.html + MiniViewEnabled + + + \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/basic.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/basic.css Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,38 @@ +/* + * Add your Stylesheet contents here + */ +div { + position: absolute; + height: 90%; + width: 90%; +} + +img { + width: 100%; + height: 100%; +} + +#DisplayUp { + display: none; +} + +#DisplayDown { + display: none; +} + +#DisplayRightUp { + display: none; +} + +#DisplayLeftUp { + display: none; +} + +#DisplayUpwards { + display: none; +} + +#DisplayDownwards { + display: none; +} + diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/basic.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/basic.js Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,74 @@ +/* + * JavaScript file + */ + +function init() +{ + widget.setDisplayPortrait(); + watchSensorNotifications(); +} + +// Call this function to add a callback that will be notified of orientation changes +function watchSensorNotifications() { + var sensors = device.getServiceObject("Service.Sensor", "ISensor"); + var SensorParams = { + SearchCriterion : "Orientation" // TODO Possible values (one of): + // SearchCriterion : "All" + // SearchCriterion : "AccelerometerAxis" + // SearchCriterion : "AccelerometerDoubleTapping" + // SearchCriterion : "Rotation" + }; + var result = sensors.ISensor.FindSensorChannel(SensorParams); + + if (result.ErrorCode != 0) { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Handle error + return null; + } + // TODO Function named "sensorCallback" will be called when device orientation changes. This function should be created. + var result2 = sensors.ISensor.RegisterForNotification( + { ChannelInfoMap : result.ReturnValue[0], + ListeningType : "ChannelData" }, sensorCallback); + if (result.ErrorCode == 0) { + var transactionId = result.TransactionID; + // TODO Use this transaction ID to cancel notifications when watching orientation is no longer needed + return transactionId; + } else { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Handle error + return null; + } +} + +// This function can be passed as callback to +// sensors.ISensor.RegisterForNotification method +function sensorCallback(transactionId, code, result) { + if (result.ErrorCode == 0) { + // TODO Process notification + var dataType = result.ReturnValue.DataType; // One of: "AxisData", "DoubleTappingData", "OrientationData" or "RotationData" + var orientation = result.ReturnValue.DeviceOrientation; // Orientation + // var xAxis = result.ReturnValue.XAxisData; // Accelerometer + // var yAxis = result.ReturnValue.YAxisData; // Accelerometer + // var zAxis = result.ReturnValue.ZAxisData; // Accelerometer + // var direction = result.ReturnValue.DeviceDirection; // Accelerometer double tapping + // var xRotation = result.ReturnValue.XRotation; // Rotation + // var yRotation = result.ReturnValue.YRotation; // Rotation + // var zRotation = result.ReturnValue.ZRotation; // Rotation + setVisibleDiv(orientation); + } else { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Handle error + } +} + +function setVisibleDiv(orientation) { + var elements = document.getElementsByTagName("div"); + for ( var i = 0; i < elements.length; i++) { + var el = elements[i]; + el.style.display = el.id == orientation ? "inherit" : "none"; + } + document.getElementById("orientation").innerHTML = orientation; +} \ No newline at end of file diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/images/downwards.jpg Binary file Orientation Wallpapers/images/downwards.jpg has changed diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/images/leftup.jpg Binary file Orientation Wallpapers/images/leftup.jpg has changed diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/images/reverseportrait.jpg Binary file Orientation Wallpapers/images/reverseportrait.jpg has changed diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/images/rightup.jpg Binary file Orientation Wallpapers/images/rightup.jpg has changed diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/images/up.jpg Binary file Orientation Wallpapers/images/up.jpg has changed diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/images/upwards.jpg Binary file Orientation Wallpapers/images/upwards.jpg has changed diff -r 000000000000 -r 0b6daedcf7e1 Orientation Wallpapers/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orientation Wallpapers/index.html Thu Oct 28 11:00:31 2010 -0700 @@ -0,0 +1,20 @@ + + + + Sample Widget + + + + + + +
+
+
+
+
+
+ + +