Skip to content

Commit

Permalink
#383 formatting for keyboard key sizing functions and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Jan 13, 2024
1 parent f8d3fd2 commit 0c721ec
Show file tree
Hide file tree
Showing 2 changed files with 236 additions and 247 deletions.
30 changes: 12 additions & 18 deletions Keyboards/KeyboardsBase/KeyboardKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,31 +253,29 @@ class KeyboardKey: UIButton {

/// Adjusts the width of a key if it's one of the special characters on the iPad keyboard.
func adjustPadKeyWidth() {
if (usingExpandedKeyboard)
{
if usingExpandedKeyboard {
scalarSpecialKeysWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
scalarReturnKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
if key == "ABC" || key == "АБВ" {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1).isActive = true
} else if ["delete", "#+=", "selectKeyboard", SpecialKeys.capsLock].contains(key) {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarSpecialKeysWidth).isActive = true //*2 scalarSpecialKeysWidth = 1
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarSpecialKeysWidth).isActive = true // *2 scalarSpecialKeysWidth = 1
} else if [SpecialKeys.indent].contains(key) {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarIndentKeyWidth).isActive = true // scalarIndentKeyWidth
} else if ["shift"].contains(key) {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarShiftKeyWidth).isActive = true // scalarShiftKeyWidth
} else if ["return"].contains(key) {
layer.setValue(true, forKey: "isSpecial")
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarReturnKeyWidth).isActive = true // scalarReturnKeyWidth
}
else if ["123", ".?123", "return", "hideKeyboard"].contains(key) {
if key == "return"
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
&& row == 1
&& DeviceType.isPad
} else if ["123", ".?123", "return", "hideKeyboard"].contains(key) {
if key == "return"
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
&& row == 1
&& DeviceType.isPad
{
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1.5).isActive = true
Expand All @@ -288,9 +286,7 @@ class KeyboardKey: UIButton {
} else if key != spaceBar && key != languageTextForSpaceBar {
widthAnchor.constraint(equalToConstant: keyWidth).isActive = true
}
}
else
{
} else {
if key == "ABC" || key == "АБВ" {
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1).isActive = true
Expand All @@ -299,9 +295,9 @@ class KeyboardKey: UIButton {
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1).isActive = true
} else if ["123", ".?123", "return", "hideKeyboard"].contains(key) {
if key == "return"
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
&& row == 1
&& DeviceType.isPad
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
&& row == 1
&& DeviceType.isPad
{
layer.setValue(true, forKey: "isSpecial")
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1.5).isActive = true
Expand All @@ -314,8 +310,6 @@ class KeyboardKey: UIButton {
}
}
}



/// Adjusts the width of a key if it's one of the special characters on the keyboard.
func adjustKeyWidth() {
Expand Down
Loading

0 comments on commit 0c721ec

Please sign in to comment.