diff --git a/Keyboards/KeyboardsBase/InterfaceVariables.swift b/Keyboards/KeyboardsBase/InterfaceVariables.swift index 1a083081..e65b56fa 100644 --- a/Keyboards/KeyboardsBase/InterfaceVariables.swift +++ b/Keyboards/KeyboardsBase/InterfaceVariables.swift @@ -12,6 +12,7 @@ var proxy: UITextDocumentProxy! // MARK: Display Variables // Variables for the keyboard and its appearance. +public var usingExpandedKeyboard = false; var keyboard = [[String]]() var allKeys = [String]() let specialKeys = [ diff --git a/Keyboards/KeyboardsBase/KeyboardViewController.swift b/Keyboards/KeyboardsBase/KeyboardViewController.swift index 5b12dc90..eba25a8c 100644 --- a/Keyboards/KeyboardsBase/KeyboardViewController.swift +++ b/Keyboards/KeyboardsBase/KeyboardViewController.swift @@ -18,6 +18,7 @@ class KeyboardViewController: UIInputViewController { @IBOutlet var stackView2: UIStackView! @IBOutlet var stackView3: UIStackView! + private var tipView: ToolTipView? /// Changes the height of `stackViewNum` depending on device type and size. @@ -1591,6 +1592,18 @@ class KeyboardViewController: UIInputViewController { } catch {} } + //Check if ipad device meets the criteria for expanded keyboard + if DeviceType.isPad { + //Check if device has home button, this will be used later to determine if we should use expanded keypad or not. + if #available(iOS 13.0, *), (keyboardView.safeAreaInsets.bottom <= 0 && UIScreen.main.bounds.width > 768) { + usingExpandedKeyboard = true; + } + else + { + usingExpandedKeyboard = false; + } + } + setKeyboard() setCommaAndPeriodKeysConditionally() setCommandBackground() @@ -1620,7 +1633,8 @@ class KeyboardViewController: UIInputViewController { } } else { letterKeyWidth = (UIScreen.main.bounds.width - 6) / CGFloat(letterKeys[0].count) * 0.9 - numSymKeyWidth = (UIScreen.main.bounds.width - 6) / CGFloat(numberKeys[0].count) * 0.9 + //If we are using expanded keys the numberKeys array is empty, we use symbolKeys + numSymKeyWidth = (UIScreen.main.bounds.width - 6) / CGFloat( (usingExpandedKeyboard) == true ? symbolKeys[0].count: numberKeys[0].count) * 0.9 } // Derive keyboard given current states and set widths. @@ -1910,7 +1924,7 @@ class KeyboardViewController: UIInputViewController { } else { widthOfSpacing = ( (UIScreen.main.bounds.width - 6.0) - - (CGFloat(numberKeys[0].count) * numSymKeyWidth) + - (CGFloat((usingExpandedKeyboard) == true ? symbolKeys[0].count : numberKeys[0].count) * numSymKeyWidth) ) / (CGFloat(letterKeys[0].count) - 1.0 ) @@ -2454,7 +2468,8 @@ class KeyboardViewController: UIInputViewController { capsLockPossible = true case "123", ".?123": - changeKeyboardToNumberKeys() + (usingExpandedKeyboard) == true ? changeKeyboardToSymbolKeys() : changeKeyboardToNumberKeys() + case "#+=": changeKeyboardToSymbolKeys() diff --git a/Keyboards/LanguageKeyboards/English/ENInterfaceVariables.swift b/Keyboards/LanguageKeyboards/English/ENInterfaceVariables.swift index c312d7bf..77977551 100644 --- a/Keyboards/LanguageKeyboards/English/ENInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/English/ENInterfaceVariables.swift @@ -98,10 +98,17 @@ func getENKeys() { rightKeyChars = ["p", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = EnglishKeyboardConstants.letterKeysPad - numberKeys = EnglishKeyboardConstants.numberKeysPad - symbolKeys = EnglishKeyboardConstants.symbolKeysPad - + if (usingExpandedKeyboard) + { + letterKeys = EnglishKeyboardConstants.letterKeysPadExpanded; + symbolKeys = EnglishKeyboardConstants.symbolKeysPadExpanded; + } + else + { + letterKeys = EnglishKeyboardConstants.letterKeysPad + numberKeys = EnglishKeyboardConstants.numberKeysPad + symbolKeys = EnglishKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1) letterKeys[0].append("delete") diff --git a/Keyboards/LanguageKeyboards/French/FR-AZERTYInterfaceVariables.swift b/Keyboards/LanguageKeyboards/French/FR-AZERTYInterfaceVariables.swift index 0128e836..77612141 100644 --- a/Keyboards/LanguageKeyboards/French/FR-AZERTYInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/French/FR-AZERTYInterfaceVariables.swift @@ -96,10 +96,17 @@ func getFRKeys() { rightKeyChars = ["p", "m", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = FrenchKeyboardConstants.letterKeysPad - numberKeys = FrenchKeyboardConstants.numberKeysPad - symbolKeys = FrenchKeyboardConstants.symbolKeysPad - + if (usingExpandedKeyboard) + { + letterKeys = FrenchKeyboardConstants.letterKeysPadExpanded; + symbolKeys = FrenchKeyboardConstants.symbolKeysPadExpanded; + } + else + { + letterKeys = FrenchKeyboardConstants.letterKeysPad + numberKeys = FrenchKeyboardConstants.numberKeysPad + symbolKeys = FrenchKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1) letterKeys[0].append("delete") diff --git a/Keyboards/LanguageKeyboards/French/FR-QWERTYInterfaceVariables.swift b/Keyboards/LanguageKeyboards/French/FR-QWERTYInterfaceVariables.swift index 5fcb55ad..c74c2d55 100644 --- a/Keyboards/LanguageKeyboards/French/FR-QWERTYInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/French/FR-QWERTYInterfaceVariables.swift @@ -94,9 +94,17 @@ func getFRQWERTYKeys() { rightKeyChars = ["p", "m", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = FrenchQWERTYKeyboardConstants.letterKeysPad - numberKeys = FrenchQWERTYKeyboardConstants.numberKeysPad - symbolKeys = FrenchQWERTYKeyboardConstants.symbolKeysPad + if (usingExpandedKeyboard) + { + letterKeys = FrenchQWERTYKeyboardConstants.letterKeysPadExpanded; + symbolKeys = FrenchQWERTYKeyboardConstants.symbolKeysPadExpanded; + } + else + { + letterKeys = FrenchQWERTYKeyboardConstants.letterKeysPad + numberKeys = FrenchQWERTYKeyboardConstants.numberKeysPad + symbolKeys = FrenchQWERTYKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1) diff --git a/Keyboards/LanguageKeyboards/German/DEInterfaceVariables.swift b/Keyboards/LanguageKeyboards/German/DEInterfaceVariables.swift index 2c7e9bed..f88d9a0c 100644 --- a/Keyboards/LanguageKeyboards/German/DEInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/German/DEInterfaceVariables.swift @@ -99,9 +99,17 @@ func getDEKeys() { rightKeyChars = ["ü", "ä", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = GermanKeyboardConstants.letterKeysPad - numberKeys = GermanKeyboardConstants.numberKeysPad - symbolKeys = GermanKeyboardConstants.symbolKeysPad + if (usingExpandedKeyboard) + { + letterKeys = GermanKeyboardConstants.letterKeysPadExpanded; + symbolKeys = GermanKeyboardConstants.symbolKeysPadExpanded; + } + else + { + letterKeys = GermanKeyboardConstants.letterKeysPad + numberKeys = GermanKeyboardConstants.numberKeysPad + symbolKeys = GermanKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1) diff --git a/Keyboards/LanguageKeyboards/Italian/ITInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Italian/ITInterfaceVariables.swift index 690cbc3e..10196e8f 100644 --- a/Keyboards/LanguageKeyboards/Italian/ITInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Italian/ITInterfaceVariables.swift @@ -96,9 +96,17 @@ func getITKeys() { rightKeyChars = ["p", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = ItalianKeyboardConstants.letterKeysPad - numberKeys = ItalianKeyboardConstants.numberKeysPad - symbolKeys = ItalianKeyboardConstants.symbolKeysPad + if (usingExpandedKeyboard) + { + letterKeys = ItalianKeyboardConstants.letterKeysPadExpanded; + symbolKeys = ItalianKeyboardConstants.symbolKeysPadExpanded; + } + else + { + letterKeys = ItalianKeyboardConstants.letterKeysPad + numberKeys = ItalianKeyboardConstants.numberKeysPad + symbolKeys = ItalianKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1) diff --git a/Keyboards/LanguageKeyboards/Portuguese/PTInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Portuguese/PTInterfaceVariables.swift index f8cf9f42..0ca49084 100644 --- a/Keyboards/LanguageKeyboards/Portuguese/PTInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Portuguese/PTInterfaceVariables.swift @@ -95,9 +95,17 @@ func getPTKeys() { rightKeyChars = ["p", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = PortugueseKeyboardConstants.letterKeysPad - numberKeys = PortugueseKeyboardConstants.numberKeysPad - symbolKeys = PortugueseKeyboardConstants.symbolKeysPad + if (usingExpandedKeyboard) + { + letterKeys = PortugueseKeyboardConstants.letterKeysPadExpanded; + symbolKeys = PortugueseKeyboardConstants.symbolKeysPadExpanded; + } + else + { + letterKeys = PortugueseKeyboardConstants.letterKeysPad + numberKeys = PortugueseKeyboardConstants.numberKeysPad + symbolKeys = PortugueseKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1) diff --git a/Keyboards/LanguageKeyboards/Russian/RUInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Russian/RUInterfaceVariables.swift index 5385f3f1..47620d9a 100644 --- a/Keyboards/LanguageKeyboards/Russian/RUInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Russian/RUInterfaceVariables.swift @@ -90,9 +90,17 @@ func getRUKeys() { rightKeyChars = ["х", "э", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = RussianKeyboardConstants.letterKeysPad - numberKeys = RussianKeyboardConstants.numberKeysPad - symbolKeys = RussianKeyboardConstants.symbolKeysPad + if(usingExpandedKeyboard) + { + letterKeys = RussianKeyboardConstants.letterKeysPadExpanded; + letterKeys = RussianKeyboardConstants.symbolKeysPadExpanded; + } + else + { + letterKeys = RussianKeyboardConstants.letterKeysPad + numberKeys = RussianKeyboardConstants.numberKeysPad + symbolKeys = RussianKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1) diff --git a/Keyboards/LanguageKeyboards/Spanish/ESInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Spanish/ESInterfaceVariables.swift index 268586a9..327dbf7b 100644 --- a/Keyboards/LanguageKeyboards/Spanish/ESInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Spanish/ESInterfaceVariables.swift @@ -97,9 +97,18 @@ func getESKeys() { rightKeyChars = ["p", "ñ", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = SpanishKeyboardConstants.letterKeysPad - numberKeys = SpanishKeyboardConstants.numberKeysPad - symbolKeys = SpanishKeyboardConstants.symbolKeysPad + //if the iPad is wide enough, and has no home button, use the expanded keys + if(usingExpandedKeyboard) + { + letterKeys = SpanishKeyboardConstants.letterKeysPadExpanded; + symbolKeys = SpanishKeyboardConstants.symbolKeysPadExpanded; + } + else + { + letterKeys = SpanishKeyboardConstants.letterKeysPad + numberKeys = SpanishKeyboardConstants.numberKeysPad + symbolKeys = SpanishKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1) diff --git a/Keyboards/LanguageKeyboards/Swedish/SVInterfaceVariables.swift b/Keyboards/LanguageKeyboards/Swedish/SVInterfaceVariables.swift index 8e95b512..9bdd6fa5 100644 --- a/Keyboards/LanguageKeyboards/Swedish/SVInterfaceVariables.swift +++ b/Keyboards/LanguageKeyboards/Swedish/SVInterfaceVariables.swift @@ -98,9 +98,17 @@ func getSVKeys() { rightKeyChars = ["å", "ä", "0", "\"", "=", "·"] centralKeyChars = allKeys.filter { !leftKeyChars.contains($0) && !rightKeyChars.contains($0) } } else { - letterKeys = SwedishKeyboardConstants.letterKeysPad - numberKeys = SwedishKeyboardConstants.numberKeysPad - symbolKeys = SwedishKeyboardConstants.symbolKeysPad + //if the iPad is wide enough, and has no home button, use the expanded keys + if (usingExpandedKeyboard) { + letterKeys = SwedishKeyboardConstants.letterKeysPadExpanded + symbolKeys = SwedishKeyboardConstants.symbolKeysPadExpanded + } + else + { + letterKeys = SwedishKeyboardConstants.letterKeysPad + numberKeys = SwedishKeyboardConstants.numberKeysPad + symbolKeys = SwedishKeyboardConstants.symbolKeysPad + } // If the iPad is too small to have a numbers row. letterKeys.removeFirst(1)