rhodes 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +10 -0
- data/lib/framework/rho/rhoerror.rb +4 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom.rb +21 -1
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +21 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesInstance.java +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +10 -0
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +2 -2
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +4 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +52 -11
- data/platform/iphone/Classes/NativeBar.m +37 -18
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +27 -8
- data/platform/iphone/Classes/SimpleMainView.h +7 -5
- data/platform/iphone/Classes/SimpleMainView.m +155 -36
- data/platform/iphone/Classes/TabbedMainView.h +2 -4
- data/platform/iphone/Classes/TabbedMainView.m +12 -10
- data/platform/iphone/Classes/WebView.m +1 -0
- data/platform/iphone/Info.plist +7 -1
- data/platform/iphone/icon114.png +0 -0
- data/platform/iphone/icon57.png +0 -0
- data/platform/iphone/icon72.png +0 -0
- data/platform/iphone/rbuild/iphone.rake +102 -16
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +12 -0
- data/platform/shared/common/IRhoThreadImpl.h +1 -1
- data/platform/shared/common/PosixThreadImpl.cpp +17 -22
- data/platform/shared/common/PosixThreadImpl.h +1 -1
- data/platform/shared/common/RhoThread.cpp +7 -3
- data/platform/shared/common/RhoThread.h +21 -7
- data/platform/shared/common/RhodesApp.cpp +13 -9
- data/platform/shared/common/RhodesApp.h +1 -1
- data/platform/shared/common/ThreadQueue.cpp +6 -4
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoThread.java +18 -8
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +70 -2
- data/platform/shared/rubyJVM/src/com/rho/ThreadQueue.java +143 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +15 -5
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +42 -36
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +63 -20
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +4 -4
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +12 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RhoSupport.java +9 -3
- data/platform/shared/sync/ClientRegister.cpp +11 -3
- data/platform/shared/sync/ClientRegister.h +1 -0
- data/platform/shared/sync/SyncEngine.cpp +38 -35
- data/platform/shared/sync/SyncEngine.h +2 -1
- data/platform/shared/sync/SyncNotify.cpp +53 -20
- data/platform/shared/sync/SyncNotify.h +9 -2
- data/platform/shared/sync/SyncSource.cpp +3 -3
- data/platform/shared/sync/SyncSource.h +1 -1
- data/platform/shared/sync/SyncThread.cpp +9 -2
- data/platform/wm/rhodes/Alert.cpp +35 -21
- data/platform/wm/rhodes/Alert.h +11 -2
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +11 -12
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +2 -0
- data/res/generators/templates/application/build.yml +1 -1
- data/rhodes.gemspec +2 -2
- data/spec/framework_spec/rhoconfig.txt +1 -0
- data/spec/phone_spec/rhoconfig.txt +2 -0
- metadata +8 -5
- data/Manifest.txt +0 -5333
| @@ -113,6 +113,7 @@ static Rhodes *instance = NULL; | |
| 113 113 | 
             
            }
         | 
| 114 114 |  | 
| 115 115 | 
             
            - (void)openMapLocation:(NSString*)query {
         | 
| 116 | 
            +
            	[self hideSplash];
         | 
| 116 117 | 
             
                NSURL* url = [NSURL URLWithString:[@"http://maps.google.com/?" stringByAppendingString:query]];
         | 
| 117 118 | 
             
                [[UIApplication sharedApplication] openURL:url];
         | 
| 118 119 | 
             
            }
         | 
| @@ -168,6 +169,7 @@ static Rhodes *instance = NULL; | |
| 168 169 | 
             
            }
         | 
| 169 170 |  | 
| 170 171 | 
             
            - (void)chooseDateTime:(DateTime*)dateTime {
         | 
| 172 | 
            +
            	[self hideSplash];
         | 
| 171 173 | 
             
                dateTimePickerDelegate.dateTime = dateTime;
         | 
| 172 174 | 
             
                [dateTimePickerDelegate setPostUrl:dateTime.url];
         | 
| 173 175 | 
             
                //[self normalizeUrl:dateTime.url]];
         | 
| @@ -181,6 +183,7 @@ static Rhodes *instance = NULL; | |
| 181 183 | 
             
            -(BOOL)startCameraPicker:(PickImageDelegate*)delegateObject 
         | 
| 182 184 | 
             
                                            sourceType:(UIImagePickerControllerSourceType)type
         | 
| 183 185 | 
             
            {
         | 
| 186 | 
            +
            	[self hideSplash];
         | 
| 184 187 | 
             
            #ifndef __IPHONE_3_0
         | 
| 185 188 | 
             
                if ( (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) || 
         | 
| 186 189 | 
             
                    (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) ||
         | 
| @@ -242,16 +245,21 @@ static Rhodes *instance = NULL; | |
| 242 245 | 
             
                return window;
         | 
| 243 246 | 
             
            }
         | 
| 244 247 |  | 
| 245 | 
            -
            - (void) | 
| 246 | 
            -
                if (mainView == view)
         | 
| 247 | 
            -
                    return;
         | 
| 248 | 
            -
                
         | 
| 248 | 
            +
            - (void)hideSplash {
         | 
| 249 249 | 
             
                if (splashViewController) {
         | 
| 250 250 | 
             
                    [splashViewController hideSplash];
         | 
| 251 251 | 
             
                    [splashViewController release];
         | 
| 252 252 | 
             
                    splashViewController = nil;
         | 
| 253 253 | 
             
                }
         | 
| 254 | 
            +
            }
         | 
| 255 | 
            +
             | 
| 256 | 
            +
            - (void)setMainView:(id<RhoMainView,NSObject>)view {
         | 
| 257 | 
            +
                if (mainView == view)
         | 
| 258 | 
            +
                    return;
         | 
| 259 | 
            +
            		
         | 
| 260 | 
            +
            	[self hideSplash];
         | 
| 254 261 |  | 
| 262 | 
            +
                [mainView.view removeFromSuperview];
         | 
| 255 263 | 
             
                [mainView release];
         | 
| 256 264 | 
             
                mainView = [view retain];
         | 
| 257 265 | 
             
                [window addSubview:mainView.view];
         | 
| @@ -277,6 +285,8 @@ static Rhodes *instance = NULL; | |
| 277 285 | 
             
                    NSError *err;
         | 
| 278 286 | 
             
                    NSString *data = [NSString stringWithContentsOfFile:htmPath encoding:NSUTF8StringEncoding error:&err];
         | 
| 279 287 | 
             
                    [mainView loadHTMLString:data];
         | 
| 288 | 
            +
            		rho_splash_screen_start();
         | 
| 289 | 
            +
             | 
| 280 290 | 
             
                }
         | 
| 281 291 | 
             
            }
         | 
| 282 292 |  | 
| @@ -297,12 +307,21 @@ static Rhodes *instance = NULL; | |
| 297 307 | 
             
                [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
         | 
| 298 308 |  | 
| 299 309 | 
             
                window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
         | 
| 300 | 
            -
             | 
| 310 | 
            +
            	window.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
         | 
| 311 | 
            +
            	window.autoresizesSubviews = YES;
         | 
| 312 | 
            +
             | 
| 301 313 |  | 
| 302 314 | 
             
                mainView = nil;
         | 
| 303 315 | 
             
                self.mainView = [[SimpleMainView alloc] initWithParentView:window frame:[Rhodes applicationFrame]];
         | 
| 316 | 
            +
             	mainView.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
         | 
| 317 | 
            +
            	mainView.view.autoresizesSubviews = YES;
         | 
| 318 | 
            +
            	
         | 
| 319 | 
            +
                [window makeKeyAndVisible];
         | 
| 320 | 
            +
             | 
| 321 | 
            +
            	[window addSubview:mainView.view];
         | 
| 322 | 
            +
             | 
| 304 323 | 
             
                [self showLoadingPage];
         | 
| 305 | 
            -
             | 
| 324 | 
            +
            	
         | 
| 306 325 | 
             
                cookies = [[NSMutableDictionary alloc] initWithCapacity:0];
         | 
| 307 326 |  | 
| 308 327 | 
             
                // Init controllers
         | 
| @@ -359,14 +378,14 @@ static Rhodes *instance = NULL; | |
| 359 378 |  | 
| 360 379 | 
             
                NSDictionary *aps = [userInfo objectForKey:@"aps"];
         | 
| 361 380 | 
             
                if (aps) {
         | 
| 362 | 
            -
                    NSString *alert = [aps objectForKey:@" | 
| 381 | 
            +
                    NSString *alert = [aps objectForKey:@"show_popup"];
         | 
| 363 382 | 
             
                    if (alert && [alert length] > 0) {
         | 
| 364 383 | 
             
                        NSLog(@"Push Alert: %@", alert);
         | 
| 365 384 | 
             
                        rho_param *p = rho_param_str((char*)[alert UTF8String]);
         | 
| 366 385 | 
             
                        [RhoAlert showPopup:p];
         | 
| 367 386 | 
             
                        rho_param_free(p);
         | 
| 368 387 | 
             
                    }
         | 
| 369 | 
            -
                    NSString *sound = [aps objectForKey:@" | 
| 388 | 
            +
                    NSString *sound = [aps objectForKey:@"play_file"];
         | 
| 370 389 | 
             
                    if (sound && [sound length] > 0) {
         | 
| 371 390 | 
             
                        NSLog(@"Sound file name: %@", sound);
         | 
| 372 391 | 
             
                        [RhoAlert playFile:[@"/public/alerts/" stringByAppendingPathComponent:sound] mediaType:NULL];
         | 
| @@ -10,17 +10,19 @@ | |
| 10 10 | 
             
            #import "RhoMainView.h"
         | 
| 11 11 |  | 
| 12 12 | 
             
            @interface SimpleMainView : UIViewController <RhoMainView, UIWebViewDelegate> {
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                UIView *root;
         | 
| 13 | 
            +
             | 
| 15 14 | 
             
                UIWebView *webView;
         | 
| 16 15 | 
             
                UIToolbar *toolbar;
         | 
| 17 16 | 
             
                UINavigationBar *navbar;
         | 
| 18 17 | 
             
            }
         | 
| 19 18 |  | 
| 20 | 
            -
            @property (retain) UIView *root;
         | 
| 21 19 |  | 
| 22 | 
            -
            - (id)initWithMainView:(id<RhoMainView>)v;
         | 
| 23 | 
            -
            - (id)initWithMainView:(id<RhoMainView>)v toolbar:(NSArray*)items;
         | 
| 20 | 
            +
            - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p;
         | 
| 21 | 
            +
            - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p toolbar:(NSArray*)items;
         | 
| 24 22 | 
             
            - (id)initWithParentView:(UIView *)p frame:(CGRect)frame;
         | 
| 25 23 |  | 
| 24 | 
            +
            - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
         | 
| 25 | 
            +
            - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;
         | 
| 26 | 
            +
            - (void)loadView;
         | 
| 27 | 
            +
             | 
| 26 28 | 
             
            @end
         | 
| @@ -57,7 +57,6 @@ | |
| 57 57 |  | 
| 58 58 | 
             
            @implementation SimpleMainView
         | 
| 59 59 |  | 
| 60 | 
            -
            @synthesize root;
         | 
| 61 60 |  | 
| 62 61 | 
             
            - (UIBarButtonItem*)newButton:(NSString*)url label:(NSString*)label icon:(NSString*)icon {
         | 
| 63 62 | 
             
                UIImage *img = nil;
         | 
| @@ -132,7 +131,7 @@ | |
| 132 131 | 
             
                }
         | 
| 133 132 |  | 
| 134 133 | 
             
                UIToolbar *tb = [UIToolbar new];
         | 
| 135 | 
            -
                tb.barStyle =  | 
| 134 | 
            +
                tb.barStyle = UIBarStyleBlack;//Opaque;
         | 
| 136 135 |  | 
| 137 136 | 
             
                [tb sizeToFit];
         | 
| 138 137 |  | 
| @@ -177,6 +176,10 @@ | |
| 177 176 |  | 
| 178 177 | 
             
                tb.hidden = NO;
         | 
| 179 178 | 
             
                tb.userInteractionEnabled = YES;
         | 
| 179 | 
            +
                tb.autoresizesSubviews = YES;
         | 
| 180 | 
            +
                tb.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
         | 
| 181 | 
            +
             	
         | 
| 182 | 
            +
            	
         | 
| 180 183 | 
             
                return tb;
         | 
| 181 184 | 
             
            }
         | 
| 182 185 |  | 
| @@ -199,13 +202,18 @@ | |
| 199 202 | 
             
                    return;
         | 
| 200 203 |  | 
| 201 204 | 
             
                CGRect wFrame = webView.frame;
         | 
| 205 | 
            +
            	wFrame.size.height += wFrame.origin.y;
         | 
| 206 | 
            +
            	wFrame.origin.y = 0;
         | 
| 202 207 |  | 
| 203 208 | 
             
                [toolbar removeFromSuperview];
         | 
| 204 209 | 
             
                toolbar = [self newToolbar:items frame:wFrame];
         | 
| 205 210 | 
             
                toolbar.tag = RHO_TAG_TOOLBAR;
         | 
| 211 | 
            +
                UIView* root = self.view;
         | 
| 206 212 | 
             
                [root addSubview:toolbar];
         | 
| 213 | 
            +
            	[toolbar release];
         | 
| 207 214 |  | 
| 208 215 | 
             
                CGRect tbFrame = toolbar.frame;
         | 
| 216 | 
            +
            	wFrame = webView.frame;
         | 
| 209 217 | 
             
                wFrame.size.height -= tbFrame.size.height;
         | 
| 210 218 | 
             
                webView.frame = wFrame;
         | 
| 211 219 | 
             
            }
         | 
| @@ -218,35 +226,145 @@ | |
| 218 226 | 
             
                w.autoresizesSubviews = YES;
         | 
| 219 227 | 
             
                w.clipsToBounds = NO;
         | 
| 220 228 | 
             
                w.dataDetectorTypes = UIDataDetectorTypeNone;
         | 
| 221 | 
            -
                w.delegate = self;
         | 
| 229 | 
            +
                //w.delegate = self;
         | 
| 230 | 
            +
                w.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
         | 
| 222 231 | 
             
                w.tag = RHO_TAG_WEBVIEW;
         | 
| 223 232 |  | 
| 224 233 | 
             
                return w;
         | 
| 225 234 | 
             
            }
         | 
| 226 235 |  | 
| 227 236 | 
             
            - (id)init:(UIView*)p webView:(UIWebView*)w frame:(CGRect)frame toolbar:(NSArray*)items {
         | 
| 228 | 
            -
             | 
| 229 | 
            -
             | 
| 230 | 
            -
                root =  | 
| 237 | 
            +
            	[self init];
         | 
| 238 | 
            +
            	
         | 
| 239 | 
            +
                UIView* root = self.view;
         | 
| 240 | 
            +
                root.frame = frame;
         | 
| 231 241 | 
             
                root.userInteractionEnabled = YES;
         | 
| 232 | 
            -
             | 
| 242 | 
            +
             	root.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
         | 
| 243 | 
            +
            	root.autoresizesSubviews = YES;
         | 
| 244 | 
            +
               
         | 
| 233 245 | 
             
                [webView removeFromSuperview];
         | 
| 234 246 | 
             
                webView = w;
         | 
| 235 247 | 
             
                if (!webView)
         | 
| 236 248 | 
             
                    webView = [self newWebView:frame];
         | 
| 237 249 | 
             
                [root addSubview:webView];
         | 
| 238 | 
            -
                 | 
| 250 | 
            +
                [webView release];
         | 
| 251 | 
            +
            	CGRect wFrame = frame;
         | 
| 239 252 | 
             
                wFrame.origin.y = 0;
         | 
| 240 253 | 
             
                webView.frame = wFrame;
         | 
| 241 254 |  | 
| 242 255 | 
             
                [self addToolbar:items];
         | 
| 243 256 | 
             
                navbar = nil;
         | 
| 244 257 |  | 
| 245 | 
            -
                self.view = root;
         | 
| 246 | 
            -
                
         | 
| 247 258 | 
             
                return self;
         | 
| 248 259 | 
             
            }
         | 
| 249 260 |  | 
| 261 | 
            +
             | 
| 262 | 
            +
             - (void)loadView {
         | 
| 263 | 
            +
            	 UIView* content = [[UIView alloc] init];
         | 
| 264 | 
            +
            	 //content.backgroundColor = [UIColor redColor];
         | 
| 265 | 
            +
            	 self.view = content;
         | 
| 266 | 
            +
            	 [content release];
         | 
| 267 | 
            +
            	 
         | 
| 268 | 
            +
            }
         | 
| 269 | 
            +
             | 
| 270 | 
            +
             | 
| 271 | 
            +
            - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
         | 
| 272 | 
            +
            {
         | 
| 273 | 
            +
            	if ([self interfaceOrientation] == fromInterfaceOrientation) {
         | 
| 274 | 
            +
            		return;
         | 
| 275 | 
            +
            	}
         | 
| 276 | 
            +
            	int width = rho_sys_get_screen_width();
         | 
| 277 | 
            +
            	int height = rho_sys_get_screen_height();
         | 
| 278 | 
            +
            	// send after rotate message
         | 
| 279 | 
            +
            	//CGRect wFrame = [webView frame];
         | 
| 280 | 
            +
            	int angle = 0;
         | 
| 281 | 
            +
            	switch (fromInterfaceOrientation) {
         | 
| 282 | 
            +
            		case UIInterfaceOrientationPortrait: {
         | 
| 283 | 
            +
            			switch ([self interfaceOrientation]) {
         | 
| 284 | 
            +
            				case UIInterfaceOrientationLandscapeLeft: {
         | 
| 285 | 
            +
            					angle = 90;
         | 
| 286 | 
            +
            				}
         | 
| 287 | 
            +
            					break;
         | 
| 288 | 
            +
            				case UIInterfaceOrientationPortraitUpsideDown: {
         | 
| 289 | 
            +
            					angle = 180;
         | 
| 290 | 
            +
            				}
         | 
| 291 | 
            +
            					break;
         | 
| 292 | 
            +
            				case UIInterfaceOrientationLandscapeRight: {
         | 
| 293 | 
            +
            					angle = -90;
         | 
| 294 | 
            +
            				}
         | 
| 295 | 
            +
            					break;
         | 
| 296 | 
            +
            			}
         | 
| 297 | 
            +
            		}
         | 
| 298 | 
            +
            		break;
         | 
| 299 | 
            +
            		case UIInterfaceOrientationLandscapeLeft: {
         | 
| 300 | 
            +
            			switch ([self interfaceOrientation]) {
         | 
| 301 | 
            +
            				case UIInterfaceOrientationPortrait: {
         | 
| 302 | 
            +
            					angle = -90;
         | 
| 303 | 
            +
            				}
         | 
| 304 | 
            +
            					break;
         | 
| 305 | 
            +
            				case UIInterfaceOrientationPortraitUpsideDown: {
         | 
| 306 | 
            +
            					angle = 90;
         | 
| 307 | 
            +
            				}
         | 
| 308 | 
            +
            					break;
         | 
| 309 | 
            +
            				case UIInterfaceOrientationLandscapeRight: {
         | 
| 310 | 
            +
            					angle = 180;
         | 
| 311 | 
            +
            				}
         | 
| 312 | 
            +
            					break;
         | 
| 313 | 
            +
            			}
         | 
| 314 | 
            +
            		}
         | 
| 315 | 
            +
            		break;
         | 
| 316 | 
            +
            		case UIInterfaceOrientationPortraitUpsideDown: {
         | 
| 317 | 
            +
            			switch ([self interfaceOrientation]) {
         | 
| 318 | 
            +
            				case UIInterfaceOrientationPortrait: {
         | 
| 319 | 
            +
            					angle = 180;
         | 
| 320 | 
            +
            				}
         | 
| 321 | 
            +
            					break;
         | 
| 322 | 
            +
            				case UIInterfaceOrientationLandscapeLeft: {
         | 
| 323 | 
            +
            					angle = -90;
         | 
| 324 | 
            +
            				}
         | 
| 325 | 
            +
            					break;
         | 
| 326 | 
            +
            				case UIInterfaceOrientationLandscapeRight: {
         | 
| 327 | 
            +
            					angle = 90;
         | 
| 328 | 
            +
            				}
         | 
| 329 | 
            +
            					break;
         | 
| 330 | 
            +
            			}
         | 
| 331 | 
            +
            		}
         | 
| 332 | 
            +
            		break;
         | 
| 333 | 
            +
            		case UIInterfaceOrientationLandscapeRight: {
         | 
| 334 | 
            +
            			switch ([self interfaceOrientation]) {
         | 
| 335 | 
            +
            				case UIInterfaceOrientationPortrait: {
         | 
| 336 | 
            +
            					angle = 90;
         | 
| 337 | 
            +
            				}
         | 
| 338 | 
            +
            					break;
         | 
| 339 | 
            +
            				case UIInterfaceOrientationLandscapeLeft: {
         | 
| 340 | 
            +
            					angle = 180;
         | 
| 341 | 
            +
            				}
         | 
| 342 | 
            +
            					break;
         | 
| 343 | 
            +
            				case UIInterfaceOrientationPortraitUpsideDown: {
         | 
| 344 | 
            +
            					angle = -90;
         | 
| 345 | 
            +
            				}
         | 
| 346 | 
            +
            					break;
         | 
| 347 | 
            +
            			}
         | 
| 348 | 
            +
            		}
         | 
| 349 | 
            +
            		break;
         | 
| 350 | 
            +
            	}
         | 
| 351 | 
            +
            	if (([self interfaceOrientation] == UIInterfaceOrientationLandscapeLeft) || ([self interfaceOrientation] == UIInterfaceOrientationLandscapeRight)) {
         | 
| 352 | 
            +
            		int t = width;
         | 
| 353 | 
            +
            		width = height;
         | 
| 354 | 
            +
            		height = t;
         | 
| 355 | 
            +
            	}
         | 
| 356 | 
            +
            	//rho_rhodesapp_callScreenRotationCallback((int)wFrame.size.width, (int)wFrame.size.height, angle);
         | 
| 357 | 
            +
            	rho_rhodesapp_callScreenRotationCallback(width, height, angle);
         | 
| 358 | 
            +
            }
         | 
| 359 | 
            +
             | 
| 360 | 
            +
             | 
| 361 | 
            +
             | 
| 362 | 
            +
            - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
         | 
| 363 | 
            +
            	// custom rotation code based on interfaceOrientation here...
         | 
| 364 | 
            +
            	return YES;
         | 
| 365 | 
            +
            }
         | 
| 366 | 
            +
             | 
| 367 | 
            +
             | 
| 250 368 | 
             
            - (id)initWithParentView:(UIView *)p frame:(CGRect)frame toolbar:(NSArray*)items {
         | 
| 251 369 | 
             
                return [self init:p webView:nil frame:frame toolbar:items];
         | 
| 252 370 | 
             
            }
         | 
| @@ -255,22 +373,21 @@ | |
| 255 373 | 
             
                return [self initWithParentView:p frame:frame toolbar:nil];
         | 
| 256 374 | 
             
            }
         | 
| 257 375 |  | 
| 258 | 
            -
            - (id)initWithMainView:(id<RhoMainView>)v {
         | 
| 259 | 
            -
                return [self initWithMainView:v toolbar:nil];
         | 
| 376 | 
            +
            - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p {
         | 
| 377 | 
            +
                return [self initWithMainView:v parent:p toolbar:nil];
         | 
| 260 378 | 
             
            }
         | 
| 261 379 |  | 
| 262 | 
            -
            - (id)initWithMainView:(id<RhoMainView>)v toolbar:(NSArray*)items {
         | 
| 263 | 
            -
                UIView *p = [v parent];
         | 
| 380 | 
            +
            - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p toolbar:(NSArray*)items {
         | 
| 264 381 | 
             
                CGRect frame = [[v view] frame];
         | 
| 265 382 | 
             
                //UIWebView *w = (UIWebView*)[Rhodes subviewWithTag:RHO_TAG_WEBVIEW ofView:[v view]];
         | 
| 266 383 | 
             
                UIWebView *w = [v detachWebView];
         | 
| 267 | 
            -
                 | 
| 384 | 
            +
                id result = [self init:p webView:w frame:frame toolbar:items];
         | 
| 385 | 
            +
             | 
| 268 386 | 
             
            }
         | 
| 269 387 |  | 
| 270 388 | 
             
            - (void)didReceiveMemoryWarning {
         | 
| 271 389 | 
             
                // Releases the view if it doesn't have a superview.
         | 
| 272 390 | 
             
                [super didReceiveMemoryWarning];
         | 
| 273 | 
            -
                
         | 
| 274 391 | 
             
                // Release any cached data, images, etc that aren't in use.
         | 
| 275 392 | 
             
            }
         | 
| 276 393 |  | 
| @@ -279,8 +396,9 @@ | |
| 279 396 | 
             
            }
         | 
| 280 397 |  | 
| 281 398 | 
             
            - (void)dealloc {
         | 
| 282 | 
            -
                 | 
| 283 | 
            -
                [root  | 
| 399 | 
            +
                //UIView* root = self.view;
         | 
| 400 | 
            +
                //[root removeFromSuperview];
         | 
| 401 | 
            +
                //[root release];
         | 
| 284 402 | 
             
                [super dealloc];
         | 
| 285 403 | 
             
            }
         | 
| 286 404 |  | 
| @@ -308,15 +426,6 @@ | |
| 308 426 | 
             
                [self reload:0];
         | 
| 309 427 | 
             
            }
         | 
| 310 428 |  | 
| 311 | 
            -
            // RhoMainView implementation
         | 
| 312 | 
            -
             | 
| 313 | 
            -
            - (UIView*)view {
         | 
| 314 | 
            -
                return root;
         | 
| 315 | 
            -
            }
         | 
| 316 | 
            -
             | 
| 317 | 
            -
            - (UIView*)parent {
         | 
| 318 | 
            -
                return parent;
         | 
| 319 | 
            -
            }
         | 
| 320 429 |  | 
| 321 430 | 
             
            - (UIWebView*)detachWebView {
         | 
| 322 431 | 
             
                UIWebView *w = [webView retain];
         | 
| @@ -384,6 +493,23 @@ | |
| 384 493 | 
             
                return 0;
         | 
| 385 494 | 
             
            }
         | 
| 386 495 |  | 
| 496 | 
            +
            - (void)addNavBar:(UINavigationBar*)navb {
         | 
| 497 | 
            +
                [navbar removeFromSuperview];
         | 
| 498 | 
            +
                navbar = navb;
         | 
| 499 | 
            +
            	navbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
         | 
| 500 | 
            +
            	navbar.autoresizesSubviews = YES;
         | 
| 501 | 
            +
            	
         | 
| 502 | 
            +
            	UIView* root = self.view;
         | 
| 503 | 
            +
                [root addSubview:navbar];
         | 
| 504 | 
            +
            	[navbar release];
         | 
| 505 | 
            +
                
         | 
| 506 | 
            +
                CGRect nFrame = navbar.frame;
         | 
| 507 | 
            +
                CGRect wFrame = webView.frame;
         | 
| 508 | 
            +
                wFrame.origin.y += nFrame.size.height;
         | 
| 509 | 
            +
                wFrame.size.height -= nFrame.size.height;
         | 
| 510 | 
            +
                webView.frame = wFrame;
         | 
| 511 | 
            +
            }
         | 
| 512 | 
            +
             | 
| 387 513 | 
             
            - (void)addNavBar:(NSString*)title left:(NSArray*)left right:(NSArray*)right {
         | 
| 388 514 | 
             
                [self removeNavBar];
         | 
| 389 515 |  | 
| @@ -411,15 +537,8 @@ | |
| 411 537 | 
             
                }
         | 
| 412 538 |  | 
| 413 539 | 
             
                [nb pushNavigationItem:ni animated:NO];
         | 
| 414 | 
            -
             | 
| 415 | 
            -
             | 
| 416 | 
            -
                [root addSubview:navbar];
         | 
| 417 | 
            -
                
         | 
| 418 | 
            -
                CGRect nFrame = navbar.frame;
         | 
| 419 | 
            -
                CGRect wFrame = webView.frame;
         | 
| 420 | 
            -
                wFrame.origin.y += nFrame.size.height;
         | 
| 421 | 
            -
                wFrame.size.height -= nFrame.size.height;
         | 
| 422 | 
            -
                webView.frame = wFrame;
         | 
| 540 | 
            +
            	
         | 
| 541 | 
            +
            	[self addNavBar:nb];
         | 
| 423 542 | 
             
            }
         | 
| 424 543 |  | 
| 425 544 | 
             
            - (void)removeNavBar {
         | 
| @@ -10,7 +10,6 @@ | |
| 10 10 | 
             
            #import "RhoMainView.h"
         | 
| 11 11 |  | 
| 12 12 | 
             
            @interface TabbedMainView : UIViewController<RhoMainView> {
         | 
| 13 | 
            -
                UIView *parent;
         | 
| 14 13 | 
             
                UITabBarController *tabbar;
         | 
| 15 14 | 
             
                NSArray *tabbarData;
         | 
| 16 15 | 
             
            }
         | 
| @@ -18,8 +17,7 @@ | |
| 18 17 | 
             
            @property (nonatomic,retain) UITabBarController *tabbar;
         | 
| 19 18 | 
             
            @property (nonatomic,retain) NSArray *tabbarData;
         | 
| 20 19 |  | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
            - (id)initWithMainView:(id<RhoMainView>)v tabs:(NSArray*)items;
         | 
| 20 | 
            +
            - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p tabs:(NSArray*)items;
         | 
| 21 | 
            +
            - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
         | 
| 24 22 |  | 
| 25 23 | 
             
            @end
         | 
| @@ -54,13 +54,16 @@ | |
| 54 54 |  | 
| 55 55 | 
             
            @synthesize tabbar, tabbarData;
         | 
| 56 56 |  | 
| 57 | 
            -
            //- (id)initWithParentView:(UIView *)v items:(NSArray *)items {
         | 
| 58 | 
            -
            //    return [self initWithParentView:v frame:v.frame items:items];
         | 
| 59 | 
            -
            //}
         | 
| 60 57 |  | 
| 61 | 
            -
             | 
| 62 | 
            -
            - ( | 
| 63 | 
            -
             | 
| 58 | 
            +
             | 
| 59 | 
            +
            - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
         | 
| 60 | 
            +
            	// custom rotation code based on interfaceOrientation here...
         | 
| 61 | 
            +
            	return YES;
         | 
| 62 | 
            +
            }
         | 
| 63 | 
            +
             | 
| 64 | 
            +
             | 
| 65 | 
            +
            - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p tabs:(NSArray *)items {
         | 
| 66 | 
            +
                UIView* parent = p;
         | 
| 64 67 |  | 
| 65 68 | 
             
                CGRect frame = [[v view] frame];
         | 
| 66 69 |  | 
| @@ -132,8 +135,10 @@ | |
| 132 135 | 
             
            }
         | 
| 133 136 |  | 
| 134 137 | 
             
            - (void)dealloc {
         | 
| 135 | 
            -
                [tabbar.view removeFromSuperview];
         | 
| 138 | 
            +
                //[tabbar.view removeFromSuperview];
         | 
| 136 139 | 
             
                [tabbarData release];
         | 
| 140 | 
            +
            	[tabbar release];
         | 
| 141 | 
            +
            	tabbar = nil;
         | 
| 137 142 | 
             
                [super dealloc];
         | 
| 138 143 | 
             
            }
         | 
| 139 144 |  | 
| @@ -151,9 +156,6 @@ | |
| 151 156 | 
             
                return tabbar.view;
         | 
| 152 157 | 
             
            }
         | 
| 153 158 |  | 
| 154 | 
            -
            - (UIView*)parent {
         | 
| 155 | 
            -
                return parent;
         | 
| 156 | 
            -
            }
         | 
| 157 159 |  | 
| 158 160 | 
             
            - (UIWebView*)detachWebView {
         | 
| 159 161 | 
             
                return [[self subView:[self activeTab]] detachWebView];
         |