Bug 2640 - phonegap example : camera preview support
authorEugene Ostroukhov <eugeneo@symbian.org>
Thu, 10 Jun 2010 17:06:55 -0700
changeset 369 0a31422d2116
parent 368 749e38c3b756
child 370 fc90176b0859
Bug 2640 - phonegap example : camera preview support
org.symbian.tools.wrttools.previewer/preview/css/style.css
org.symbian.tools.wrttools.previewer/preview/images/camera.png
org.symbian.tools.wrttools.previewer/preview/script/lib/widget.js
org.symbian.tools.wrttools.previewer/preview/script/nokia.js
org.symbian.tools.wrttools.previewer/preview/wrt_preview.html
--- a/org.symbian.tools.wrttools.previewer/preview/css/style.css	Thu Jun 10 11:52:23 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/css/style.css	Thu Jun 10 17:06:55 2010 -0700
@@ -655,7 +655,7 @@
 
 
 span#Console-Clear-Button{
-	height: 16px;
+	height: 17px;
 	width: 39px;
 	float: right;
 	background-image: url(../images/console-clear-button.png);
@@ -664,7 +664,7 @@
 	cursor: hand;
 }
 span#Console-Clear-Button:hover{
-	background-position: -0px -16px;
+	background-position: -0px -17px;
 }
 
 #preview-ui-bottom-body{
@@ -726,4 +726,11 @@
 
 span#wrt-help:hover{
 	background-position: -28px 0px;
-}
\ No newline at end of file
+}
+
+#camera {
+	position : relative;
+	top: 30%;
+	height: 100%;
+	text-align: center;
+	vertical-align: middle;
\ No newline at end of file
Binary file org.symbian.tools.wrttools.previewer/preview/images/camera.png has changed
--- a/org.symbian.tools.wrttools.previewer/preview/script/lib/widget.js	Thu Jun 10 11:52:23 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/lib/widget.js	Thu Jun 10 17:06:55 2010 -0700
@@ -53,7 +53,7 @@
 		if (url) {
 			window.open(url, "New Widget Window", 'height=200 width=250');
 		}
-	}
+	};
 	
 	
 	/**
@@ -64,7 +64,7 @@
 	 */
 	widget.preferenceForKey = function(name){
 		return _BRIDGE_REF.nokia.helper.getPreference(name);
-	}
+	};
 	
 	
 	/**
@@ -76,7 +76,7 @@
 	 */
 	widget.setPreferenceForKey = function(preference, key){
 		_BRIDGE_REF.nokia.helper.setPreference(key, preference);
-	}
+	};
 	
 	
 	
@@ -88,7 +88,7 @@
 	 */
 	widget.setNavigationEnabled = function(bool){
 		//This function can not be used on preview browser
-	}
+	};
 	
 	
 	
@@ -100,8 +100,13 @@
 	 * @return {Void}
 	 */
 	widget.openApplication = function(Uid, param){
-		alert("openApplication function won't be simulated in this application");
-	}
+		if (Uid == 270501242) { // Camera
+			var help = _BRIDGE_REF.nokia.helper;
+			help.showCamera();
+		} else {
+			alert("openApplication function won't be simulated in this application");
+		}
+	};
 	
 	
 	
@@ -114,7 +119,7 @@
 	widget.prepareForTransition = function(transitionState){
 		this.isFront = ("" + transitionState).toLowerCase() != "toback";
 		window.document.getElementsByTagName("body")[0].style.opacity = "0.3";
-	}
+	};
 	
 	
 	
@@ -141,7 +146,7 @@
 			//do nothing
 		}, 50);
 		//do nothing
-	}
+	};
 	
 	
 	
@@ -163,7 +168,7 @@
 		} 
 		catch (e) {
 		}
-	}
+	};
 	
 	
 	
@@ -184,7 +189,7 @@
 		} 
 		catch (e) {
 		}
-	}
+	};
 	
 	/**
 	 * Allows the definition of a function to be called
@@ -195,7 +200,7 @@
 	 */
 	widget.onshow = function(){
 		// to be implemented
-	}
+	};
 	
 	
 	
@@ -209,7 +214,7 @@
 	 */
 	widget.onhide = function(){
 		// to be implemented
-	}
+	};
 	
 	
 	
@@ -242,7 +247,7 @@
 		catch (e) {
 			alert('Error in attachSysInfo: ' + e);
 		}
-	}
+	};
 	
 	/**
 	 * 
@@ -276,7 +281,7 @@
 		}else{
 			console.info("System API-1.0 Notice -- no listeners defined for eventType:"+eventType);
 		}
-	}
+	};
 	
 	//	make TRUE widget.js script loaded
 	window.parent.NOKIA.scriptsLoaded.widget = true;
@@ -300,4 +305,4 @@
 		_BRIDGE_REF.nokia.emulator.child = window;
 		_BRIDGE_REF.nokia.menu.init();
 	}	
-})()
+})();
--- a/org.symbian.tools.wrttools.previewer/preview/script/nokia.js	Thu Jun 10 11:52:23 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/nokia.js	Thu Jun 10 17:06:55 2010 -0700
@@ -1239,6 +1239,8 @@
 				}
 				});
 
+			var cc = $("#close-camera");
+			cc.click(NOKIA.helper.hideCamera);
 			//	Bind Buttons to trigger values to WRT 1.0 / 1.1 bindings
 			
 			$("#connect-charger").click(NOKIA.helper.triggerEvents);
@@ -1251,6 +1253,7 @@
 			$("#connect-memory-card").click(NOKIA.helper.triggerEvents);
 			$("#disconnect-memory-card").click(NOKIA.helper.triggerEvents);
 			
+			
 		},
 		
 		setHomeScreen : function()
@@ -1296,6 +1299,16 @@
 			return count;
 		},
 		
+		showCamera : function() {
+			$("#camera").show();
+			$("#WidgetArea").hide();
+		},		
+
+		hideCamera : function() {
+			$("#camera").hide();
+			$("#WidgetArea").show();
+		},		
+		
 		triggerEvents : function(event)
 		{
 			if(typeof event.target.id == 'undefined')
--- a/org.symbian.tools.wrttools.previewer/preview/wrt_preview.html	Thu Jun 10 11:52:23 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/wrt_preview.html	Thu Jun 10 17:06:55 2010 -0700
@@ -39,6 +39,12 @@
 						<div id="iframeMask" class="hide"></div>
 						<iframe src=""></iframe>
 					</div>
+					<div id="camera" class="hide">
+						<img src="preview/images/camera.png"/>
+						<div>
+						<a id="close-camera" class="ui-button" href="javascript:void(0);">Return to Widget</a>
+						</div>
+					</div>
 					<div id="MenuItemsArea" class="scroll-pane">
 						<ul>
 							<li><a href="javascript:void(0);">Exit</a></li>