Patch to enable retina display app icons

1 view
Skip to first unread message

Dennis Munsie

unread,
May 6, 2011, 12:16:23 PM5/6/11
to myapp...@googlegroups.com
Hi All --

Just a small little patch here to enable displaying the app icons in main Apps view and in the reports view to be in retina display resolution instead of the lower res. Due to the way the icon files are cached, you'll have to use the Empty Cache button under Settings and then restart the app to see the retina icons.

Oliver -- I don't know what the status of the Core Data enabled version of MyAppSales is -- if you've already fixed this in that version, feel free to ignore this patch.

dennis

-----

diff --git a/Classes/App.m b/Classes/App.m
index 39f0d3e..08cff20 100644
--- a/Classes/App.m
+++ b/Classes/App.m
@@ -40,6 +40,8 @@ static sqlite3_stmt *reviews_statement = nil;
// Date formatter for XML files
static NSDateFormatter *dateFormatterToRead = nil;

+#define SMALL_APP_ICON_SIZE 64.0
+#define LARGE_APP_ICON_SIZE 112.0

@implementation App

@@ -55,7 +57,7 @@ static NSDateFormatter *dateFormatterToRead = nil;
if (self = [super init])
{
self.iconImage = [UIImage imageNamed:@"Empty.png"];
- UIImage *tmpImageNanoResized = [self.iconImage scaleImageToSize:CGSizeMake(32.0,32.0)];
+ UIImage *tmpImageNanoResized = [self.iconImage scaleImageToSize:CGSizeMake(SMALL_APP_ICON_SIZE,SMALL_APP_ICON_SIZE)];
self.iconImageNano = tmpImageNanoResized;


@@ -178,7 +180,7 @@ static NSDateFormatter *dateFormatterToRead = nil;
if (tmpImage)
{
self.iconImage = tmpImage;
- UIImage *tmpImageNanoResized = [tmpImage scaleImageToSize:CGSizeMake(32.0,32.0)];
+ UIImage *tmpImageNanoResized = [tmpImage scaleImageToSize:CGSizeMake(SMALL_APP_ICON_SIZE,SMALL_APP_ICON_SIZE)];
self.iconImageNano = tmpImageNanoResized;

return;
@@ -297,10 +299,10 @@ static NSDateFormatter *dateFormatterToRead = nil;

//UIImage *tmpImageRounded = [ImageManipulator makeRoundCornerImage:tmpImage cornerWidth:20 cornerHeight:20];

- UIImage *tmpImageResized = [tmpImageRounded scaleImageToSize:CGSizeMake(56.0,56.0)];
+ UIImage *tmpImageResized = [tmpImageRounded scaleImageToSize:CGSizeMake(LARGE_APP_ICON_SIZE,LARGE_APP_ICON_SIZE)];
self.iconImage = tmpImageResized;

- UIImage *tmpImageNanoResized = [tmpImageRounded scaleImageToSize:CGSizeMake(32.0,32.0)];
+ UIImage *tmpImageNanoResized = [tmpImageRounded scaleImageToSize:CGSizeMake(SMALL_APP_ICON_SIZE,SMALL_APP_ICON_SIZE)];
self.iconImageNano = tmpImageNanoResized;


diff --git a/Classes/AppCell.m b/Classes/AppCell.m
index 1c72a0a..58ae2ec 100644
--- a/Classes/AppCell.m
+++ b/Classes/AppCell.m
@@ -103,6 +103,8 @@
CGFloat width = (contentRect.size.width - LEFT_COLUMN_OFFSET - RIGHT_MARGIN - 5.0);
royaltiesLabel.frame = CGRectMake(contentRect.origin.x + LEFT_COLUMN_OFFSET + width*0.6, contentRect.origin.y+2.0*lineHeight + VERTICAL_MARGIN, width*0.4, lineHeight);
totalUnitsLabel.frame = CGRectMake(contentRect.origin.x + LEFT_COLUMN_OFFSET, contentRect.origin.y+2.0*lineHeight + VERTICAL_MARGIN, width*0.6, lineHeight);
+
+ self.imageView.frame = CGRectMake(9.0, 9.0, 56.0, 56.0);
}

- (void)dealloc
diff --git a/Classes/ReportCell.m b/Classes/ReportCell.m
index 3e77ef9..75db08d 100644
--- a/Classes/ReportCell.m
+++ b/Classes/ReportCell.m
@@ -107,6 +107,8 @@
frame.size.width = 30.0;
frame.size.height = 15.0;
countryCodeLabel.frame = frame;
+
+ self.imageView.frame = CGRectMake(9.0, 9.0, 32.0, 32.0);
}

- (void)dealloc

Jonathan Heald

unread,
May 6, 2011, 12:43:31 PM5/6/11
to myapp...@googlegroups.com
Thanks for that,

I'm hoping someone can add ability to remove apps from the list (I have removed a couple of apps from app store)
I don't have the skills(yet)

Sent from my iPhone

Oliver Drobnik

unread,
May 6, 2011, 11:44:21 PM5/6/11
to myapp...@googlegroups.com
Dennis,

Haven't used Patch before, could you please also tell me/us how to apply it to a working copy?

Sent from my iPhone

Dennis Munsie

unread,
May 7, 2011, 3:17:20 AM5/7/11
to Oliver Drobnik, myapp...@googlegroups.com
For git, it looks like the best way is to use git-apply (http://www.kernel.org/pub/software/scm/git/docs/git-apply.html) -- assuming that the patch file is in your MyAppSales directory, do the following from the command line:

$ git-apply patch_file

Alternatively, you can use git-am (http://www.kernel.org/pub/software/scm/git/docs/git-am.html) to apply the patch from the entire email. This automatically checks in the code though. But it keeps the author information from the email in git as well.

Generating diffs in git is easy too -- i just did git diff at the command line. It looks like git-format-patch (http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html) could be useful too.

dennis

Dennis Munsie

unread,
May 7, 2011, 3:28:05 AM5/7/11
to myapp...@googlegroups.com
Hmm -- it appears that git apply doesn't accept my patch. I'll take another look at it tomorrow to see why this is happening.

dennis

Oliver Drobnik

unread,
May 7, 2011, 3:32:02 AM5/7/11
to myapp...@googlegroups.com
Couldn't you just regularily apply via patch command?

Sent from my iPhone

Dennis Munsie

unread,
May 9, 2011, 9:46:37 AM5/9/11
to myapp...@googlegroups.com
Ok, so git apply does work. Not sure why I was having problems over the weekend, but I just tried it again and it successfully applied, but with a couple of warnings about trailing whitespace. I'll have to look into why that happened.

But to answer Oliver's question, patch also works. You can also do the following:

$ cd MyAppSales
$ patch -p1 < patch_file
patching file Classes/App.m
patching file Classes/AppCell.m
patching file Classes/ReportCell.m

Once you do this, you'll have to manually check in the changes to git.

dennis

Reply all
Reply to author
Forward
0 new messages