Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Generic launch activities #16

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions myLauncher/Classes/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
UINavigationController *navigationController;
}

@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) UINavigationController *navigationController;
@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) UINavigationController *navigationController;

@end

5 changes: 3 additions & 2 deletions myLauncher/Classes/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// Copyright 2010 Rodrigo Neri
// Copyright 2011 David Jarrett
// Copyright 2012 Nicolas Desjardins
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,9 +38,9 @@ - (void)applicationDidFinishLaunching:(UIApplication*)application
[[RootViewController alloc] init]];
navigationController.navigationBar.tintColor = COLOR(2, 100, 162);

[window addSubview:navigationController.view];
[window setRootViewController:navigationController];
[window makeKeyAndVisible];
[window layoutSubviews];

}

@end
5 changes: 0 additions & 5 deletions myLauncher/Classes/MyLauncher/CustomBadge.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ + (CustomBadge*) customBadgeWithString:(NSString *)badgeString withStringColor:(
return [[self alloc] initWithString:badgeString withStringColor:stringColor withInsetColor:insetColor withBadgeFrame:badgeFrameYesNo withBadgeFrameColor:frameColor withScale:scale withShining:shining];
}





// Draws the Badge with Quartz
-(void) drawRoundedRectWithContext:(CGContextRef)context withRect:(CGRect)rect
{
Expand Down Expand Up @@ -211,7 +207,6 @@ -(void) drawFrameWithContext:(CGContextRef)context withRect:(CGRect)rect
CGContextStrokePath(context);
}


- (void)drawRect:(CGRect)rect {

CGContextRef context = UIGraphicsGetCurrentContext();
Expand Down
28 changes: 28 additions & 0 deletions myLauncher/Classes/MyLauncher/MyLauncherGenericItem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// MyLauncherGenericItem.h
//
// Copyright 2012 Nicolas Desjardins
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "MyLauncherItem.h"
#import "MyLauncherGenericItemDelegate.h"

@interface MyLauncherGenericItem : MyLauncherItem

@property (nonatomic, strong) id<MyLauncherGenericItemDelegate> genericDelegate;

-(id)initWithTitle:(NSString*)title delegate:(id<MyLauncherGenericItemDelegate>)genericDelegate deletable:(BOOL)deletable;

@end
53 changes: 53 additions & 0 deletions myLauncher/Classes/MyLauncher/MyLauncherGenericItem.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// MyLauncherGenericItem.h
//
// Copyright 2012 Nicolas Desjardins
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "MyLauncherGenericItem.h"

@implementation MyLauncherGenericItem

@synthesize genericDelegate = _genericDelegate;


-(id)initWithTitle:(NSString*)title delegate:(id<MyLauncherGenericItemDelegate>)genericDelegate deletable:(BOOL)deletable {
if((self = [super initWithTitle:title deletable:deletable]))
{
_genericDelegate = genericDelegate;
}
return self;
}

-(void)selected:(MyLauncherViewController*)parent {
[_genericDelegate start];
}

-(UIImage*)icon {
return [_genericDelegate icon];
}

-(NSMutableDictionary*)itemToSave {
NSMutableDictionary *itemToSave = [super itemToSave];

NSData *data = [NSKeyedArchiver archivedDataWithRootObject:_genericDelegate];
[itemToSave setObject:data forKey:@"genericDelegate"];

return itemToSave;
}



@end
18 changes: 18 additions & 0 deletions myLauncher/Classes/MyLauncher/MyLauncherGenericItemDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// MyLauncherGenericItemDelegate.h
// MyLauncher
//
// Created by Nicolas Desjardins on 2012-07-04.
//
//

#import <Foundation/Foundation.h>

@protocol MyLauncherGenericItemDelegate <NSObject>

-(void)start;
-(UIImage*)icon;
-(int)itemId;
-(int)version;

@end
35 changes: 19 additions & 16 deletions myLauncher/Classes/MyLauncher/MyLauncherItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// Copyright 2010 Rodrigo Neri
// Copyright 2011 David Jarrett
// Copyright 2012 Nicolas Desjardins
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,31 +19,33 @@
// limitations under the License.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "CustomBadge.h"

@class CustomBadge;
@class MyLauncherViewController;

@protocol MyLauncherItemDelegate <NSObject>
-(void)didDeleteItem:(id)item;
@end

@interface MyLauncherItem : UIControl {
BOOL dragging;
BOOL deletable;
BOOL titleBoundToBottom;
BOOL _dragging;
BOOL _titleBoundToBottom;
}

@property (nonatomic, assign) id delegate;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *image;
@property (nonatomic, retain) NSString *iPadImage;
@property (nonatomic, retain) NSString *controllerStr;
@property (nonatomic, retain) NSString *controllerTitle;
@property (nonatomic, retain) UIButton *closeButton;
@property (nonatomic, retain) CustomBadge *badge;

-(id)initWithTitle:(NSString *)title image:(NSString *)image target:(NSString *)targetControllerStr deletable:(BOOL)_deletable;
-(id)initWithTitle:(NSString *)title iPhoneImage:(NSString *)image iPadImage:(NSString *)iPadImage target:(NSString *)targetControllerStr targetTitle:(NSString *)targetTitle deletable:(BOOL)_deletable;
@property (nonatomic, strong) NSString *title;
@property (nonatomic, unsafe_unretained) id delegate;
@property (nonatomic, strong) CustomBadge *badge;
@property (nonatomic, strong) UIButton *closeButton;
@property (nonatomic) BOOL deletable;


-(id)initWithTitle:(NSString*)title deletable:(BOOL)deletable;

-(NSMutableDictionary*)itemToSave;

-(void)selected:(MyLauncherViewController*)parent;

-(void)layoutItem;
-(void)setDragging:(BOOL)flag;
-(BOOL)dragging;
Expand Down
Loading