]> git.saurik.com Git - cydia.git/commitdiff
Transfer shared content code to CyteTableViewCell.
authorJay Freeman (saurik) <saurik@saurik.com>
Sat, 11 Mar 2017 05:46:41 +0000 (21:46 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Sat, 11 Mar 2017 05:46:41 +0000 (21:46 -0800)
CyteKit/TableViewCell.mm
MobileCydia.mm

index 827440bf988288194539e0daf0b8eeac07281c09..1b9152eeffa3aedbec57abfaf1c0e3955c2bffd1 100644 (file)
     bool highlighted_;
 }
 
+- (instancetype) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
+    if ((self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) != nil) {
+        UIView *content([self contentView]);
+        CGRect bounds([content bounds]);
+
+        self.content = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease];
+        [self.content setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
+        [content addSubview:self.content];
+
+        [self.content setDelegate:(id<CyteTableViewCellDelegate>)self];
+    } return self;
+}
+
 - (void) _updateHighlightColorsForView:(UIView *)view highlighted:(BOOL)highlighted {
     if (view == (UIView *) content_)
         highlighted_ = highlighted;
index 302f7d0bc3af2f87100f89804ee23c35ca44a916..4be6750c71ad2defd07378cbb52f6e6b703ad67e 100644 (file)
@@ -5337,14 +5337,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (PackageCell *) init {
     CGRect frame(CGRectMake(0, 0, 320, 74));
     if ((self = [super initWithFrame:frame reuseIdentifier:@"Package"]) != nil) {
-        UIView *content([self contentView]);
-        CGRect bounds([content bounds]);
-
-        self.content = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease];
-        [self.content setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
-        [content addSubview:self.content];
-
-        [self.content setDelegate:self];
         [self.content setOpaque:YES];
     } return self;
 }
@@ -5560,15 +5552,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         switch_ = [[[UISwitch alloc] initWithFrame:CGRectMake(218, 9, 60, 25)] autorelease];
         [switch_ addTarget:self action:@selector(onSwitch:) forEvents:UIControlEventValueChanged];
 
-        UIView *content([self contentView]);
-        CGRect bounds([content bounds]);
-
-        self.content = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease];
-        [self.content setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
-        [content addSubview:self.content];
         [self.content setBackgroundColor:[UIColor whiteColor]];
-
-        [self.content setDelegate:self];
     } return self;
 }
 
@@ -7524,20 +7508,12 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
 
 - (SourceCell *) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
     if ((self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) != nil) {
-        UIView *content([self contentView]);
-        CGRect bounds([content bounds]);
-
-        self.content = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease];
-        [self.content setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
         [self.content setBackgroundColor:[UIColor whiteColor]];
-        [content addSubview:self.content];
-
-        [self.content setDelegate:self];
         [self.content setOpaque:YES];
 
         indicator_ = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGraySmall] autorelease];
         [indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin];// | UIViewAutoresizingFlexibleBottomMargin];
-        [content addSubview:indicator_];
+        [[self contentView] addSubview:indicator_];
 
         [[self.content layer] setContentsGravity:kCAGravityTopLeft];
     } return self;