Skip to content

Commit 0c721ec

Browse files
committed
#383 formatting for keyboard key sizing functions and comments
1 parent f8d3fd2 commit 0c721ec

File tree

2 files changed

+236
-247
lines changed

2 files changed

+236
-247
lines changed

Keyboards/KeyboardsBase/KeyboardKeys.swift

+12-18
Original file line numberDiff line numberDiff line change
@@ -253,31 +253,29 @@ class KeyboardKey: UIButton {
253253

254254
/// Adjusts the width of a key if it's one of the special characters on the iPad keyboard.
255255
func adjustPadKeyWidth() {
256-
if (usingExpandedKeyboard)
257-
{
256+
if usingExpandedKeyboard {
258257
scalarSpecialKeysWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
259258
scalarReturnKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
260259
if key == "ABC" || key == "АБВ" {
261260
layer.setValue(true, forKey: "isSpecial")
262261
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1).isActive = true
263262
} else if ["delete", "#+=", "selectKeyboard", SpecialKeys.capsLock].contains(key) {
264263
layer.setValue(true, forKey: "isSpecial")
265-
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarSpecialKeysWidth).isActive = true //*2 scalarSpecialKeysWidth = 1
264+
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarSpecialKeysWidth).isActive = true // *2 scalarSpecialKeysWidth = 1
266265
} else if [SpecialKeys.indent].contains(key) {
267266
layer.setValue(true, forKey: "isSpecial")
268267
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarIndentKeyWidth).isActive = true // scalarIndentKeyWidth
269268
} else if ["shift"].contains(key) {
270269
layer.setValue(true, forKey: "isSpecial")
271270
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarShiftKeyWidth).isActive = true // scalarShiftKeyWidth
272271
} else if ["return"].contains(key) {
273-
layer.setValue(true, forKey: "isSpecial")
272+
layer.setValue(true, forKey: "isSpecial")
274273
widthAnchor.constraint(equalToConstant: numSymKeyWidth * scalarReturnKeyWidth).isActive = true // scalarReturnKeyWidth
275-
}
276-
else if ["123", ".?123", "return", "hideKeyboard"].contains(key) {
277-
if key == "return"
278-
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
279-
&& row == 1
280-
&& DeviceType.isPad
274+
} else if ["123", ".?123", "return", "hideKeyboard"].contains(key) {
275+
if key == "return"
276+
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
277+
&& row == 1
278+
&& DeviceType.isPad
281279
{
282280
layer.setValue(true, forKey: "isSpecial")
283281
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1.5).isActive = true
@@ -288,9 +286,7 @@ class KeyboardKey: UIButton {
288286
} else if key != spaceBar && key != languageTextForSpaceBar {
289287
widthAnchor.constraint(equalToConstant: keyWidth).isActive = true
290288
}
291-
}
292-
else
293-
{
289+
} else {
294290
if key == "ABC" || key == "АБВ" {
295291
layer.setValue(true, forKey: "isSpecial")
296292
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1).isActive = true
@@ -299,9 +295,9 @@ class KeyboardKey: UIButton {
299295
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1).isActive = true
300296
} else if ["123", ".?123", "return", "hideKeyboard"].contains(key) {
301297
if key == "return"
302-
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
303-
&& row == 1
304-
&& DeviceType.isPad
298+
&& (controllerLanguage == "Portuguese" || controllerLanguage == "Italian" || commandState == .translate)
299+
&& row == 1
300+
&& DeviceType.isPad
305301
{
306302
layer.setValue(true, forKey: "isSpecial")
307303
widthAnchor.constraint(equalToConstant: numSymKeyWidth * 1.5).isActive = true
@@ -314,8 +310,6 @@ class KeyboardKey: UIButton {
314310
}
315311
}
316312
}
317-
318-
319313

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

0 commit comments

Comments
 (0)