This commit is contained in:
2025-11-18 20:53:47 +08:00
parent 254e65906a
commit 3dcc4932c3
109 changed files with 1432 additions and 84 deletions

View File

@@ -96,16 +96,41 @@
if (!self.symbolsMoreOn) {
// 123
r1 = @[ [KBKey keyWithTitle:@"1" output:@"1"], [KBKey keyWithTitle:@"2" output:@"2"], [KBKey keyWithTitle:@"3" output:@"3"],
[KBKey keyWithTitle:@"4" output:@"4"], [KBKey keyWithTitle:@"5" output:@"5"], [KBKey keyWithTitle:@"6" output:@"6"],
[KBKey keyWithTitle:@"7" output:@"7"], [KBKey keyWithTitle:@"8" output:@"8"], [KBKey keyWithTitle:@"9" output:@"9"], [KBKey keyWithTitle:@"0" output:@"0"] ];
r2 = @[ [KBKey keyWithTitle:@"-" output:@"-"], [KBKey keyWithTitle:@"/" output:@"/"], [KBKey keyWithTitle:@":" output:@":"],
[KBKey keyWithTitle:@";" output:@";"], [KBKey keyWithTitle:@"(" output:@"("], [KBKey keyWithTitle:@")" output:@")"],
[KBKey keyWithTitle:@"$" output:@"$"], [KBKey keyWithTitle:@"&" output:@"&"], [KBKey keyWithTitle:@"@" output:@"@"], [KBKey keyWithTitle:@"\"" output:@"\""] ];
r3 = @[ [KBKey keyWithTitle:@"#+=" type:KBKeyTypeSymbolsToggle],
[KBKey keyWithTitle:@"," output:@","], [KBKey keyWithTitle:@"." output:@"."], [KBKey keyWithTitle:@"?" output:@"?"],
[KBKey keyWithTitle:@"!" output:@"!"], [KBKey keyWithTitle:@"'" output:@"'"],
[KBKey keyWithTitle:@"" type:KBKeyTypeBackspace] ];
r1 = @[ [KBKey keyWithTitle:@"1" output:@"1"],
[KBKey keyWithTitle:@"2" output:@"2"],
[KBKey keyWithTitle:@"3" output:@"3"],
[KBKey keyWithTitle:@"4" output:@"4"],
[KBKey keyWithTitle:@"5" output:@"5"],
[KBKey keyWithTitle:@"6" output:@"6"],
[KBKey keyWithTitle:@"7" output:@"7"],
[KBKey keyWithTitle:@"8" output:@"8"],
[KBKey keyWithTitle:@"9" output:@"9"],
[KBKey keyWithTitle:@"0" output:@"0"] ];
r2 = @[ [KBKey keyWithTitle:@"-" output:@"-"],
[KBKey keyWithTitle:@"/" output:@"/"],
[KBKey keyWithTitle:@":" output:@":"],
[KBKey keyWithTitle:@";" output:@";"],
[KBKey keyWithTitle:@"(" output:@"("],
[KBKey keyWithTitle:@")" output:@")"],
[KBKey keyWithTitle:@"$" output:@"$"],
[KBKey keyWithTitle:@"&" output:@"&"],
[KBKey keyWithTitle:@"@" output:@"@"],
[KBKey keyWithTitle:@"\"" output:@"\""] ];
// #+=退
KBKey *toggle = [KBKey keyWithIdentifier:@"symbols_toggle_more"
title:@"#+="
output:@""
type:KBKeyTypeSymbolsToggle];
KBKey *comma = [KBKey keyWithTitle:@"," output:@","];
KBKey *dot = [KBKey keyWithTitle:@"." output:@"."];
KBKey *q = [KBKey keyWithTitle:@"?" output:@"?"];
KBKey *ex = [KBKey keyWithTitle:@"!" output:@"!"];
KBKey *quote = [KBKey keyWithTitle:@"'" output:@"'"];
KBKey *back = [KBKey keyWithIdentifier:@"backspace"
title:@"⌫"
output:@""
type:KBKeyTypeBackspace];
r3 = @[ toggle, comma, dot, q, ex, quote, back ];
} else {
// #+=123
r1 = @[ [KBKey keyWithTitle:@"[" output:@"["], [KBKey keyWithTitle:@"]" output:@"]"], [KBKey keyWithTitle:@"{" output:@"{"],
@@ -116,16 +141,40 @@
[KBKey keyWithTitle:@"~" output:@"~"], [KBKey keyWithTitle:@"<" output:@"<"], [KBKey keyWithTitle:@">" output:@">"],
[KBKey keyWithTitle:@"$" output:@"$"], [KBKey keyWithTitle:@"€" output:@"€"], [KBKey keyWithTitle:@"£" output:@"£"],
[KBKey keyWithTitle:@"•" output:@"•"] ];
r3 = @[ [KBKey keyWithTitle:@"123" type:KBKeyTypeSymbolsToggle],
[KBKey keyWithTitle:@"," output:@","], [KBKey keyWithTitle:@"." output:@"."], [KBKey keyWithTitle:@"?" output:@"?"],
[KBKey keyWithTitle:@"!" output:@"!"], [KBKey keyWithTitle:@"'" output:@"'"],
[KBKey keyWithTitle:@"⌫" type:KBKeyTypeBackspace] ];
KBKey *toggle = [KBKey keyWithIdentifier:@"symbols_toggle_123"
title:@"123"
output:@""
type:KBKeyTypeSymbolsToggle];
KBKey *comma = [KBKey keyWithTitle:@"," output:@","];
KBKey *dot = [KBKey keyWithTitle:@"." output:@"."];
KBKey *q = [KBKey keyWithTitle:@"?" output:@"?"];
KBKey *ex = [KBKey keyWithTitle:@"!" output:@"!"];
KBKey *quote = [KBKey keyWithTitle:@"'" output:@"'"];
KBKey *back = [KBKey keyWithIdentifier:@"backspace"
title:@"⌫"
output:@""
type:KBKeyTypeBackspace];
r3 = @[ toggle, comma, dot, q, ex, quote, back ];
}
NSArray *r4 = @[ [KBKey keyWithTitle:@"abc" type:KBKeyTypeModeChange],
[KBKey keyWithTitle:@"AI" type:KBKeyTypeCustom],
[KBKey keyWithTitle:@"space" type:KBKeyTypeSpace],
[KBKey keyWithTitle:KBLocalized(@"Send") type:KBKeyTypeReturn] ];
KBKey *modeABC = [KBKey keyWithIdentifier:@"mode_abc"
title:@"abc"
output:@""
type:KBKeyTypeModeChange];
KBKey *customAI = [KBKey keyWithIdentifier:@"ai"
title:@"AI"
output:@""
type:KBKeyTypeCustom];
KBKey *space = [KBKey keyWithIdentifier:@"space"
title:@"space"
output:@" "
type:KBKeyTypeSpace];
KBKey *ret = [KBKey keyWithIdentifier:@"return"
title:KBLocalized(@"Send")
output:@"\n"
type:KBKeyTypeReturn];
NSArray *r4 = @[ modeABC, customAI, space, ret ];
return @[r1, r2, r3, r4];
}
@@ -139,27 +188,67 @@
// Shift
for (NSString *s in r1) {
NSString *shown = self.shiftOn ? s : s.lowercaseString;
[row1 addObject:[KBKey keyWithTitle:shown output:shown]];
NSString *identifier = [NSString stringWithFormat:@"letter_%@", s.lowercaseString];
KBKey *k = [KBKey keyWithIdentifier:identifier
title:shown
output:shown
type:KBKeyTypeCharacter];
k.caseVariant = self.shiftOn ? KBKeyCaseVariantUpper : KBKeyCaseVariantLower;
[row1 addObject:k];
}
NSMutableArray *row2 = [NSMutableArray arrayWithCapacity:r2.count];
for (NSString *s in r2) {
NSString *shown = self.shiftOn ? s : s.lowercaseString;
[row2 addObject:[KBKey keyWithTitle:shown output:shown]];
NSString *identifier = [NSString stringWithFormat:@"letter_%@", s.lowercaseString];
KBKey *k = [KBKey keyWithIdentifier:identifier
title:shown
output:shown
type:KBKeyTypeCharacter];
k.caseVariant = self.shiftOn ? KBKeyCaseVariantUpper : KBKeyCaseVariantLower;
[row2 addObject:k];
}
NSMutableArray *row3 = [NSMutableArray array];
[row3 addObject:[KBKey keyWithTitle:@"⇧" type:KBKeyTypeShift]];
KBKey *shift = [KBKey keyWithIdentifier:@"shift"
title:@"⇧"
output:@""
type:KBKeyTypeShift];
[row3 addObject:shift];
for (NSString *s in r3chars) {
NSString *shown = self.shiftOn ? s : s.lowercaseString;
[row3 addObject:[KBKey keyWithTitle:shown output:shown]];
NSString *identifier = [NSString stringWithFormat:@"letter_%@", s.lowercaseString];
KBKey *k = [KBKey keyWithIdentifier:identifier
title:shown
output:shown
type:KBKeyTypeCharacter];
k.caseVariant = self.shiftOn ? KBKeyCaseVariantUpper : KBKeyCaseVariantLower;
[row3 addObject:k];
}
[row3 addObject:[KBKey keyWithTitle:@"⌫" type:KBKeyTypeBackspace]];
KBKey *backspace = [KBKey keyWithIdentifier:@"backspace"
title:@"⌫"
output:@""
type:KBKeyTypeBackspace];
[row3 addObject:backspace];
NSArray *row4 = @[ [KBKey keyWithTitle:@"123" type:KBKeyTypeModeChange],
[KBKey keyWithTitle:@"AI" type:KBKeyTypeCustom],
[KBKey keyWithTitle:@"space" type:KBKeyTypeSpace],
[KBKey keyWithTitle:KBLocalized(@"Send") type:KBKeyTypeReturn] ];
KBKey *mode123 = [KBKey keyWithIdentifier:@"mode_123"
title:@"123"
output:@""
type:KBKeyTypeModeChange];
KBKey *customAI = [KBKey keyWithIdentifier:@"ai"
title:@"AI"
output:@""
type:KBKeyTypeCustom];
KBKey *space = [KBKey keyWithIdentifier:@"space"
title:@"space"
output:@" "
type:KBKeyTypeSpace];
KBKey *ret = [KBKey keyWithIdentifier:@"return"
title:KBLocalized(@"Send")
output:@"\n"
type:KBKeyTypeReturn];
NSArray *row4 = @[ mode123, customAI, space, ret ];
return @[row1.copy, row2.copy, row3.copy, row4];
}