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

Commit

Permalink
one massive commit because breaking it up is hard
Browse files Browse the repository at this point in the history
-new tint color for entire app
-image selector view controller supports multiple sizes
-reverted PIN screen to apear from bottom
-new lock & splash images
-other small fixes
  • Loading branch information
John Flanagan authored and John Flanagan committed Jun 29, 2012
1 parent c010ff4 commit 16b6638
Show file tree
Hide file tree
Showing 26 changed files with 235 additions and 90 deletions.
Binary file modified Default-Landscape@2x~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Default-Landscape~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Default-Portrait@2x~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Default-Portrait~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions MiniKeePass.xcodeproj/project.pbxproj
Expand Up @@ -19,13 +19,20 @@
529708AE14FEEFD3003547FB /* Andale Mono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 529708AD14FEEFD3003547FB /* Andale Mono.ttf */; };
529708B014FEF149003547FB /* Andale Mono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 529708AD14FEEFD3003547FB /* Andale Mono.ttf */; };
52A177BC13EB698E00CEEFCE /* createdb.html in Resources */ = {isa = PBXBuildFile; fileRef = 52A177BB13EB698E00CEEFCE /* createdb.html */; };
52A512B1159CE7540009F82F /* ImageContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 52A512B0159CE7540009F82F /* ImageContainerView.m */; };
52A7E1A914EDF1CB0041F950 /* LockScreenController.m in Sources */ = {isa = PBXBuildFile; fileRef = 52A7E1A814EDF1CB0041F950 /* LockScreenController.m */; };
52CF7D871542515500D681C1 /* Default-Landscape~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52CF7D861542515500D681C1 /* Default-Landscape~ipad.png */; };
52CF7D891542515900D681C1 /* Default-Landscape@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52CF7D881542515900D681C1 /* Default-Landscape@2x~ipad.png */; };
52CF7D8B1542515D00D681C1 /* Default-Portrait@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52CF7D8A1542515D00D681C1 /* Default-Portrait@2x~ipad.png */; };
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 */; };
52DDE05B15899DFF0054429F /* lockBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 52DDE05A15899DFF0054429F /* lockBackground.png */; };
52DDE05D15899E2C0054429F /* lockBackground@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52DDE05C15899E2B0054429F /* lockBackground@2x.png */; };
52DDE0621589A0110054429F /* lockLandscape@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52DDE05E1589A0100054429F /* lockLandscape@2x~ipad.png */; };
52DDE0631589A0110054429F /* lockLandscape~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52DDE05F1589A0100054429F /* lockLandscape~ipad.png */; };
52DDE0641589A0110054429F /* lockPortrait@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52DDE0601589A0100054429F /* lockPortrait@2x~ipad.png */; };
52DDE0651589A0110054429F /* lockPortrait~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 52DDE0611589A0100054429F /* lockPortrait~ipad.png */; };
52E6C88715431C7700A91CD3 /* AutorotatingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E6C88615431C7700A91CD3 /* AutorotatingViewController.m */; };
52E6C88B15431D6C00A91CD3 /* AutorotatingTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E6C88A15431D6C00A91CD3 /* AutorotatingTableViewController.m */; };
6802F9C614EC9C1D00ACD4C1 /* wrench.png in Resources */ = {isa = PBXBuildFile; fileRef = 6802F9C314EC9C1D00ACD4C1 /* wrench.png */; };
Expand Down Expand Up @@ -349,6 +356,8 @@
529BED9E14D7CD8600618250 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = "<group>"; };
529BED9F14D7CD9700618250 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
52A177BB13EB698E00CEEFCE /* createdb.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = createdb.html; sourceTree = "<group>"; };
52A512AF159CE7540009F82F /* ImageContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageContainerView.h; sourceTree = "<group>"; };
52A512B0159CE7540009F82F /* ImageContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageContainerView.m; sourceTree = "<group>"; };
52A7E1A714EDF1CB0041F950 /* LockScreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LockScreenController.h; sourceTree = "<group>"; };
52A7E1A814EDF1CB0041F950 /* LockScreenController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LockScreenController.m; sourceTree = "<group>"; };
52CF7D861542515500D681C1 /* Default-Landscape~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape~ipad.png"; sourceTree = "<group>"; };
Expand All @@ -357,6 +366,12 @@
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>"; };
52DDE05A15899DFF0054429F /* lockBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lockBackground.png; sourceTree = "<group>"; };
52DDE05C15899E2B0054429F /* lockBackground@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lockBackground@2x.png"; sourceTree = "<group>"; };
52DDE05E1589A0100054429F /* lockLandscape@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lockLandscape@2x~ipad.png"; sourceTree = "<group>"; };
52DDE05F1589A0100054429F /* lockLandscape~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lockLandscape~ipad.png"; sourceTree = "<group>"; };
52DDE0601589A0100054429F /* lockPortrait@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lockPortrait@2x~ipad.png"; sourceTree = "<group>"; };
52DDE0611589A0100054429F /* lockPortrait~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lockPortrait~ipad.png"; sourceTree = "<group>"; };
52E6C88515431C7700A91CD3 /* AutorotatingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutorotatingViewController.h; sourceTree = "<group>"; };
52E6C88615431C7700A91CD3 /* AutorotatingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AutorotatingViewController.m; sourceTree = "<group>"; };
52E6C88915431D6C00A91CD3 /* AutorotatingTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutorotatingTableViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1142,6 +1157,10 @@
689D041413A42B85005EBD36 /* Resources */ = {
isa = PBXGroup;
children = (
52DDE05E1589A0100054429F /* lockLandscape@2x~ipad.png */,
52DDE05F1589A0100054429F /* lockLandscape~ipad.png */,
52DDE0601589A0100054429F /* lockPortrait@2x~ipad.png */,
52DDE0611589A0100054429F /* lockPortrait~ipad.png */,
529708AD14FEEFD3003547FB /* Andale Mono.ttf */,
689D021313A42B63005EBD36 /* help */,
689D021A13A42B63005EBD36 /* images */,
Expand All @@ -1155,6 +1174,8 @@
689D021913A42B63005EBD36 /* icon@2x.png */,
52CF7D901542516D00D681C1 /* icon~ipad.png */,
52CF7D8E1542516900D681C1 /* icon@2x~ipad.png */,
52DDE05A15899DFF0054429F /* lockBackground.png */,
52DDE05C15899E2B0054429F /* lockBackground@2x.png */,
5235D58214F8160900B0C991 /* splash.png */,
5235D58414F8176300B0C991 /* splash@2x.png */,
);
Expand Down Expand Up @@ -1260,6 +1281,8 @@
689D043113A42C81005EBD36 /* GroupViewController.m */,
68CE37F014049BC900E4A5E1 /* HelpViewController.h */,
68CE37F114049BC900E4A5E1 /* HelpViewController.m */,
52A512AF159CE7540009F82F /* ImageContainerView.h */,
52A512B0159CE7540009F82F /* ImageContainerView.m */,
6876F67613B2D8F400A05C7A /* ImagesViewController.h */,
6876F67713B2D8F400A05C7A /* ImagesViewController.m */,
68915A0913A6F6C200A408B0 /* InfoBar.h */,
Expand Down Expand Up @@ -1591,6 +1614,12 @@
52CF7D8D1542516300D681C1 /* Default-Portrait~ipad.png in Resources */,
52CF7D8F1542516900D681C1 /* icon@2x~ipad.png in Resources */,
52CF7D911542516D00D681C1 /* icon~ipad.png in Resources */,
52DDE05B15899DFF0054429F /* lockBackground.png in Resources */,
52DDE05D15899E2C0054429F /* lockBackground@2x.png in Resources */,
52DDE0621589A0110054429F /* lockLandscape@2x~ipad.png in Resources */,
52DDE0631589A0110054429F /* lockLandscape~ipad.png in Resources */,
52DDE0641589A0110054429F /* lockPortrait@2x~ipad.png in Resources */,
52DDE0651589A0110054429F /* lockPortrait~ipad.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1702,6 +1731,7 @@
68633022150BCD6000D9988A /* FileOutputStream.m in Sources */,
52E6C88715431C7700A91CD3 /* AutorotatingViewController.m in Sources */,
52E6C88B15431D6C00A91CD3 /* AutorotatingTableViewController.m in Sources */,
52A512B1159CE7540009F82F /* ImageContainerView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
1 change: 1 addition & 0 deletions MiniKeePass/DatabaseManager.m
Expand Up @@ -106,6 +106,7 @@ - (void)openDatabaseDocument:(NSString*)filename animated:(BOOL)newAnimated {
}

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:passwordViewController];
navigationController.navigationBar.tintColor = [UIColor darkGrayColor];

[appDelegate.window.rootViewController presentModalViewController:navigationController animated:animated];

Expand Down
3 changes: 2 additions & 1 deletion MiniKeePass/EntryViewController.m
Expand Up @@ -293,7 +293,7 @@ - (void)setSelectedImageIndex:(NSUInteger)index {
- (void)imageButtonPressed {
ImagesViewController *imagesViewController = [[ImagesViewController alloc] init];
imagesViewController.delegate = self;
[imagesViewController setSelectedImage:entry.image];
[imagesViewController setSelectedImage:selectedImageIndex];
[self.navigationController pushViewController:imagesViewController animated:YES];
[imagesViewController release];
}
Expand All @@ -307,6 +307,7 @@ - (void)generatePasswordPressed {
passwordGeneratorViewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:passwordGeneratorViewController];
navigationController.navigationBar.tintColor = [UIColor darkGrayColor];

[self presentModalViewController:navigationController animated:YES];

Expand Down
2 changes: 2 additions & 0 deletions MiniKeePass/FilesViewController.m
Expand Up @@ -246,6 +246,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
textEntryController.textField.text = [filename stringByDeletingPathExtension];

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:textEntryController];
navigationController.navigationBar.tintColor = [UIColor darkGrayColor];

[appDelegate.window.rootViewController presentModalViewController:navigationController animated:YES];

Expand Down Expand Up @@ -362,6 +363,7 @@ - (void)addPressed {
newKdbViewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:newKdbViewController];
navigationController.navigationBar.tintColor = [UIColor darkGrayColor];

[appDelegate.window.rootViewController presentModalViewController:navigationController animated:YES];

Expand Down
29 changes: 14 additions & 15 deletions MiniKeePass/GroupViewController.m
Expand Up @@ -107,23 +107,22 @@ - (void)viewWillAppear:(BOOL)animated {
break;
}

if ([newKdbTitle localizedCaseInsensitiveCompare:pushedKdbTitle] != 0) {
NSUInteger index = [self updatePositionOfObjectAtIndex:selectedIndexPath.row inArray:array];

// Move or update the row
if (index != selectedIndexPath.row) {
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:selectedIndexPath] withRowAnimation:UITableViewRowAnimationFade];
selectedIndexPath = [NSIndexPath indexPathForRow:index inSection:selectedIndexPath.section];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:selectedIndexPath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
} else {
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:selectedIndexPath] withRowAnimation:UITableViewRowAnimationNone];
}
NSUInteger index = [self updatePositionOfObjectAtIndex:selectedIndexPath.row inArray:array];

// Re-select the row
[self.tableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
// Move or update the row
if (index != selectedIndexPath.row) {
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:selectedIndexPath] withRowAnimation:UITableViewRowAnimationFade];
selectedIndexPath = [NSIndexPath indexPathForRow:index inSection:selectedIndexPath.section];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:selectedIndexPath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
} else {
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:selectedIndexPath] withRowAnimation:UITableViewRowAnimationNone];
}

// Re-select the row
[self.tableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];

[newKdbTitle release];
}

Expand Down
18 changes: 18 additions & 0 deletions MiniKeePass/ImageContainerView.h
@@ -0,0 +1,18 @@
//
// ImageContainerView.h
// MiniKeePass
//
// Created by John Flanagan on 6/28/12.
// Copyright (c) 2012 Self. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ImageContainerView : UIView {
NSMutableArray *imageViews;
UIImageView *selectedImageView;
}

- (void)setSelectedImage:(NSUInteger)index;

@end
108 changes: 108 additions & 0 deletions MiniKeePass/ImageContainerView.m
@@ -0,0 +1,108 @@
//
// ImageContainerView.m
// MiniKeePass
//
// Created by John Flanagan on 6/28/12.
// Copyright (c) 2012 Self. All rights reserved.
//

#import "ImageContainerView.h"
#import "MiniKeePassAppDelegate.h"

//#define IMAGES_PER_ROW 7
#define SIZE 24
#define HORIZONTAL_SPACING 10.5
#define VERTICAL_SPACING 10.5

NSInteger imagesPerRow;
NSUInteger selectedImageIndex;

@implementation ImageContainerView

- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];

if (self) {
imagesPerRow = self.frame.size.width / (SIZE + 2 * HORIZONTAL_SPACING);
imageViews = [[NSMutableArray alloc] initWithCapacity:NUM_IMAGES];
// Get the application delegate
MiniKeePassAppDelegate *appDelegate = (MiniKeePassAppDelegate*)[[UIApplication sharedApplication] delegate];

// Load the images
for (int i = 0; i < NUM_IMAGES; i++) {
UIImage *image = [appDelegate loadImage:i];

UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[self addSubview:imageView];
[imageViews addObject:imageView];
[imageView release];
}

UIImage *selectedImage = [UIImage imageNamed:@"checkmark"];
selectedImageView = [[UIImageView alloc] initWithImage:selectedImage];
[self addSubview:selectedImageView];

[self setSelectedImage:0];
}
return self;
}

-(void)dealloc {
[imageViews release];
[selectedImageView release];
[super dealloc];
}

- (void)layoutSubviews {
UIScrollView *scrollView = (UIScrollView *)self.superview;
self.frame = scrollView.frame;

imagesPerRow = self.frame.size.width / (SIZE + 2 * HORIZONTAL_SPACING);
int numberOfRows = 0;

CGRect imageFrame = CGRectMake(HORIZONTAL_SPACING, VERTICAL_SPACING, SIZE, SIZE);

// Load the images
for (int i = 0; i < NUM_IMAGES; i += imagesPerRow) {
numberOfRows++;
for (int j = 0; j < imagesPerRow; j++) {
if (i + j >= NUM_IMAGES) {
break;
}

UIImageView *imageView = (UIImageView *)[imageViews objectAtIndex:i + j];
imageView.frame = imageFrame;

imageFrame.origin.x += SIZE + 2 * HORIZONTAL_SPACING;
}

imageFrame.origin.x = HORIZONTAL_SPACING;
imageFrame.origin.y += SIZE + 2 * VERTICAL_SPACING;
}

[self setSelectedImage:selectedImageIndex];

CGFloat newHeight = numberOfRows * (SIZE + 2 * VERTICAL_SPACING);

CGRect newFrame = self.frame;
newFrame.size.height = newHeight;
self.frame = newFrame;

scrollView.contentSize = newFrame.size;
}

- (void)setSelectedImage:(NSUInteger)index {
if (index >= NUM_IMAGES) {
return;
}
selectedImageIndex = index;

NSUInteger row = index / imagesPerRow;
NSUInteger col = index - (row * imagesPerRow);

CGSize size = selectedImageView.image.size;
CGRect frame = CGRectMake((col + 1) * (SIZE + 2 * HORIZONTAL_SPACING) - size.width, (row + 1) * (SIZE + 2 * VERTICAL_SPACING) - size.height, size.width, size.height);
selectedImageView.frame = frame;
}

@end
8 changes: 3 additions & 5 deletions MiniKeePass/ImagesViewController.h
Expand Up @@ -17,20 +17,18 @@

#import <UIKit/UIKit.h>
#import "AutorotatingViewController.h"
#import "ImageContainerView.h"

@protocol ImagesViewControllerDelegate;

@interface ImagesViewController : AutorotatingViewController {
UIView *imagesView;
NSMutableArray *imageViews;
UIImageView *selectedImageView;
ImageContainerView *imageContainerView;
id<ImagesViewControllerDelegate> delegate;
}

@property (nonatomic, retain) id<ImagesViewControllerDelegate> delegate;

- (void)setSelectedImage:(NSUInteger)index;

@property (nonatomic, retain) id<ImagesViewControllerDelegate> delegate;
@end

@protocol ImagesViewControllerDelegate <NSObject>
Expand Down

0 comments on commit 16b6638

Please sign in to comment.