Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use streched image for lock screen

  • Loading branch information...
commit a7704a70e5aedf8a27b07335699ed1a35e7badbd 1 parent efc0fb8
@tallerthenyou tallerthenyou authored
View
8 MiniKeePass.xcodeproj/project.pbxproj
@@ -24,6 +24,8 @@
52CF7D8D1542516300D681C1 /* Default-Portrait~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52CF7D8C1542516300D681C1 /* Default-Portrait~ipad.png */; };
52CF7D8F1542516900D681C1 /* icon@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52CF7D8E1542516900D681C1 /* icon@2x~ipad.png */; };
52CF7D911542516D00D681C1 /* icon~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52CF7D901542516D00D681C1 /* icon~ipad.png */; };
+ 52E3342D161E0F310049F4A1 /* stretchme.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E3342B161E0F310049F4A1 /* stretchme.png */; };
+ 52E3342E161E0F310049F4A1 /* stretchme@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E3342C161E0F310049F4A1 /* stretchme@2x.png */; };
52E43F4C15B59C890029F979 /* ru-createdb.html in Resources */ = {isa = PBXBuildFile; fileRef = 52E43F4715B59C880029F979 /* ru-createdb.html */; };
52E43F4D15B59C890029F979 /* ru-dropbox.html in Resources */ = {isa = PBXBuildFile; fileRef = 52E43F4815B59C880029F979 /* ru-dropbox.html */; };
52E43F4E15B59C890029F979 /* ru-itunes.html in Resources */ = {isa = PBXBuildFile; fileRef = 52E43F4915B59C890029F979 /* ru-itunes.html */; };
@@ -302,6 +304,8 @@
52CF7D8C1542516300D681C1 /* Default-Portrait~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait~ipad.png"; sourceTree = "<group>"; };
52CF7D8E1542516900D681C1 /* icon@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon@2x~ipad.png"; sourceTree = "<group>"; };
52CF7D901542516D00D681C1 /* icon~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon~ipad.png"; sourceTree = "<group>"; };
+ 52E3342B161E0F310049F4A1 /* stretchme.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = stretchme.png; sourceTree = SOURCE_ROOT; };
+ 52E3342C161E0F310049F4A1 /* stretchme@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stretchme@2x.png"; sourceTree = SOURCE_ROOT; };
52E43F4715B59C880029F979 /* ru-createdb.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "ru-createdb.html"; sourceTree = "<group>"; };
52E43F4815B59C880029F979 /* ru-dropbox.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "ru-dropbox.html"; sourceTree = "<group>"; };
52E43F4915B59C890029F979 /* ru-itunes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "ru-itunes.html"; sourceTree = "<group>"; };
@@ -699,6 +703,8 @@
52370CB314F2CDC3003DC64C /* Lock Screen */ = {
isa = PBXGroup;
children = (
+ 52E3342B161E0F310049F4A1 /* stretchme.png */,
+ 52E3342C161E0F310049F4A1 /* stretchme@2x.png */,
689D043813A42C81005EBD36 /* PinTextField.h */,
689D043913A42C81005EBD36 /* PinTextField.m */,
689D043A13A42C81005EBD36 /* PinViewController.h */,
@@ -1488,6 +1494,8 @@
52E43F4F15B59C890029F979 /* ru-keyfiles.html in Resources */,
52E43F5015B59C890029F979 /* ru-safariemail.html in Resources */,
6894F93E16129E6B00288AE0 /* Default-568h@2x.png in Resources */,
+ 52E3342D161E0F310049F4A1 /* stretchme.png in Resources */,
+ 52E3342E161E0F310049F4A1 /* stretchme@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
6 MiniKeePass/FilesInfoView.h
@@ -17,10 +17,6 @@
#import <UIKit/UIKit.h>
-@interface FilesInfoView : UIView {
- UIView *containerView;
- CGFloat containerWidth;
- CGFloat containerHeight;
-}
+@interface FilesInfoView : UIView
@end
View
11 MiniKeePass/FilesInfoView.m
@@ -17,6 +17,13 @@
#import "FilesInfoView.h"
+@interface FilesInfoView () {
+ UIView *containerView;
+ CGFloat containerWidth;
+ CGFloat containerHeight;
+}
+@end
+
@implementation FilesInfoView
- (id)initWithFrame:(CGRect)frame {
@@ -26,11 +33,8 @@ - (id)initWithFrame:(CGRect)frame {
self.backgroundColor = [UIColor whiteColor];
CGFloat viewWidth = CGRectGetWidth(self.frame);
-
UIImage *image = [UIImage imageNamed:@"background"];
- CGFloat y = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 240.0f : 40.0f;
-
CGFloat imageWidth = image.size.width;
CGFloat imageHeight = image.size.height;
@@ -56,6 +60,7 @@ - (id)initWithFrame:(CGRect)frame {
label.textColor = [UIColor grayColor];
label.text = NSLocalizedString(@"You do not have any KeePass files available for MiniKeePass to open.", nil);
+ CGFloat y = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 240.0f : 40.0f;
containerView = [[UIView alloc] initWithFrame:CGRectMake((viewWidth - containerWidth) / 2.0f, y, containerWidth, containerHeight)];
containerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[containerView addSubview:imageView];
View
6 MiniKeePass/LockScreenController.h
@@ -19,11 +19,7 @@
#import "PinViewController.h"
#import "AutorotatingViewController.h"
-@interface LockScreenController : UIViewController <PinViewControllerDelegate> {
- PinViewController *pinViewController;
- MiniKeePassAppDelegate *appDelegate;
- UIViewController *previousViewController;
-}
+@interface LockScreenController : UIViewController <PinViewControllerDelegate>
+ (void)present;
View
18 MiniKeePass/LockScreenController.m
@@ -24,6 +24,13 @@
#define DURATION 0.3
+@interface LockScreenController () {
+ PinViewController *pinViewController;
+ MiniKeePassAppDelegate *appDelegate;
+ UIViewController *previousViewController;
+}
+@end
+
@implementation LockScreenController
- (id)init {
@@ -32,12 +39,15 @@ - (id)init {
pinViewController = [[PinViewController alloc] init];
pinViewController.delegate = self;
- self.view.backgroundColor = [UIColor colorWithRed:0.831372f green:0.843137f blue:0.870588f alpha:1.0f];
-
appDelegate = (MiniKeePassAppDelegate*)[[UIApplication sharedApplication] delegate];
+
+ UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.frame];
+ imageView.image = [[UIImage imageNamed:@"stretchme"] stretchableImageWithLeftCapWidth:0 topCapHeight:44];
+ self.view = imageView;
+ [imageView release];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
- [notificationCenter addObserver:self
+ [notificationCenter addObserver:self
selector:@selector(applicationDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
@@ -86,7 +96,7 @@ - (void)hide {
- (void)lock {
if (!appDelegate.locked) {
pinViewController.textLabel.text = NSLocalizedString(@"Enter your PIN to unlock", nil);
- [self presentModalViewController:pinViewController animated:YES];
+ [self presentModalViewController:pinViewController animated:NO];
}
}
View
19 MiniKeePass/MiniKeePassAppDelegate.h
@@ -21,20 +21,7 @@
#define NUM_IMAGES 69
-@interface MiniKeePassAppDelegate : NSObject <UIApplicationDelegate, UIActionSheetDelegate> {
- UIWindow *window;
- UINavigationController *navigationController;
- UIActionSheet* myActionSheet;
- id<UIActionSheetDelegate> myActionSheetDelegate;
-
- DatabaseDocument *databaseDocument;
- NSString *fileToOpen;
-
- UIImage *images[NUM_IMAGES];
-
- BOOL locked;
- BOOL backgroundSupported;
-}
+@interface MiniKeePassAppDelegate : NSObject <UIApplicationDelegate, UIActionSheetDelegate>
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) DatabaseDocument *databaseDocument;
@@ -45,9 +32,11 @@
- (void)closeDatabase;
- (void)deleteAllData;
- (UIImage*)loadImage:(NSUInteger)index;
+
- (void)showSettingsView;
- (void)dismissSettingsView;
+
- (void)showActionSheet:(UIActionSheet*)actionSheet;
- (void)dismissActionSheet;
-@end
+@end
View
81 MiniKeePass/MiniKeePassAppDelegate.m
@@ -24,12 +24,19 @@
#import "SFHFKeychainUtils.h"
#import "LockScreenController.h"
-@implementation MiniKeePassAppDelegate
+@interface MiniKeePassAppDelegate () {
+ UINavigationController *navigationController;
+ UIActionSheet* myActionSheet;
+ id<UIActionSheetDelegate> myActionSheetDelegate;
+
+ UIImage *images[NUM_IMAGES];
+}
-@synthesize window;
-@synthesize locked;
-@synthesize databaseDocument;
-@synthesize backgroundSupported;
+@property (copy, nonatomic) NSString *fileToOpen;
+
+@end
+
+@implementation MiniKeePassAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Initialize the images array
@@ -38,29 +45,23 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
images[i] = nil;
}
- databaseDocument = nil;
+ _databaseDocument = nil;
// Create the files view
- FilesViewController *filesViewController = [[FilesViewController alloc] initWithStyle:UITableViewStylePlain];
+ FilesViewController *filesViewController = [[[FilesViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];
navigationController = [[UINavigationController alloc] initWithRootViewController:filesViewController];
- [filesViewController release];
-
navigationController.toolbarHidden = NO;
// Create the window
- window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- window.rootViewController = navigationController;
- [window makeKeyAndVisible];
+ _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ self.window.rootViewController = navigationController;
+ [self.window makeKeyAndVisible];
// Check if backgrounding is supported
- backgroundSupported = FALSE;
- UIDevice* device = [UIDevice currentDevice];
- if ([device respondsToSelector:@selector(isMultitaskingSupported)]) {
- backgroundSupported = device.multitaskingSupported;
- }
+ _backgroundSupported = [[UIDevice currentDevice] isMultitaskingSupported];
// Add a pasteboard notification listener is backgrounding is supported
- if (backgroundSupported) {
+ if (self.backgroundSupported) {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(handlePasteboardNotification:) name:UIPasteboardChangedNotification object:nil];
}
@@ -75,14 +76,14 @@ - (void)dealloc {
for (i = 0; i < NUM_IMAGES; i++) {
[images[i] release];
}
- [databaseDocument release];
- [fileToOpen release];
+ [_databaseDocument release];
+ [_fileToOpen release];
+ [_window release];
[navigationController release];
- [window release];
[super dealloc];
}
-- (void)applicationWillResignActive:(UIApplication *)application {
+- (void)applicationDidEnterBackground:(UIApplication *)application {
[self dismissActionSheet];
if (!self.locked) {
[LockScreenController present];
@@ -91,17 +92,16 @@ - (void)applicationWillResignActive:(UIApplication *)application {
}
}
-- (void)applicationDidBecomeActive:(UIApplication *)application {
+- (void)applicationWillEnterForeground:(UIApplication *)application {
// Check if we're supposed to open a file
- if (fileToOpen != nil) {
+ if (self.fileToOpen != nil) {
// Close the current database
[self closeDatabase];
// Open the file
- [[DatabaseManager sharedInstance] openDatabaseDocument:fileToOpen animated:NO];
+ [[DatabaseManager sharedInstance] openDatabaseDocument:self.fileToOpen animated:NO];
- [fileToOpen release];
- fileToOpen = nil;
+ self.fileToOpen = nil;
}
// Get the time when the application last exited
@@ -146,11 +146,10 @@ - (void)openUrl:(NSURL *)url {
[fileManager removeItemAtPath:[documentsDirectory stringByAppendingPathComponent:@"Inbox"] error:nil];
// Store the filename to open if it's a database
- [fileToOpen release];
if ([filename hasSuffix:@".kdb"] || [filename hasSuffix:@".kdbx"]) {
- fileToOpen = [filename copy];
+ self.fileToOpen = [filename copy];
} else {
- fileToOpen = nil;
+ self.fileToOpen = nil;
FilesViewController *fileView = [[navigationController viewControllers] objectAtIndex:0];
[fileView updateFiles];
[fileView.tableView reloadData];
@@ -167,21 +166,17 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceAppl
return YES;
}
-- (DatabaseDocument *)databaseDocument {
- return databaseDocument;
-}
-
- (void)setDatabaseDocument:(DatabaseDocument *)newDatabaseDocument {
- if (databaseDocument != nil) {
+ if (_databaseDocument != nil) {
[self closeDatabase];
}
- databaseDocument = [newDatabaseDocument retain];
+ _databaseDocument = [newDatabaseDocument retain];
// Create and push on the root group view controller
GroupViewController *groupViewController = [[GroupViewController alloc] initWithStyle:UITableViewStylePlain];
- groupViewController.title = [[databaseDocument.filename lastPathComponent] stringByDeletingPathExtension];
- groupViewController.group = databaseDocument.kdbTree.root;
+ groupViewController.title = [[_databaseDocument.filename lastPathComponent] stringByDeletingPathExtension];
+ groupViewController.group = _databaseDocument.kdbTree.root;
[navigationController pushViewController:groupViewController animated:YES];
[groupViewController release];
}
@@ -190,8 +185,8 @@ - (void)closeDatabase {
// Close any open database views
[navigationController popToRootViewControllerAnimated:NO];
- [databaseDocument release];
- databaseDocument = nil;
+ [_databaseDocument release];
+ _databaseDocument = nil;
}
- (void)deleteAllData {
@@ -284,14 +279,14 @@ - (void)showSettingsView {
UINavigationController *settingsNavController = [[UINavigationController alloc] initWithRootViewController:settingsViewController];
settingsNavController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
- [window.rootViewController presentModalViewController:settingsNavController animated:YES];
+ [self.window.rootViewController presentModalViewController:settingsNavController animated:YES];
[settingsViewController release];
[settingsNavController release];
}
- (void)dismissSettingsView {
- [window.rootViewController dismissModalViewControllerAnimated:YES];
+ [self.window.rootViewController dismissModalViewControllerAnimated:YES];
}
- (void)showActionSheet:(UIActionSheet *)actionSheet {
@@ -303,7 +298,7 @@ - (void)showActionSheet:(UIActionSheet *)actionSheet {
myActionSheetDelegate = actionSheet.delegate;
actionSheet.delegate = self;
- [actionSheet showInView:window.rootViewController.view];
+ [actionSheet showInView:self.window.rootViewController.view];
[actionSheet release];
}
View
12 MiniKeePass/PinViewController.h
@@ -20,22 +20,14 @@
@protocol PinViewControllerDelegate;
-@interface PinViewController : UIViewController <UITextFieldDelegate> {
- UITextField *textField;
- NSArray *pinTextFields;
- UILabel *textLabel;
- UIToolbar *topBar;
- UIToolbar *pinBar;
- id<PinViewControllerDelegate> delegate;
-}
+@interface PinViewController : UIViewController <UITextFieldDelegate>
- (id)initWithText:(NSString*)text;
- (void)clearEntry;
- (void)keyboardDidHide;
@property (nonatomic, copy) UILabel *textLabel;
-@property (nonatomic, copy) UIColor *backgroundColor;
-@property (nonatomic, retain) id<PinViewControllerDelegate> delegate;
+@property (nonatomic, assign) id<PinViewControllerDelegate> delegate;
@end
View
67 MiniKeePass/PinViewController.m
@@ -25,10 +25,15 @@
#define PINTEXTFIELDHEIGHT 52.0f
#define TEXTFIELDSPACE 10.0f
-@implementation PinViewController
+@interface PinViewController () {
+ UITextField *textField;
+ NSArray *pinTextFields;
+ UIToolbar *topBar;
+ UIToolbar *pinBar;
+}
+@end
-@synthesize delegate;
-@synthesize textLabel;
+@implementation PinViewController
- (id)init {
return [self initWithText:NSLocalizedString(@"Enter your PIN to unlock", nil)];
@@ -37,8 +42,7 @@ - (id)init {
- (id)initWithText:(NSString*)text {
self = [super init];
if (self) {
- self.view.backgroundColor = [UIColor colorWithRed:0.831372f green:0.843137f blue:0.870588f alpha:1.0f];
-
+ self.view.backgroundColor = [UIColor darkGrayColor];
CGFloat frameWidth = CGRectGetWidth(self.view.frame);
textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
@@ -52,20 +56,20 @@ - (id)initWithText:(NSString*)text {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textDidChange:) name:UITextFieldTextDidChangeNotification object:textField];
// Create topbar
- textLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, frameWidth, 95)];
- textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- textLabel.backgroundColor = [UIColor clearColor];
- textLabel.textColor = [UIColor whiteColor];
- textLabel.font = [UIFont fontWithName:@"HelveticaNeue-Bold" size:25];
- textLabel.numberOfLines = 0;
- textLabel.textAlignment = UITextAlignmentCenter;
- textLabel.text = text;
+ _textLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, frameWidth, 95)];
+ self.textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ self.textLabel.backgroundColor = [UIColor clearColor];
+ self.textLabel.textColor = [UIColor whiteColor];
+ self.textLabel.font = [UIFont fontWithName:@"HelveticaNeue-Bold" size:25];
+ self.textLabel.numberOfLines = 0;
+ self.textLabel.textAlignment = UITextAlignmentCenter;
+ self.textLabel.text = text;
topBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, frameWidth, 95)];
topBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
topBar.barStyle = UIBarStyleBlackTranslucent;
- [topBar addSubview:textLabel];
+ [topBar addSubview:self.textLabel];
[self.view addSubview:topBar];
@@ -120,14 +124,13 @@ - (void)dealloc {
[pinBar release];
[textField release];
[pinTextFields release];
- [textLabel release];
- [delegate release];
+ [_textLabel release];
[super dealloc];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
- if ([delegate respondsToSelector:@selector(pinViewControllerShouldAutorotateToInterfaceOrientation:)]) {
- return [delegate pinViewControllerShouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
+ if ([self.delegate respondsToSelector:@selector(pinViewControllerShouldAutorotateToInterfaceOrientation:)]) {
+ return [self.delegate pinViewControllerShouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
} else {
return NO;
}
@@ -141,22 +144,14 @@ - (void)resizeToolbarsToInterfaceOrientation:(UIInterfaceOrientation)toInterface
newFrame.size.height = UIInterfaceOrientationIsPortrait(toInterfaceOrientation) ? 95 : 68;
topBar.frame = newFrame;
- textLabel.frame = newFrame;
- pinBar.frame = newFrame;
+ self.textLabel.frame = newFrame;
+ pinBar.frame = newFrame;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
- [UIView animateWithDuration:duration animations:^{
- [self resizeToolbarsToInterfaceOrientation:toInterfaceOrientation];
- }];
-}
-
-- (UIColor *)backgroundColor {
- return self.view.backgroundColor;
-}
-
-- (void)setBackgroundColor:(UIColor *)backgroundColor {
- self.view.backgroundColor = backgroundColor;
+ [UIView animateWithDuration:duration animations:^{
+ [self resizeToolbarsToInterfaceOrientation:toInterfaceOrientation];
+ }];
}
- (void)keyboardDidHide {
@@ -172,15 +167,15 @@ - (void)viewWillAppear:(BOOL)animated {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if ([self shouldAutorotateToInterfaceOrientation:orientation]) {
- [self resizeToolbarsToInterfaceOrientation:orientation];
+ [self resizeToolbarsToInterfaceOrientation:orientation];
}
[self clearEntry];
}
- (void)viewDidAppear:(BOOL)animated {
- if ([delegate respondsToSelector:@selector(pinViewControllerDidShow:)]) {
- [delegate pinViewControllerDidShow:self];
+ if ([self.delegate respondsToSelector:@selector(pinViewControllerDidShow:)]) {
+ [self.delegate pinViewControllerDidShow:self];
}
}
@@ -215,8 +210,8 @@ - (void)textDidChange:(NSNotification*)notification {
}
- (void)checkPin:(id)sender {
- if ([delegate respondsToSelector:@selector(pinViewController:pinEntered:)]) {
- [delegate pinViewController:self pinEntered:textField.text];
+ if ([self.delegate respondsToSelector:@selector(pinViewController:pinEntered:)]) {
+ [self.delegate pinViewController:self pinEntered:textField.text];
}
}
View
BIN  stretchme.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  stretchme@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.