github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

ars / freemoji

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 20
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: cbe85f1

click here to add a description

click here to add a homepage

  • Branches (1)
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Enable emoji support on iPhone — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Freemoji Take 1 
ars (author)
Mon Jan 26 17:16:47 -0800 2009
commit  cbe85f14c0679ffca8259cde2e4c64b81cdd03fc
tree    db0098f3524da5500144643616877e1a319f40d0
freemoji / main.m main.m
100644 96 lines (81 sloc) 3.406 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#import <UIKit/UIKit.h>
 
#define PREFS_FILE @"/private/var/mobile/Library/Preferences/com.apple.Preferences.plist"
#define EMOJI_KEY @"KeyboardEmojiEverywhere"
#define FEEDBACK_TAG 999
 
@interface FreemojiController : UIViewController
@end
 
@implementation FreemojiController
- (void) didSwitch: (UISwitch *) sv
{
// Read in prefs
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:PREFS_FILE];
if (!dict)
{
[sv setOn:(![sv isOn])];
[(UITextView *)[self.view viewWithTag:FEEDBACK_TAG] setText:@"ERROR! Could not read (or write to) the Apple Preferences property list for some reason.\n\nThis error means that you were sandboxed away from the proper settings or the settings could not be found or read from. Sorry!"];
return;
}
 
// Toggle the setting from on to off or vice versa
BOOL isSet = [[dict objectForKey:EMOJI_KEY] boolValue];
printf("%s key...\n", isSet ? "Removing" : "Setting");
if (isSet)
[dict removeObjectForKey:EMOJI_KEY];
else
[dict setObject:[NSNumber numberWithBool:YES] forKey:EMOJI_KEY];
[dict writeToFile:PREFS_FILE atomically:NO];
[sv setOn:!isSet];
}
 
- (void)loadView
{
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
self.view = contentView;
contentView.backgroundColor = [UIColor whiteColor];
 
// Add a switch
UISwitch *sv = [[UISwitch alloc] initWithFrame:CGRectZero];
sv.center = CGPointMake(160.0f, 180.0f);
[sv addTarget:self action:@selector(didSwitch:) forControlEvents:UIControlEventValueChanged];
[contentView addSubview:sv];
[sv release];
 
// Initialize switch value from the current setting
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:PREFS_FILE];
[sv setOn:[[dict objectForKey:EMOJI_KEY] boolValue]];
 
// Add primary label
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 300.0f, 120.0f)];
label.center = CGPointMake(160.0f, 80.0f);
label.numberOfLines = 2;
label.text = @"EMOJI\nSUPPORT";
label.textAlignment = UITextAlignmentCenter;
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:48.0f];
[contentView addSubview:label];
[label release];
 
// Add how-to text
UITextView *tv = [[UITextView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 300.0f, 200.0f)];
tv.center = CGPointMake(160.0f, 350.0f);
tv.backgroundColor = [UIColor lightGrayColor];
tv.editable = NO;
tv.font = [UIFont italicSystemFontOfSize:16.0f];
tv.text = @"After enabling Emoji support, go to Settings > General > Keyboard > International Keyboards > Japanese and switch Emoji support to ON.\n\nDisabling Emoji support in this application returns your system to its normal settings.";
tv.tag = FEEDBACK_TAG;
[contentView addSubview:tv];
[tv release];
 
[contentView release];
}
@end
 
 
@interface SampleAppDelegate : NSObject <UIApplicationDelegate>
@end
 
@implementation SampleAppDelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
FreemojiController *fc = [[FreemojiController alloc] init];
[window addSubview:fc.view];
[window makeKeyAndVisible];
}
@end
 
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"SampleAppDelegate");
[pool release];
return retVal;
}
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server