From: Jay Freeman (saurik) Date: Sun, 13 Feb 2011 04:09:34 +0000 (-0800) Subject: Refactor the placard code with background colors. X-Git-Tag: v1.1.0%b1~355 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/d832908d84e841b49f26cda2c8e1fd7591feca87?ds=inline Refactor the placard code with background colors. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index f7f0ee47..776e929d 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -4972,18 +4972,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } return self; } -- (void) _setBackgroundColor { - UIColor *color; - if (NSString *mode = [package_ mode]) { - bool remove([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]); - color = remove ? RemovingColor_ : InstallingColor_; - } else - color = [UIColor whiteColor]; - - [content_ setBackgroundColor:color]; - [self setNeedsDisplay]; -} - - (NSString *) accessibilityLabel { return [NSString stringWithFormat:UCLocalize("COLON_DELIMITED"), name_, description_]; } @@ -5034,11 +5022,36 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { if ((badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]]) != nil) badge_ = [badge_ retain]; - if ([package installed] != nil) - if ((placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/installed.png", App_]]) != nil) + UIColor *color; + NSString *placard; + + if (NSString *mode = [package_ mode]) { + if ([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]) { + color = RemovingColor_; + //placard = @"removing"; + } else { + color = InstallingColor_; + //placard = @"installing"; + } + + // XXX: the removing/installing placards are not @2x + placard = nil; + } else { + color = [UIColor whiteColor]; + + if ([package installed] != nil) + placard = @"installed"; + else + placard = nil; + } + + [content_ setBackgroundColor:color]; + + if (placard != nil) + if ((placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/%@.png", App_, placard]]) != nil) placard_ = [placard_ retain]; - [self _setBackgroundColor]; + [self setNeedsDisplay]; [content_ setNeedsDisplay]; }