Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions Swift/VInput Keyboard/InputMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class InputMode : Mode {
var keyboardController: KeyboardViewController!
let MODE_NAME = "InputMode"
var currentWord: String = ""
var capsOn: Bool = false

init(values: Values, keyboardController: KeyboardViewController) {
self.values = values
Expand Down Expand Up @@ -44,21 +45,32 @@ class InputMode : Mode {
func onSwipeLeft() {
values.shiftLeft()
VisualUtil.updateViewAndAnnounce(letter: values.getCurrentValue())
capsOn = false
}

func onSwipeRight() {
values.shiftRight()
VisualUtil.updateViewAndAnnounce(letter: values.getCurrentValue())
capsOn = false
}

func onSwipeUp() {
// TO DO
let text = "Inserting " + values.getCurrentValue()
var text = "Inserting " + values.getCurrentValue()
//SpeechUtil.speak(textToSpeak: text)
if capsOn {
currentWord.append(values.getCurrentValue().uppercased())
keyboardController.textDocumentProxy.insertText(values.getCurrentValue().uppercased())
text = "Inserting upper case " + values.getCurrentValue()
}
else{
currentWord.append(values.getCurrentValue())
keyboardController.textDocumentProxy.insertText(values.getCurrentValue())
}
SpeechUtil.speak(textToSpeak: text)
currentWord.append(values.getCurrentValue())
keyboardController.textDocumentProxy.insertText(values.getCurrentValue())
values.isSearchingThenReset()
VisualUtil.updateViewAndAnnounce(letter: values.getCurrentValue())
capsOn = false


// search for results
Expand Down Expand Up @@ -109,12 +121,22 @@ class InputMode : Mode {
VisualUtil.updateViewAndAnnounce(letter: values.getCurrentValue())
}

func doubleTap() {
let text = "Left or right of " + values.getCurrentValue()
SpeechUtil.speak(textToSpeak: currentWord)
func onHold() {
// let text = "Left or right of " + values.getCurrentValue()
// SpeechUtil.speak(textToSpeak: currentWord)
if capsOn {
capsOn = false
VisualUtil.updateView(letter: values.getCurrentValue())
SpeechUtil.speak(textToSpeak: "Current letter lower cased")
}
else {
capsOn = true
VisualUtil.updateView(letter: values.getCurrentValue().uppercased())
SpeechUtil.speak(textToSpeak: "Current letter upper cased")
}
}

func onHold() {
func doubleTap() {
SpeechUtil.speak(textToSpeak: "Inserting space")
keyboardController.textDocumentProxy.insertText(" ")
currentWord = ""
Expand Down
6 changes: 4 additions & 2 deletions Swift/VInput Keyboard/KeyboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,10 @@ class KeyboardViewController: UIInputViewController {
}

//To-do: Migrate over -> Mike
func onHold() {
currentMode.onHold()
func onHold(gestureRecognizer: UIGestureRecognizer) {
if gestureRecognizer.state == UIGestureRecognizerState.began{
currentMode.onHold()
}
// if shortHoldRecognizer.state == UIGestureRecognizerState.began {
// self.textDocumentProxy.insertText(" ")
// newWord = true
Expand Down
4 changes: 3 additions & 1 deletion Swift/VInput Keyboard/VisualUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ class VisualUtil {
let text = "Left or right of " + letter
SpeechUtil.speak(textToSpeak: text)
}

static func updateView(letter: String) {
KeyboardViewController.letterLabel.text = letter
}
}