AI键移除 放在顶部KBToolBar

This commit is contained in:
2025-12-19 20:08:13 +08:00
parent 7587fe6714
commit 70520fb7d9
5 changed files with 19 additions and 23 deletions

View File

@@ -265,7 +265,7 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
case KBKeyTypeGlobe: case KBKeyTypeGlobe:
[self advanceToNextInputMode]; break; [self advanceToNextInputMode]; break;
case KBKeyTypeCustom: case KBKeyTypeCustom:
// AI //
[self showFunctionPanel:YES]; [self showFunctionPanel:YES];
break; break;
case KBKeyTypeModeChange: case KBKeyTypeModeChange:
@@ -276,11 +276,15 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
} }
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didTapToolActionAtIndex:(NSInteger)index { - (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didTapToolActionAtIndex:(NSInteger)index {
if (index != 0) { if (index == 0) {
[self showFunctionPanel:NO]; [self showSubscriptionPanel];
return; return;
} }
[self showSubscriptionPanel]; if (index == 1) {
[self showFunctionPanel:YES];
return;
}
[self showFunctionPanel:NO];
} }
- (void)keyBoardMainViewDidTapSettings:(KBKeyBoardMainView *)keyBoardMainView { - (void)keyBoardMainViewDidTapSettings:(KBKeyBoardMainView *)keyBoardMainView {

View File

@@ -16,7 +16,7 @@ typedef NS_ENUM(NSInteger, KBKeyType) {
KBKeyTypeSpace, // 空格 KBKeyTypeSpace, // 空格
KBKeyTypeReturn, // 回车/发送 KBKeyTypeReturn, // 回车/发送
KBKeyTypeGlobe, // 系统地球键 KBKeyTypeGlobe, // 系统地球键
KBKeyTypeCustom, // 自定义功能占位 AI KBKeyTypeCustom, // 自定义功能占位(如 AI/Emoji
KBKeyTypeSymbolsToggle // 数字面板内的“#+=/123”切换 KBKeyTypeSymbolsToggle // 数字面板内的“#+=/123”切换
}; };

View File

@@ -277,10 +277,6 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
title:@"123" title:@"123"
output:@"" output:@""
type:KBKeyTypeModeChange]; type:KBKeyTypeModeChange];
KBKey *customAI = [KBKey keyWithIdentifier:@"ai"
title:@"AI"
output:@""
type:KBKeyTypeCustom];
KBKey *emoji = [KBKey keyWithIdentifier:KBKeyIdentifierEmojiPanel KBKey *emoji = [KBKey keyWithIdentifier:KBKeyIdentifierEmojiPanel
title:@"😊" title:@"😊"
output:@"" output:@""
@@ -293,7 +289,7 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
title:KBLocalized(@"Send") title:KBLocalized(@"Send")
output:@"\n" output:@"\n"
type:KBKeyTypeReturn]; type:KBKeyTypeReturn];
return @[ mode123, customAI, emoji, space, ret ]; return @[ mode123, emoji, space, ret ];
} }
// //
@@ -302,10 +298,6 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
title:@"abc" title:@"abc"
output:@"" output:@""
type:KBKeyTypeModeChange]; type:KBKeyTypeModeChange];
KBKey *customAI = [KBKey keyWithIdentifier:@"ai"
title:@"AI"
output:@""
type:KBKeyTypeCustom];
KBKey *emoji = [KBKey keyWithIdentifier:KBKeyIdentifierEmojiPanel KBKey *emoji = [KBKey keyWithIdentifier:KBKeyIdentifierEmojiPanel
title:@"😊" title:@"😊"
output:@"" output:@""
@@ -318,7 +310,7 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
title:KBLocalized(@"Send") title:KBLocalized(@"Send")
output:@"\n" output:@"\n"
type:KBKeyTypeReturn]; type:KBKeyTypeReturn];
return @[ modeABC, customAI, emoji, space, ret ]; return @[ modeABC, emoji, space, ret ];
} }
#pragma mark - Row Building #pragma mark - Row Building
@@ -332,7 +324,7 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier { edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
// 4 使 // 4 使
// 123/ABCAISend Space // 123/ABCEmojiSend Space
BOOL isBottomControlRow = [self kb_isBottomControlRowWithKeys:keys]; BOOL isBottomControlRow = [self kb_isBottomControlRowWithKeys:keys];
CGFloat spacing = 0; // CGFloat spacing = 0; //
@@ -419,7 +411,7 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
}]; }];
} }
// 123/ABCAISend // 123/ABCEmojiSend
// Space // Space
if (isBottomControlRow) { if (isBottomControlRow) {
[self kb_applyBottomControlRowWidthInRow:row]; [self kb_applyBottomControlRowWidthInRow:row];
@@ -448,7 +440,7 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
} }
} }
if (firstChar) { if (firstChar) {
// 123/ABC/AI/#+= // 123/ABC/#+=
// 1:1 123/ABC // 1:1 123/ABC
if (!hasCharacterInRow && if (!hasCharacterInRow &&
(firstChar.key.type == KBKeyTypeModeChange || (firstChar.key.type == KBKeyTypeModeChange ||
@@ -540,7 +532,7 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
} }
// //
// - 123/ABCAI = * multiplier // - 123/ABCEmoji = * multiplier
// - Send = 2 // - Send = 2
// - Space // - Space
- (void)kb_applyBottomControlRowWidthInRow:(UIView *)row { - (void)kb_applyBottomControlRowWidthInRow:(UIView *)row {

View File

@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol KBToolBarDelegate <NSObject> @protocol KBToolBarDelegate <NSObject>
@optional @optional
/// 左侧 4 个功能按钮点击index: 0~3 /// 左侧功能按钮点击index 从 0 开始
- (void)toolBar:(KBToolBar *)toolBar didTapActionAtIndex:(NSInteger)index; - (void)toolBar:(KBToolBar *)toolBar didTapActionAtIndex:(NSInteger)index;
/// 右侧设置按钮点击 /// 右侧设置按钮点击
- (void)toolBarDidTapSettings:(KBToolBar *)toolBar; - (void)toolBarDidTapSettings:(KBToolBar *)toolBar;
@@ -21,12 +21,12 @@ NS_ASSUME_NONNULL_BEGIN
- (void)toolBarDidTapUndo:(KBToolBar *)toolBar; - (void)toolBarDidTapUndo:(KBToolBar *)toolBar;
@end @end
/// 顶部工具栏:左侧 4 个按钮,右侧 1 个设置按钮 /// 顶部工具栏:左侧按钮数量可变,右侧为设置/撤销等功能区
@interface KBToolBar : UIView @interface KBToolBar : UIView
@property (nonatomic, weak, nullable) id<KBToolBarDelegate> delegate; @property (nonatomic, weak, nullable) id<KBToolBarDelegate> delegate;
/// 左侧 4 个按钮的标题。默认值:@[@"Item1", @"Item2", @"Item3", @"Item4"]。 /// 左侧按钮的标题(数量由数组决定)。默认值:@[@"Recharge Now", @"AI"]。
@property (nonatomic, copy) NSArray<NSString *> *leftButtonTitles; @property (nonatomic, copy) NSArray<NSString *> *leftButtonTitles;
/// 暴露按钮以便外部定制(只读;首次访问时懒加载创建) /// 暴露按钮以便外部定制(只读;首次访问时懒加载创建)

View File

@@ -24,7 +24,7 @@
- (instancetype)initWithFrame:(CGRect)frame{ - (instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor clearColor]; self.backgroundColor = [UIColor clearColor];
_leftButtonTitles = @[KBLocalized(@"Recharge Now")]; // _leftButtonTitles = @[KBLocalized(@"Recharge Now"), @"AI"]; //
[self setupUI]; [self setupUI];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(kb_undoStateChanged) selector:@selector(kb_undoStateChanged)