summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-12 20:09:34 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-02-12 20:09:34 -0800
commitd832908d84e841b49f26cda2c8e1fd7591feca87 (patch)
tree37943f0bd98473eb634541f4fed49d8ba69756e3
parent673e8fa371d472841a7b2bcf552fcc728738ff42 (diff)
Refactor the placard code with background colors.
-rw-r--r--MobileCydia.mm43
1 files changed, 28 insertions, 15 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index f7f0ee4..776e929 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];
}