Skip to content

Commit

Permalink
add theme support
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis committed Dec 19, 2013
1 parent ef63662 commit f3544be
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
17 changes: 16 additions & 1 deletion VZ/VZM.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,26 @@

#import <AVOSCloud/AVHTTPClient.h>

typedef enum{
VZThemeTypeModern =0,
VZThemeTypeLight
} VZThemeType;

@interface VZTheme: NSObject
+(void)changeTheme:(VZThemeType)theme;
+(UIColor *)textColor;
+(UIColor *)bgColor;

@end


@interface VZM : NSObject

@property(nonatomic,assign) BOOL showPostsWithPicsOnly;
@property(nonatomic,assign) BOOL showAroundOnly;

@property(nonatomic,assign) BOOL showPostsWithPicsOnly;
@property(nonatomic,assign) VZThemeType theme;

@property(nonatomic,retain) AVHTTPClient *client;

+(VZM*)shared;
Expand Down
30 changes: 29 additions & 1 deletion VZ/VZM.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,39 @@
#import <AVOSCloudSNS/AVUser+SNS.h>
#import <AVOSCloud/AVJSONRequestOperation.h>

@implementation VZTheme
+(void)changeTheme:(VZThemeType)theme{
model.theme=theme;
[[NSUserDefaults standardUserDefaults] setInteger:theme forKey:@"Theme"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+(UIColor *)textColor{
switch(model.theme){
case VZThemeTypeLight:
return [UIColor lightTextColor];
case VZThemeTypeModern:
return [UIColor whiteColor];
}
return nil;
}
+(UIColor *)bgColor{
switch(model.theme){
case VZThemeTypeLight:
return [UIColor lightTextColor];
case VZThemeTypeModern:
return [UIColor whiteColor];
}
return nil;
}

@end

@implementation VZM
+(VZM*)shared{
static VZM *_vzm_=Nil;
if (_vzm_==Nil) {
_vzm_=[VZM new];
}

return _vzm_;
}

Expand All @@ -28,6 +54,8 @@ - (id)init
[VZPost registerSubclass];
[VZUser registerSubclass];

self.theme=[[NSUserDefaults standardUserDefaults] integerForKey:@"Theme"];

AVHTTPClient *client=[[AVHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"vz.avosapps.com"]];
self.client=client;
}
Expand Down

0 comments on commit f3544be

Please sign in to comment.