Skip to content
Browse files

first commit

  • Loading branch information...
1 parent 463b6d2 commit a8903ccce67bc5f793b4dc2d7a29ce5fc798d3f9 @kishikawakatsumi committed
View
1 .gitattributes
@@ -0,0 +1 @@
+*.pbxproj -crlf -diff -merge
View
18 .gitignore
@@ -0,0 +1,18 @@
+#xcode specific
+build/*
+*.pbxuser
+*.mode2v3
+*.mode1v3
+*.perspective
+*.perspectivev3
+*~.nib
+#ignore private workspace stuff added by Xcode4
+xcuserdata
+project.xcworkspace
+
+## generic files to ignore
+*~
+*.lock
+*.DS_Store
+*.swp
+*.out
View
0 README
No changes.
View
55 VoiceNavigation.xcodeproj/project.pbxproj
@@ -7,6 +7,13 @@
objects = {
/* Begin PBXBuildFile section */
+ 14142067150A865D00E5216F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14142066150A865D00E5216F /* QuartzCore.framework */; };
+ 1414206B150A979500E5216F /* microphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 14142069150A979500E5216F /* microphone.png */; };
+ 1414206C150A979600E5216F /* microphone@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1414206A150A979500E5216F /* microphone@2x.png */; };
+ 145CF6C5150AA0C20080E7CB /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 145CF6C3150AA0C20080E7CB /* Icon.png */; };
+ 145CF6C6150AA0C20080E7CB /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 145CF6C4150AA0C20080E7CB /* Icon@2x.png */; };
+ 145CF6CC150AA2320080E7CB /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 145CF6CA150AA2320080E7CB /* Default.png */; };
+ 145CF6CD150AA2320080E7CB /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 145CF6CB150AA2320080E7CB /* Default@2x.png */; };
149E89F1150A45AA00AB1E10 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 149E89F0150A45AA00AB1E10 /* UIKit.framework */; };
149E89F3150A45AA00AB1E10 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 149E89F2150A45AA00AB1E10 /* Foundation.framework */; };
149E89F5150A45AA00AB1E10 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 149E89F4150A45AA00AB1E10 /* CoreGraphics.framework */; };
@@ -16,23 +23,33 @@
149E8A04150A45AB00AB1E10 /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 149E8A02150A45AB00AB1E10 /* MainStoryboard_iPhone.storyboard */; };
149E8A07150A45AB00AB1E10 /* MainStoryboard_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 149E8A05150A45AB00AB1E10 /* MainStoryboard_iPad.storyboard */; };
149E8A0A150A45AB00AB1E10 /* VNViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 149E8A09150A45AB00AB1E10 /* VNViewController.m */; };
+ 14DD86DF150A7197003098B3 /* VNTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 14DD86DE150A7197003098B3 /* VNTextInputView.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
+ 14142066150A865D00E5216F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+ 14142069150A979500E5216F /* microphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = microphone.png; sourceTree = "<group>"; };
+ 1414206A150A979500E5216F /* microphone@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "microphone@2x.png"; sourceTree = "<group>"; };
+ 145CF6C3150AA0C20080E7CB /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
+ 145CF6C4150AA0C20080E7CB /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };
+ 145CF6CA150AA2320080E7CB /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ 145CF6CB150AA2320080E7CB /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
149E89EC150A45AA00AB1E10 /* VoiceNavigation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VoiceNavigation.app; sourceTree = BUILT_PRODUCTS_DIR; };
149E89F0150A45AA00AB1E10 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
149E89F2150A45AA00AB1E10 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
149E89F4150A45AA00AB1E10 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
- 149E89F8150A45AB00AB1E10 /* VoiceNavigation-Info.plist */ = {isa = PBXFileReference; path = "VoiceNavigation-Info.plist"; sourceTree = "<group>"; };
+ 149E89F8150A45AB00AB1E10 /* VoiceNavigation-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "VoiceNavigation-Info.plist"; sourceTree = "<group>"; };
149E89FA150A45AB00AB1E10 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
149E89FC150A45AB00AB1E10 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- 149E89FE150A45AB00AB1E10 /* VoiceNavigation-Prefix.pch */ = {isa = PBXFileReference; path = "VoiceNavigation-Prefix.pch"; sourceTree = "<group>"; };
- 149E89FF150A45AB00AB1E10 /* VNAppDelegate.h */ = {isa = PBXFileReference; path = VNAppDelegate.h; sourceTree = "<group>"; };
+ 149E89FE150A45AB00AB1E10 /* VoiceNavigation-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "VoiceNavigation-Prefix.pch"; sourceTree = "<group>"; };
+ 149E89FF150A45AB00AB1E10 /* VNAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VNAppDelegate.h; sourceTree = "<group>"; };
149E8A00150A45AB00AB1E10 /* VNAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VNAppDelegate.m; sourceTree = "<group>"; };
149E8A03150A45AB00AB1E10 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPhone.storyboard; sourceTree = "<group>"; };
149E8A06150A45AB00AB1E10 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPad.storyboard; sourceTree = "<group>"; };
- 149E8A08150A45AB00AB1E10 /* VNViewController.h */ = {isa = PBXFileReference; path = VNViewController.h; sourceTree = "<group>"; };
+ 149E8A08150A45AB00AB1E10 /* VNViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VNViewController.h; sourceTree = "<group>"; };
149E8A09150A45AB00AB1E10 /* VNViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VNViewController.m; sourceTree = "<group>"; };
+ 14DD86DD150A7197003098B3 /* VNTextInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VNTextInputView.h; sourceTree = "<group>"; };
+ 14DD86DE150A7197003098B3 /* VNTextInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VNTextInputView.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -43,12 +60,26 @@
149E89F1150A45AA00AB1E10 /* UIKit.framework in Frameworks */,
149E89F3150A45AA00AB1E10 /* Foundation.framework in Frameworks */,
149E89F5150A45AA00AB1E10 /* CoreGraphics.framework in Frameworks */,
+ 14142067150A865D00E5216F /* QuartzCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 1414206D150A979C00E5216F /* Images */ = {
+ isa = PBXGroup;
+ children = (
+ 145CF6CA150AA2320080E7CB /* Default.png */,
+ 145CF6CB150AA2320080E7CB /* Default@2x.png */,
+ 145CF6C3150AA0C20080E7CB /* Icon.png */,
+ 145CF6C4150AA0C20080E7CB /* Icon@2x.png */,
+ 14142069150A979500E5216F /* microphone.png */,
+ 1414206A150A979500E5216F /* microphone@2x.png */,
+ );
+ name = Images;
+ sourceTree = "<group>";
+ };
149E89E1150A45A900AB1E10 = {
isa = PBXGroup;
children = (
@@ -72,6 +103,7 @@
149E89F0150A45AA00AB1E10 /* UIKit.framework */,
149E89F2150A45AA00AB1E10 /* Foundation.framework */,
149E89F4150A45AA00AB1E10 /* CoreGraphics.framework */,
+ 14142066150A865D00E5216F /* QuartzCore.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -85,6 +117,9 @@
149E8A05150A45AB00AB1E10 /* MainStoryboard_iPad.storyboard */,
149E8A08150A45AB00AB1E10 /* VNViewController.h */,
149E8A09150A45AB00AB1E10 /* VNViewController.m */,
+ 14DD86DD150A7197003098B3 /* VNTextInputView.h */,
+ 14DD86DE150A7197003098B3 /* VNTextInputView.m */,
+ 1414206D150A979C00E5216F /* Images */,
149E89F7150A45AB00AB1E10 /* Supporting Files */,
);
path = VoiceNavigation;
@@ -156,6 +191,12 @@
149E89FB150A45AB00AB1E10 /* InfoPlist.strings in Resources */,
149E8A04150A45AB00AB1E10 /* MainStoryboard_iPhone.storyboard in Resources */,
149E8A07150A45AB00AB1E10 /* MainStoryboard_iPad.storyboard in Resources */,
+ 1414206B150A979500E5216F /* microphone.png in Resources */,
+ 1414206C150A979600E5216F /* microphone@2x.png in Resources */,
+ 145CF6C5150AA0C20080E7CB /* Icon.png in Resources */,
+ 145CF6C6150AA0C20080E7CB /* Icon@2x.png in Resources */,
+ 145CF6CC150AA2320080E7CB /* Default.png in Resources */,
+ 145CF6CD150AA2320080E7CB /* Default@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -169,6 +210,7 @@
149E89FD150A45AB00AB1E10 /* main.m in Sources */,
149E8A01150A45AB00AB1E10 /* VNAppDelegate.m in Sources */,
149E8A0A150A45AB00AB1E10 /* VNViewController.m in Sources */,
+ 14DD86DF150A7197003098B3 /* VNTextInputView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -207,7 +249,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_ARC = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -233,7 +275,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_ARC = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -290,6 +332,7 @@
149E8A0F150A45AB00AB1E10 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
View
85 VoiceNavigation.xcodeproj/xcshareddata/xcschemes/Debug.xcscheme
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "149E89EB150A45AA00AB1E10"
+ BuildableName = "VoiceNavigation.app"
+ BlueprintName = "VoiceNavigation"
+ ReferencedContainer = "container:VoiceNavigation.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "149E89EB150A45AA00AB1E10"
+ BuildableName = "VoiceNavigation.app"
+ BlueprintName = "VoiceNavigation"
+ ReferencedContainer = "container:VoiceNavigation.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "149E89EB150A45AA00AB1E10"
+ BuildableName = "VoiceNavigation.app"
+ BlueprintName = "VoiceNavigation"
+ ReferencedContainer = "container:VoiceNavigation.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "149E89EB150A45AA00AB1E10"
+ BuildableName = "VoiceNavigation.app"
+ BlueprintName = "VoiceNavigation"
+ ReferencedContainer = "container:VoiceNavigation.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
View
BIN VoiceNavigation/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN VoiceNavigation/Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN VoiceNavigation/Icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN VoiceNavigation/Icon@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
6 VoiceNavigation/VNAppDelegate.h
@@ -2,14 +2,14 @@
// VNAppDelegate.h
// VoiceNavigation
//
-// Created by 岸川 克己 on 12/03/09.
-// Copyright (c) 2012年 Kishikawa Katsumi. All rights reserved.
+// Created by Kishikawa Katsumi on 12/03/09.
+// Copyright (c) 2012 Kishikawa Katsumi. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface VNAppDelegate : UIResponder <UIApplicationDelegate>
-@property (strong, nonatomic) UIWindow *window;
+@property (nonatomic, retain) UIWindow *window;
@end
View
40 VoiceNavigation/VNAppDelegate.m
@@ -2,47 +2,23 @@
// VNAppDelegate.m
// VoiceNavigation
//
-// Created by 岸川 克己 on 12/03/09.
-// Copyright (c) 2012年 Kishikawa Katsumi. All rights reserved.
+// Created by Kishikawa Katsumi on 12/03/09.
+// Copyright (c) 2012 Kishikawa Katsumi. All rights reserved.
//
#import "VNAppDelegate.h"
@implementation VNAppDelegate
-@synthesize window = _window;
+@synthesize window;
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
- // Override point for customization after application launch.
- return YES;
-}
-
-- (void)applicationWillResignActive:(UIApplication *)application
-{
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+- (void)dealloc {
+ self.window = nil;
+ [super dealloc];
}
-- (void)applicationDidEnterBackground:(UIApplication *)application
-{
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
-}
-
-- (void)applicationWillEnterForeground:(UIApplication *)application
-{
- // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
-}
-
-- (void)applicationDidBecomeActive:(UIApplication *)application
-{
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
-}
-
-- (void)applicationWillTerminate:(UIApplication *)application
-{
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ return YES;
}
@end
View
19 VoiceNavigation/VNTextInputView.h
@@ -0,0 +1,19 @@
+//
+// VNTextInputView.h
+// VoiceNavigation
+//
+// Created by Kishikawa Katsumi on 12/03/10.
+// Copyright (c) 2012 Kishikawa Katsumi. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+extern NSString * const VNDictationRecordingDidEndNotification;
+extern NSString * const VNDictationRecognitionSucceededNotification;
+extern NSString * const VNDictationRecognitionFailedNotification;
+
+extern NSString * const VNDictationResultKey;
+
+@interface VNTextInputView : UIView<UITextInput, UIGestureRecognizerDelegate>
+
+@end
View
198 VoiceNavigation/VNTextInputView.m
@@ -0,0 +1,198 @@
+//
+// VNTextInputView.m
+// VoiceNavigation
+//
+// Created by Kishikawa Katsumi on 12/03/10.
+// Copyright (c) 2012 Kishikawa Katsumi. All rights reserved.
+//
+
+#import "VNTextInputView.h"
+
+NSString * const VNDictationRecordingDidEndNotification = @"VNDictationRecordingDidEndNotification";
+NSString * const VNDictationRecognitionSucceededNotification = @"VNDictationRecognitionSucceededNotification";
+NSString * const VNDictationRecognitionFailedNotification = @"VNDictationRecognitionFailedNotification";
+
+NSString * const VNDictationResultKey = @"VNDictationResultKey";
+
+@implementation VNTextInputView
+
+#pragma mark C-
+
+- (BOOL)canBecomeFirstResponder {
+ return YES;
+}
+
+- (BOOL)resignFirstResponder {
+ return [super resignFirstResponder];
+}
+
+#pragma mark -
+
+- (UIView *)inputView {
+ return [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
+}
+
+#pragma mark UIKeyInput methods
+
+- (void)deleteBackward {
+
+}
+
+- (BOOL)hasText {
+ return NO;
+}
+
+- (void)insertText:(NSString *)text {
+
+}
+
+#pragma mark UITextInput methods
+
+- (NSString *)textInRange:(UITextRange *)range {
+ return nil;
+}
+
+- (void)replaceRange:(UITextRange *)range withText:(NSString *)text {
+
+}
+
+/* Text may have a selection, either zero-length (a caret) or ranged. Editing operations are
+ * always performed on the text from this selection. nil corresponds to no selection. */
+
+- (UITextRange *)selectedTextRange {
+ return nil;
+}
+
+- (void)setSelectedTextRange:(UITextRange *)selectedTextRange {
+
+}
+
+/* If text can be selected, it can be marked. Marked text represents provisionally
+ * inserted text that has yet to be confirmed by the user. It requires unique visual
+ * treatment in its display. If there is any marked text, the selection, whether a
+ * caret or an extended range, always resides witihin.
+ *
+ * Setting marked text either replaces the existing marked text or, if none is present,
+ * inserts it from the current selection. */
+
+- (UITextRange *)markedTextRange {
+ return nil;
+}
+
+- (NSDictionary *)markedTextStyle {
+ return nil;
+}
+
+- (void)setMarkedTextStyle:(NSDictionary *)markedTextStyle {
+
+}
+
+- (void)setMarkedText:(NSString *)markedText selectedRange:(NSRange)selectedRange {
+
+}
+
+- (void)unmarkText {
+
+}
+
+/* The end and beginning of the the text document. */
+- (UITextPosition *)beginningOfDocument {
+ return nil;
+}
+
+- (UITextPosition *)endOfDocument {
+ return nil;
+}
+
+- (UITextRange *)textRangeFromPosition:(UITextPosition *)fromPosition toPosition:(UITextPosition *)toPosition {
+ return nil;
+}
+
+- (UITextPosition *)positionFromPosition:(UITextPosition *)position offset:(NSInteger)offset {
+ return nil;
+}
+
+- (UITextPosition *)positionFromPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset {
+ return nil;
+}
+
+/* Simple evaluation of positions */
+- (NSComparisonResult)comparePosition:(UITextPosition *)position toPosition:(UITextPosition *)other {
+ return 0;
+}
+
+- (NSInteger)offsetFromPosition:(UITextPosition *)from toPosition:(UITextPosition *)toPosition {
+ return 0;
+}
+
+/* A system-provied input delegate is assigned when the system is interested in input changes. */
+- (id<UITextInputDelegate>)inputDelegate {
+ return nil;
+}
+
+- (void)setInputDelegate:(id<UITextInputDelegate>)inputDelegate {
+
+}
+
+/* A tokenizer must be provided to inform the text input system about text units of varying granularity. */
+- (id<UITextInputTokenizer>)tokenizer {
+ return nil;
+}
+
+/* Layout questions. */
+- (UITextPosition *)positionWithinRange:(UITextRange *)range farthestInDirection:(UITextLayoutDirection)direction {
+ return nil;
+}
+
+- (UITextRange *)characterRangeByExtendingPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction {
+ return nil;
+}
+
+/* Writing direction */
+- (UITextWritingDirection)baseWritingDirectionForPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction {
+ return 0;
+}
+
+- (void)setBaseWritingDirection:(UITextWritingDirection)writingDirection forRange:(UITextRange *)range {
+
+}
+
+/* Geometry used to provide, for example, a correction rect. */
+- (CGRect)firstRectForRange:(UITextRange *)range {
+ return CGRectZero;
+}
+
+- (CGRect)caretRectForPosition:(UITextPosition *)position {
+ return CGRectZero;
+}
+
+/* Hit testing. */
+- (UITextPosition *)closestPositionToPoint:(CGPoint)point {
+ return nil;
+}
+
+- (UITextPosition *)closestPositionToPoint:(CGPoint)point withinRange:(UITextRange *)range {
+ return nil;
+}
+
+- (UITextRange *)characterRangeAtPoint:(CGPoint)point {
+ return nil;
+}
+
+#pragma mark -
+
+- (void)insertDictationResult:(NSArray *)dictationResult {
+ [[NSNotificationCenter defaultCenter] postNotificationName:VNDictationRecognitionSucceededNotification
+ object:self
+ userInfo:[NSDictionary dictionaryWithObject:dictationResult forKey:VNDictationResultKey]];
+}
+
+- (void)dictationRecordingDidEnd {
+ [[NSNotificationCenter defaultCenter] postNotificationName:VNDictationRecordingDidEndNotification object:self];
+}
+
+- (void)dictationRecognitionFailed {
+ [[NSNotificationCenter defaultCenter] postNotificationName:VNDictationRecognitionFailedNotification object:self];
+}
+
+@end
View
15 VoiceNavigation/VNViewController.h
@@ -2,12 +2,23 @@
// VNViewController.h
// VoiceNavigation
//
-// Created by 岸川 克己 on 12/03/09.
-// Copyright (c) 2012年 Kishikawa Katsumi. All rights reserved.
+// Created by Kishikawa Katsumi on 12/03/09.
+// Copyright (c) 2012 Kishikawa Katsumi. All rights reserved.
//
#import <UIKit/UIKit.h>
+#import "VNTextInputView.h"
@interface VNViewController : UIViewController
+@property (nonatomic, retain) IBOutlet UISearchBar *searchBar;
+@property (nonatomic, retain) IBOutlet UIWebView *webView;
+@property (nonatomic, retain) IBOutlet UIView *dictationView;
+@property (nonatomic, retain) IBOutlet UILabel *resultLabel;
+@property (nonatomic, retain) IBOutlet UIImageView *micImageView;
+@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *dictationIndicator;
+@property (nonatomic, retain) IBOutlet UIProgressView *timerView;
+
+@property (nonatomic, retain) IBOutlet VNTextInputView *textInputView;
+
@end
View
207 VoiceNavigation/VNViewController.m
@@ -2,37 +2,214 @@
// VNViewController.m
// VoiceNavigation
//
-// Created by 岸川 克己 on 12/03/09.
-// Copyright (c) 2012年 Kishikawa Katsumi. All rights reserved.
+// Created by Kishikawa Katsumi on 12/03/09.
+// Copyright (c) 2012 Kishikawa Katsumi. All rights reserved.
//
#import "VNViewController.h"
+#import <QuartzCore/QuartzCore.h>
-@interface VNViewController ()
+static const NSTimeInterval VNDictationRepeatInterval = 3.0;
+
+@interface VNViewController () {
+ float count;
+ CADisplayLink *displayLink;
+}
+
+@property (nonatomic, retain) id dictationController;
@end
@implementation VNViewController
-- (void)viewDidLoad
-{
+@synthesize searchBar;
+@synthesize webView;
+@synthesize dictationView;
+@synthesize resultLabel;
+@synthesize micImageView;
+@synthesize dictationIndicator;
+@synthesize timerView;
+
+@synthesize textInputView;
+@synthesize dictationController;
+
+- (void)dealloc {
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ self.searchBar = nil;
+ self.webView = nil;
+ self.dictationView = nil;
+ self.resultLabel = nil;
+ self.micImageView = nil;
+ self.dictationIndicator = nil;
+ self.timerView = nil;
+ [super dealloc];
+}
+
+- (void)viewDidLoad {
[super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
+
+ dictationView.layer.cornerRadius = 8.0f;
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(keyboardWillShow:)
+ name:UIKeyboardWillShowNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(applicationWillEnterForeground:)
+ name:UIApplicationWillEnterForegroundNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(applicationDidEnterBackground:)
+ name:UIApplicationDidEnterBackgroundNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(dictationRecordingDidEnd:)
+ name:VNDictationRecordingDidEndNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(dictationRecognitionSucceeded:)
+ name:VNDictationRecognitionSucceededNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(dictationRecognitionFailed:)
+ name:VNDictationRecognitionFailedNotification object:nil];
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+
+ if (![textInputView isFirstResponder]) {
+ [textInputView becomeFirstResponder];
+ }
}
-- (void)viewDidUnload
-{
+- (void)viewDidUnload {
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
[super viewDidUnload];
- // Release any retained subviews of the main view.
}
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
- if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
- return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
- } else {
- return YES;
+#pragma mark -
+
+- (void)resetProgress {
+ count = 0.0f;
+ [timerView setProgress:count animated:NO];
+}
+
+- (void)showWaitingServerProcessIndicator {
+ [dictationIndicator startAnimating];
+ micImageView.hidden = YES;
+}
+
+- (void)hideWaitingServerProcessIndicator {
+ [dictationIndicator stopAnimating];
+}
+
+- (void)startDictation {
+ [dictationController performSelector:@selector(startDictation)];
+
+ displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onTimer:)];
+ [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
+
+ [self resetProgress];
+ micImageView.hidden = NO;
+ resultLabel.text = nil;
+}
+
+- (void)stopDictation {
+ [dictationController performSelector:@selector(stopDictation)];
+
+ [displayLink invalidate];
+ displayLink = nil;
+
+ [self showWaitingServerProcessIndicator];
+ micImageView.hidden = YES;
+}
+
+- (void)cancelDictation {
+ [dictationController performSelector:@selector(cancelDictation)];
+
+ [displayLink invalidate];
+ displayLink = nil;
+
+ [self resetProgress];
+ micImageView.hidden = NO;
+ resultLabel.text = nil;
+}
+
+#pragma mark -
+
+- (NSString *)wholeTestWithDictationResult:(NSArray *)dictationResult {
+ NSMutableString *text = [NSMutableString string];
+ for (UIDictationPhrase *phrase in dictationResult) {
+ [text appendString:phrase.text];
+ }
+
+ return text;
+}
+
+- (void)processDictationText:(NSString *)text {
+ resultLabel.text = text;
+
+ if ([text hasSuffix:[NSString stringWithUTF8String:"を検索"]]) {
+ text = [text substringToIndex:[text length] - 3];
+
+ searchBar.text = text;
+
+ NSURL *searchURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.google.com/m?q=%@&ie=UTF-8&oe=UTF-8&client=safari",
+ [text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
+ [webView loadRequest:[NSURLRequest requestWithURL:searchURL]];
+ } else if ([text isEqualToString:[NSString stringWithUTF8String:"戻る"]]) {
+ [webView goBack];
+ } else if ([text isEqualToString:[NSString stringWithUTF8String:"進む"]]) {
+ [webView goForward];
+ }
+}
+
+#pragma mark -
+
+- (void)onTimer:(CADisplayLink *)sender {
+ count += sender.duration / 10.0;
+ [timerView setProgress:count animated:YES];
+ if (count >= 1.0f) {
+ [self stopDictation];
+ }
+}
+
+#pragma mark -
+
+- (void)keyboardWillShow:(NSNotification *)notification {
+ self.dictationController = [NSClassFromString(@"UIDictationController") performSelector:@selector(sharedInstance)];
+ if (dictationController) {
+ [self startDictation];
}
}
+- (void)applicationWillEnterForeground:(NSNotification *)notification {
+ [self startDictation];
+}
+
+- (void)applicationDidEnterBackground:(NSNotification *)notification {
+ [self cancelDictation];
+}
+
+#pragma mark -
+
+- (void)dictationRecordingDidEnd:(NSNotification *)notification {
+}
+
+- (void)dictationRecognitionSucceeded:(NSNotification *)notification {
+ NSDictionary *userInfo = notification.userInfo;
+ NSArray *dictationResult = [userInfo objectForKey:VNDictationResultKey];
+
+ NSString *text = [self wholeTestWithDictationResult:dictationResult];
+ [self processDictationText:text];
+
+ [self hideWaitingServerProcessIndicator];
+
+ [self performSelector:@selector(startDictation) withObject:nil afterDelay:VNDictationRepeatInterval];
+}
+
+- (void)dictationRecognitionFailed:(NSNotification *)notification {
+ resultLabel.text = @"-";
+
+ [self hideWaitingServerProcessIndicator];
+
+ [self performSelector:@selector(startDictation) withObject:nil afterDelay:VNDictationRepeatInterval];
+}
+
@end
View
21 VoiceNavigation/VoiceNavigation-Info.plist
@@ -17,17 +17,30 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.0</string>
+ <string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.0</string>
+ <string>1.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>MainStoryboard_iPhone</string>
<key>UIMainStoryboardFile~ipad</key>
<string>MainStoryboard_iPad</string>
+ <key>CFBundleIcons</key>
+ <dict>
+ <key>CFBundlePrimaryIcon</key>
+ <dict>
+ <key>CFBundleIconFiles</key>
+ <array>
+ <string>Icon.png</string>
+ <string>Icon@2x.png</string>
+ </array>
+ <key>UIPrerenderedIcon</key>
+ <false/>
+ </dict>
+ </dict>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
@@ -35,15 +48,11 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
View
2 VoiceNavigation/en.lproj/InfoPlist.strings
@@ -1,2 +1,4 @@
/* Localized versions of Info.plist keys */
+CFBundleName = "VoiceNavigation";
+CFBundleDisplayName = "VoiceNavi";
View
86 VoiceNavigation/en.lproj/MainStoryboard_iPhone.storyboard
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.0" toolsVersion="1906" systemVersion="11A511" targetRuntime="iOS.CocoaTouch" nextObjectID="6" propertyAccessControl="none" initialViewController="2">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.1" toolsVersion="2182" systemVersion="11D50b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="2">
<dependencies>
+ <deployment defaultVersion="1296" identifier="iOS"/>
<development defaultVersion="4200" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="902"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1179"/>
</dependencies>
<scenes>
+ <!--View Controller-->
<scene sceneID="5">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="4" sceneMemberID="firstResponder"/>
@@ -12,13 +14,91 @@
<view key="view" contentMode="scaleToFill" id="3">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <subviews/>
+ <subviews>
+ <searchBar userInteractionEnabled="NO" contentMode="redraw" id="4RW-sB-Gsf">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+ <textInputTraits key="textInputTraits"/>
+ <connections>
+ <outlet property="delegate" destination="2" id="GL3-lb-j7t"/>
+ </connections>
+ </searchBar>
+ <view contentMode="scaleToFill" id="J2I-Bq-rX6" customClass="VNTextInputView">
+ <rect key="frame" x="0.0" y="44" width="320" height="416"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <webView contentMode="scaleToFill" scalesPageToFit="YES" id="pPB-fy-iug">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="416"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </webView>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ <view contentMode="scaleToFill" id="Pwo-ce-Pmm">
+ <rect key="frame" x="30" y="170" width="260" height="120"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <progressView opaque="NO" contentMode="scaleToFill" progressViewStyle="bar" id="sf8-yi-9jz">
+ <rect key="frame" x="20" y="90" width="220" height="11"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ </progressView>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" minimumFontSize="10" id="z2h-y6-h49">
+ <rect key="frame" x="20" y="7" width="220" height="63"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="microphone.png" id="bJ9-ju-jbx">
+ <rect key="frame" x="124" y="40" width="12" height="24"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </imageView>
+ <activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" hidesWhenStopped="YES" style="white" id="aKv-m0-5y6">
+ <rect key="frame" x="120" y="40" width="20" height="20"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ </activityIndicatorView>
+ </subviews>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.29999999999999999" colorSpace="calibratedRGB"/>
+ </view>
+ </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
+ <connections>
+ <outlet property="dictationIndicator" destination="aKv-m0-5y6" id="7ih-ux-PKt"/>
+ <outlet property="dictationView" destination="Pwo-ce-Pmm" id="ASz-7M-lXe"/>
+ <outlet property="micImageView" destination="bJ9-ju-jbx" id="wSC-Dl-i9M"/>
+ <outlet property="resultLabel" destination="z2h-y6-h49" id="f5w-Pd-GZI"/>
+ <outlet property="searchBar" destination="4RW-sB-Gsf" id="cIY-Kk-9EC"/>
+ <outlet property="textInputView" destination="J2I-Bq-rX6" id="pVl-fS-Rwv"/>
+ <outlet property="timerView" destination="sf8-yi-9jz" id="JLh-Mq-xBB"/>
+ <outlet property="webView" destination="pPB-fy-iug" id="dP3-8u-tc5"/>
+ </connections>
</viewController>
</objects>
</scene>
</scenes>
+ <resources>
+ <image name="microphone.png" width="12" height="24"/>
+ </resources>
+ <classes>
+ <class className="VNTextInputView" superclassName="UIView">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/VNTextInputView.h"/>
+ </class>
+ <class className="VNViewController" superclassName="UIViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/VNViewController.h"/>
+ <relationships>
+ <relationship kind="outlet" name="dictationIndicator" candidateClass="UIActivityIndicatorView"/>
+ <relationship kind="outlet" name="dictationView" candidateClass="UIView"/>
+ <relationship kind="outlet" name="micImageView" candidateClass="UIImageView"/>
+ <relationship kind="outlet" name="resultLabel" candidateClass="UILabel"/>
+ <relationship kind="outlet" name="searchBar" candidateClass="UISearchBar"/>
+ <relationship kind="outlet" name="textInputView" candidateClass="VNTextInputView"/>
+ <relationship kind="outlet" name="timerView" candidateClass="UIProgressView"/>
+ <relationship kind="outlet" name="webView" candidateClass="UIWebView"/>
+ </relationships>
+ </class>
+ </classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
View
4 VoiceNavigation/main.m
@@ -2,8 +2,8 @@
// main.m
// VoiceNavigation
//
-// Created by 岸川 克己 on 12/03/09.
-// Copyright (c) 2012年 Kishikawa Katsumi. All rights reserved.
+// Created by Kishikawa Katsumi on 12/03/09.
+// Copyright (c) 2012 Kishikawa Katsumi. All rights reserved.
//
#import <UIKit/UIKit.h>
View
BIN VoiceNavigation/microphone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN VoiceNavigation/microphone@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a8903cc

Please sign in to comment.
Something went wrong with that request. Please try again.