summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-25 15:06:42 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-07 02:41:20 -0800
commit65ea9562dea67390b0d4a1d8d6ed2f1593d4418b (patch)
tree966c952e6c7c7d55795e788b8e8ac61367bf59b3
parent740b712de9e2b43b52af962810595303c935c688 (diff)
Use a real grouped table view to back our webviews.
-rw-r--r--MobileCydia.mm12
-rw-r--r--UICaboodle/BrowserView.mm21
2 files changed, 14 insertions, 19 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 0b4b56e..3626b88 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -4516,16 +4516,12 @@ static NSString *Warning_;
} return self;
}
-// XXX: factor this out somewhere
-- (UIColor *) groupTableViewBackgroundColor {
- UIDevice *device([UIDevice currentDevice]);
- bool iPad([device respondsToSelector:@selector(userInterfaceIdiom)] && [device userInterfaceIdiom] == UIUserInterfaceIdiomPad);
- return iPad ? [UIColor colorWithRed:0.821 green:0.834 blue:0.860 alpha:1] : [UIColor groupTableViewBackgroundColor];
-}
-
- (void) loadView {
[self setView:[[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]];
- [[self view] setBackgroundColor:[self groupTableViewBackgroundColor]];
+
+ UITableView *table([[[UITableView alloc] initWithFrame:[[self view] bounds] style:UITableViewStyleGrouped] autorelease]);
+ [table setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
+ [[self view] addSubview:table];
indicator_ = [[[CYLoadingIndicator alloc] initWithFrame:[[self view] bounds]] autorelease];
[indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index d145067..9858598 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -769,13 +769,6 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
[self _didFailWithError:error forFrame:frame];
}
-// XXX: factor this out somewhere
-- (UIColor *) groupTableViewBackgroundColor {
- UIDevice *device([UIDevice currentDevice]);
- bool iPad([device respondsToSelector:@selector(userInterfaceIdiom)] && [device userInterfaceIdiom] == UIUserInterfaceIdiomPad);
- return iPad ? [UIColor colorWithRed:0.821 green:0.834 blue:0.860 alpha:1] : [UIColor groupTableViewBackgroundColor];
-}
-
- (void) webView:(WebView *)view didFinishLoadForFrame:(WebFrame *)frame {
[loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
@@ -785,7 +778,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
for (DOMHTMLBodyElement *body in (id) bodies) {
DOMCSSStyleDeclaration *style([document getComputedStyle:body pseudoElement:nil]);
- UIColor *uic([self groupTableViewBackgroundColor]);
+ UIColor *uic(nil);
if (DOMCSSPrimitiveValue *color = static_cast<DOMCSSPrimitiveValue *>([style getPropertyCSSValue:@"background-color"])) {
if ([color primitiveType] == DOM_CSS_RGBCOLOR) {
@@ -808,7 +801,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
}
}
- [scroller_ setBackgroundColor:uic];
+ [scroller_ setBackgroundColor:(uic ?: [UIColor clearColor])];
break;
}
}
@@ -1017,7 +1010,9 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
indirect_ = [[IndirectDelegate alloc] initWithDelegate:self];
- webview_ = [[[CYWebView alloc] initWithFrame:[[self view] bounds]] autorelease];
+ CGRect bounds([[self view] bounds]);
+
+ webview_ = [[[CYWebView alloc] initWithFrame:bounds] autorelease];
[webview_ setDelegate:self];
[self setView:webview_];
@@ -1084,7 +1079,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
}
[scroller_ setFixedBackgroundPattern:YES];
- [scroller_ setBackgroundColor:[self groupTableViewBackgroundColor]];
+ [scroller_ setBackgroundColor:[UIColor clearColor]];
[scroller_ setClipsSubviews:YES];
[scroller_ setBounces:YES];
@@ -1110,6 +1105,10 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
indicator_ = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
[indicator_ setFrame:CGRectMake(15, 5, [indicator_ frame].size.width, [indicator_ frame].size.height)];
+ UITableView *table([[[UITableView alloc] initWithFrame:bounds style:UITableViewStyleGrouped] autorelease]);
+ [webview_ insertSubview:table atIndex:0];
+
+ [table setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
[webview_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
[indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
} return self;