Patch Youtube Landscape Orientation

From WebOS Internals
Revision as of 11:06, 19 October 2009 by Hopspitfire (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


You will have to resize the background.png image found in /usr/palm/applications/com.palm.app.youtube/images/ to 480x480 so that it doesnt cut off when switching orientation.

or u can download this one which is already resized and use quick install to send the file to the directory http://www.webos-internals.org/images/2/26/Background.png


PATCH CODE


Index: /usr/palm/applications/com.palm.app.youtube/app/controllers/home-assistant.js
===================================================================
--- .orig/usr/palm/applications/com.palm.app.youtube/app/controllers/home-assistant.js
+++ /usr/palm/applications/com.palm.app.youtube/app/controllers/home-assistant.js
@@ -12,6 +12,9 @@ var HomeAssistant = Class.create({
 		// setup application menu
 		this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems: true}, AppAssistant.appMenuModel);
 		
+		// enable free orientation
+    	this.controller.window.PalmSystem.setWindowOrientation("free");	
+		
 		// setup bottom menus		
 		this.controller.setupWidget('videos-menu', undefined, this.videosMenuModel);				
 		this.controller.setupWidget(Mojo.Menu.commandMenu, {menuClass: "no-fade"}, this.cmdMenuModel);
@@ -52,6 +55,14 @@ var HomeAssistant = Class.create({
 			});
     },
 	
+	orientationChanged: function(orientation) {
+		if (orientation === "left" || orientation === "right") {
+			this.controller.sceneElement.addClassName('landscape');
+		} else {
+			this.controller.sceneElement.removeClassName('landscape');
+		}
+	},
+	
 	activate: function() {
 		$('search_string').mojo.focus();
 		this._checkHistoryCount();
Index: /usr/palm/applications/com.palm.app.youtube/app/controllers/search-assistant.js
===================================================================
--- .orig/usr/palm/applications/com.palm.app.youtube/app/controllers/search-assistant.js
+++ /usr/palm/applications/com.palm.app.youtube/app/controllers/search-assistant.js
@@ -20,6 +20,9 @@ var SearchAssistant = Class.create({
 		// setup application menu
 		this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems: true}, AppAssistant.appMenuModel);
 		
+		// enable free orientation
+    	this.controller.window.PalmSystem.setWindowOrientation("free");			
+		
 		// setup search field
 		this.searchFieldModel.attributes = {
 			hintText: $L('Search All Videos...'),
@@ -66,6 +69,14 @@ var SearchAssistant = Class.create({
 			});		
     },
 	
+	orientationChanged: function(orientation) {
+		if (orientation === "left" || orientation === "right") {
+			this.controller.sceneElement.addClassName('landscape');
+		} else {
+			this.controller.sceneElement.removeClassName('landscape');
+		}
+	},
+	
 	activate: function() {
 		// in case of cross app launch we want to focus the app only after 
 		// search scene is ready to go. This is so that user won't see a
Index: /usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js
===================================================================
--- .orig/usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js
+++ /usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js
@@ -11,6 +11,9 @@ var VideoAssistant = Class.create({
     setup: function() {
 		// setup application menu
 		this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems: true}, AppAssistant.appMenuModel);
+	    
+		// enable free orientation
+    	this.controller.window.PalmSystem.setWindowOrientation("free");		
 		
 		// setup bottom menus
 		this.cmdMenuModel = {items: [{label: $L('More'), submenu:'more-menu'}, 
@@ -29,7 +32,15 @@ var VideoAssistant = Class.create({
 				AppAssistant.common.playVideo(this.video);
 			}.bind(this));
     },
-	
+
+	orientationChanged: function(orientation) {
+		if (orientation === "left" || orientation === "right") {
+			this.controller.sceneElement.addClassName('landscape');
+		} else {
+			this.controller.sceneElement.removeClassName('landscape');
+		}
+	},
+
 	activate: function() {
 		// in case of cross app launch we want to focus the app only after 
 		// search scene is ready to go. This is so that user won't see a