添加键盘功能viewUI改动

This commit is contained in:
2025-11-26 21:16:56 +08:00
parent 80e4db86e4
commit 2435d760e8
17 changed files with 229 additions and 167 deletions

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "kb_del_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "kb_del_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "kb_zt_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "kb_zt_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -246,6 +246,21 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
[self showFunctionPanel:NO]; [self showFunctionPanel:NO];
} }
} }
- (void)functionView:(KBFunctionView *_Nullable)functionView didRightTapToolActionAtIndex:(NSInteger)index{
NSString *schemeStr = [NSString stringWithFormat:@"%@://recharge?src=keyboard", KB_APP_SCHEME];
NSURL *scheme = [NSURL URLWithString:schemeStr];
//
// if (!ul && !scheme) { return; }
//
// UIApplication App
BOOL ok = [KBHostAppLauncher openHostAppURL:scheme fromResponder:self.view];
if (!ok) {
//
// XXX App /
[KBHUD showInfo:@"请回到桌面手动打开App进行充值"];
}
}
#pragma mark - lazy #pragma mark - lazy
- (KBKeyBoardMainView *)keyBoardMainView{ - (KBKeyBoardMainView *)keyBoardMainView{

View File

@@ -6,6 +6,7 @@
#import "KBFunctionTagCell.h" #import "KBFunctionTagCell.h"
static NSString * const kKBFunctionTagCellId2 = @"KBFunctionTagCellId2"; static NSString * const kKBFunctionTagCellId2 = @"KBFunctionTagCellId2";
static CGFloat const kKBItemSpace = 4;
@interface KBFunctionTagListView () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout> @interface KBFunctionTagListView () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@property (nonatomic, strong) UICollectionView *collectionViewInternal; @property (nonatomic, strong) UICollectionView *collectionViewInternal;
@@ -54,13 +55,13 @@ static NSString * const kKBFunctionTagCellId2 = @"KBFunctionTagCellId2";
} }
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGFloat totalW = collectionView.bounds.size.width; CGFloat space = 10.0; NSInteger columns = 3; CGFloat totalW = collectionView.bounds.size.width; CGFloat space = kKBItemSpace; NSInteger columns = 3;
CGFloat width = floor((totalW - space * (columns - 1)) / columns); CGFloat width = floor((totalW - space * (columns - 1)) / columns);
return CGSizeMake(width, 48); return CGSizeMake(width, 41);
} }
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { return 10.0; } - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { return kKBItemSpace; }
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return 12.0; } - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return kKBItemSpace; }
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
if ([self.delegate respondsToSelector:@selector(tagListView:didSelectIndex:title:)]) { if ([self.delegate respondsToSelector:@selector(tagListView:didSelectIndex:title:)]) {

View File

@@ -9,7 +9,9 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 功能区顶部的Bar左侧4个按钮右侧3个按钮 /// 功能区顶部的 Bar
/// 左侧App 图标按钮(点击可回到主 App 或打开更多功能)
/// 右侧:升级 VIP 按钮
@class KBFunctionBarView; @class KBFunctionBarView;
@protocol KBFunctionBarViewDelegate <NSObject> @protocol KBFunctionBarViewDelegate <NSObject>
@@ -24,15 +26,15 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak, nullable) id<KBFunctionBarViewDelegate> delegate; @property (nonatomic, weak, nullable) id<KBFunctionBarViewDelegate> delegate;
/// 左侧4个按钮(懒加载创建,等宽水平排布 /// 左侧按钮(当前只有一个App 图标
@property (nonatomic, strong, readonly) NSArray<UIButton *> *leftButtons; @property (nonatomic, strong, readonly) NSArray<UIButton *> *leftButtons;
/// 右侧3个按钮(懒加载创建,等宽水平排布,靠右 /// 右侧按钮(当前只有一个:升级 VIP
@property (nonatomic, strong, readonly) NSArray<UIButton *> *rightButtons; @property (nonatomic, strong, readonly) NSArray<UIButton *> *rightButtons;
/// 配置按钮标题(可选) /// 预留的标题配置(目前按钮主要以图片为主,可选)
@property (nonatomic, copy) NSArray<NSString *> *leftTitles; // 默认 @[@"帮回", @"会说", @"话术", @"更多"] @property (nonatomic, copy) NSArray<NSString *> *leftTitles;
@property (nonatomic, copy) NSArray<NSString *> *rightTitles; // 默认 @[@"❤", @"收藏", @"宫格"] @property (nonatomic, copy) NSArray<NSString *> *rightTitles;
@end @end

View File

@@ -22,8 +22,9 @@
- (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];
_leftTitles = @[@"ABC"]; //
_rightTitles = @[@"Upgrade VIP"]; _leftTitles = @[];
_rightTitles = @[];
[self buildUI]; [self buildUI];
} }
return self; return self;
@@ -38,91 +39,60 @@
#pragma mark - UI #pragma mark - UI
- (void)buildUI { - (void)buildUI {
// 便 // +
[self addSubview:self.leftContainer];
[self addSubview:self.globeButtonInternal]; [self addSubview:self.globeButtonInternal];
[self addSubview:self.leftContainer];
[self addSubview:self.rightContainer]; [self addSubview:self.rightContainer];
// VIP 使 upgrad_vip_icon 115x35
[self.rightContainer mas_makeConstraints:^(MASConstraintMaker *make) { [self.rightContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.mas_right).offset(-12); make.right.equalTo(self.mas_right).offset(-6);
make.centerY.equalTo(self.mas_centerY); make.centerY.equalTo(self.mas_centerY);
make.height.mas_equalTo(36); make.width.mas_equalTo(115);
make.height.mas_equalTo(35);
}]; }];
// UIButton *vipButton = [UIButton buttonWithType:UIButtonTypeCustom];
vipButton.tag = 200; // index = 0
UIImage *vipImage = [UIImage imageNamed:@"upgrad_vip_icon"];
[vipButton setImage:vipImage forState:UIControlStateNormal];
vipButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
vipButton.adjustsImageWhenHighlighted = YES;
[vipButton addTarget:self action:@selector(onRightTap:) forControlEvents:UIControlEventTouchUpInside];
[self.rightContainer addSubview:vipButton];
[vipButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.rightContainer);
}];
self.rightButtonsInternal = @[vipButton];
// kb_refreshGlobeVisibility
[self.globeButtonInternal mas_makeConstraints:^(MASConstraintMaker *make) { [self.globeButtonInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).offset(12); make.left.equalTo(self.mas_left).offset(12);
make.centerY.equalTo(self.mas_centerY); make.centerY.equalTo(self.mas_centerY);
make.width.height.mas_equalTo(32); make.width.height.mas_equalTo(32);
}]; }];
// App 使 App_icon 34x34 36x36
[self.leftContainer mas_makeConstraints:^(MASConstraintMaker *make) { [self.leftContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.globeButtonInternal.mas_right).offset(8);
make.right.equalTo(self.rightContainer.mas_left).offset(-12);
make.centerY.equalTo(self.mas_centerY); make.centerY.equalTo(self.mas_centerY);
make.width.mas_equalTo(36);
make.height.mas_equalTo(36); make.height.mas_equalTo(36);
make.left.equalTo(self.mas_left).offset(12); // kb_refreshGlobeVisibility
}]; }];
// 4 UIButton *appButton = [UIButton buttonWithType:UIButtonTypeCustom];
NSMutableArray<UIButton *> *leftBtns = [NSMutableArray arrayWithCapacity:4]; appButton.tag = 100; // index = 0
UIView *prev = nil; UIImage *appImage = [UIImage imageNamed:@"App_icon"];
for (NSInteger i = 0; i < self.leftTitles.count; i++) { [appButton setImage:appImage forState:UIControlStateNormal];
UIButton *btn = [self buildButtonWithTitle:(i < self.leftTitles.count ? self.leftTitles[i] : [NSString stringWithFormat:@"L%ld", (long)i])]; appButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
btn.tag = 100 + i; appButton.adjustsImageWhenHighlighted = YES;
[btn addTarget:self action:@selector(onLeftTap:) forControlEvents:UIControlEventTouchUpInside]; [appButton addTarget:self action:@selector(onLeftTap:) forControlEvents:UIControlEventTouchUpInside];
[self.leftContainer addSubview:btn]; [self.leftContainer addSubview:appButton];
[btn mas_makeConstraints:^(MASConstraintMaker *make) { [appButton mas_makeConstraints:^(MASConstraintMaker *make) {
if (prev) { make.center.equalTo(self.leftContainer);
make.left.equalTo(prev.mas_right).offset(8); make.width.height.mas_equalTo(34); //
make.width.equalTo(prev);
} else {
make.left.equalTo(self.leftContainer.mas_left);
}
make.top.bottom.equalTo(self.leftContainer);
}];
prev = btn;
[leftBtns addObject:btn];
}
[prev mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.leftContainer.mas_right);
}]; }];
self.leftButtonsInternal = leftBtns.copy; self.leftButtonsInternal = @[appButton];
// N
NSMutableArray<UIButton *> *rightBtns = [NSMutableArray arrayWithCapacity:3];
for (NSInteger i = 0; i < self.rightTitles.count; i++) {
UIButton *btn = [self buildButtonWithTitle:(i < self.rightTitles.count ? self.rightTitles[i] : [NSString stringWithFormat:@"R%ld", (long)i])];
btn.tag = 200 + i;
[self.rightContainer addSubview:btn];
[btn addTarget:self action:@selector(onRightTap:) forControlEvents:UIControlEventTouchUpInside];
[rightBtns addObject:btn];
}
// 1/2/3...
UIView *prevRight = nil; //
for (NSInteger i = rightBtns.count - 1; i >= 0; i--) {
UIButton *btn = rightBtns[i];
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
if (!prevRight) {
//
make.right.equalTo(self.rightContainer.mas_right);
} else {
//
make.right.equalTo(prevRight.mas_left).offset(-8);
make.width.equalTo(prevRight);
}
make.top.bottom.equalTo(self.rightContainer);
}];
prevRight = btn;
}
//
if (prevRight) {
[prevRight mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.greaterThanOrEqualTo(self.rightContainer.mas_left);
}];
}
self.rightButtonsInternal = rightBtns.copy;
// //
[self kb_refreshGlobeVisibility]; [self kb_refreshGlobeVisibility];
@@ -144,17 +114,6 @@
} }
} }
- (UIButton *)buildButtonWithTitle:(NSString *)title {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
btn.layer.cornerRadius = 18;
btn.layer.masksToBounds = YES;
btn.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
btn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
[btn setTitle:title forState:UIControlStateNormal];
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
return btn;
}
#pragma mark - Lazy #pragma mark - Lazy
- (UIView *)leftContainer { - (UIView *)leftContainer {
@@ -201,8 +160,8 @@
} else { } else {
make.left.equalTo(self.mas_left).offset(12); make.left.equalTo(self.mas_left).offset(12);
} }
make.right.equalTo(self.rightContainer.mas_left).offset(-12);
make.centerY.equalTo(self.mas_centerY); make.centerY.equalTo(self.mas_centerY);
make.width.mas_equalTo(36);
make.height.mas_equalTo(36); make.height.mas_equalTo(36);
}]; }];

View File

@@ -7,10 +7,13 @@
#import "KBFunctionPasteView.h" #import "KBFunctionPasteView.h"
#import "Masonry.h" #import "Masonry.h"
#import "KBFont.h"
@interface KBFunctionPasteView () @interface KBFunctionPasteView ()
@property (nonatomic, strong) UIImageView *iconViewInternal; @property (nonatomic, strong) UIImageView *iconViewInternal;
@property (nonatomic, strong) UILabel *placeholderLabelInternal; @property (nonatomic, strong) UILabel *placeholderLabelInternal;
@property (nonatomic, strong) UIButton *pasBtn;
@end @end
@implementation KBFunctionPasteView @implementation KBFunctionPasteView
@@ -22,19 +25,24 @@
self.layer.cornerRadius = 12.0; self.layer.cornerRadius = 12.0;
self.layer.masksToBounds = YES; self.layer.masksToBounds = YES;
[self addSubview:self.iconViewInternal]; // [self addSubview:self.iconViewInternal];
[self addSubview:self.placeholderLabelInternal]; // [self addSubview:self.placeholderLabelInternal];
[self addSubview:self.pasBtn];
[self.pasBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
// [self.iconViewInternal mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.mas_left).offset(12);
// make.centerY.equalTo(self.mas_centerY);
// make.width.height.mas_equalTo(20);
// }];
// [self.placeholderLabelInternal mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.iconViewInternal.mas_right).offset(8);
// make.right.equalTo(self.mas_right).offset(-12);
// make.centerY.equalTo(self.mas_centerY);
// }];
[self.iconViewInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).offset(12);
make.centerY.equalTo(self.mas_centerY);
make.width.height.mas_equalTo(20);
}];
[self.placeholderLabelInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconViewInternal.mas_right).offset(8);
make.right.equalTo(self.mas_right).offset(-12);
make.centerY.equalTo(self.mas_centerY);
}];
} }
return self; return self;
} }
@@ -44,15 +52,7 @@
- (UIImageView *)iconViewInternal { - (UIImageView *)iconViewInternal {
if (!_iconViewInternal) { if (!_iconViewInternal) {
_iconViewInternal = [[UIImageView alloc] init]; _iconViewInternal = [[UIImageView alloc] init];
// _iconViewInternal.image = [UIImage imageNamed:@"kb_zt_icon"];
UILabel *emoji = [[UILabel alloc] init];
emoji.text = @"📋"; // /
emoji.font = [UIFont systemFontOfSize:18];
emoji.textAlignment = NSTextAlignmentCenter;
[_iconViewInternal addSubview:emoji];
[emoji mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(_iconViewInternal);
}];
} }
return _iconViewInternal; return _iconViewInternal;
} }
@@ -60,13 +60,26 @@
- (UILabel *)placeholderLabelInternal { - (UILabel *)placeholderLabelInternal {
if (!_placeholderLabelInternal) { if (!_placeholderLabelInternal) {
_placeholderLabelInternal = [[UILabel alloc] init]; _placeholderLabelInternal = [[UILabel alloc] init];
_placeholderLabelInternal.text = KBLocalized(@"Tap to paste their message"); // 稿
_placeholderLabelInternal.text = KBLocalized(@"Paste Ta's Words");
_placeholderLabelInternal.textColor = [UIColor colorWithRed:0.20 green:0.64 blue:0.54 alpha:1.0]; _placeholderLabelInternal.textColor = [UIColor colorWithRed:0.20 green:0.64 blue:0.54 alpha:1.0];
_placeholderLabelInternal.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; _placeholderLabelInternal.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
} }
return _placeholderLabelInternal; return _placeholderLabelInternal;
} }
- (UIButton *)pasBtn{
if (!_pasBtn) {
_pasBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_pasBtn setImage:[UIImage imageNamed:@"kb_zt_icon"] forState:UIControlStateNormal];
[_pasBtn setTitle:KBLocalized(@" Paste Ta's Words") forState:UIControlStateNormal];
[_pasBtn setTitleColor:[UIColor colorWithHex:0x02BEAC] forState:UIControlStateNormal];
_pasBtn.titleLabel.font = [KBFont medium:13];
_pasBtn.backgroundColor = [UIColor whiteColor];
}
return _pasBtn;
}
#pragma mark - Expose #pragma mark - Expose
- (UIImageView *)iconView { return self.iconViewInternal; } - (UIImageView *)iconView { return self.iconViewInternal; }

View File

@@ -22,26 +22,38 @@
self.contentView.layer.cornerRadius = 12; self.contentView.layer.cornerRadius = 12;
self.contentView.layer.masksToBounds = YES; self.contentView.layer.masksToBounds = YES;
[self.contentView addSubview:self.iconViewInternal]; //
[self.contentView addSubview:self.titleLabelInternal]; [self.contentView addSubview:self.loadingView];
[self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self.contentView);
make.width.height.mas_equalTo(16);
}];
// icon + title
UIView *centerContainer = [[UIView alloc] init];
centerContainer.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:centerContainer];
[centerContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView.mas_centerX);
make.centerY.equalTo(self.contentView.mas_centerY);
make.left.greaterThanOrEqualTo(self.contentView.mas_left).offset(6);
make.right.lessThanOrEqualTo(self.contentView).offset(-6);
}];
[centerContainer addSubview:self.iconViewInternal];
[centerContainer addSubview:self.titleLabelInternal];
[self.iconViewInternal mas_makeConstraints:^(MASConstraintMaker *make) { [self.iconViewInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10); make.left.equalTo(centerContainer.mas_left);
make.centerY.equalTo(self.contentView.mas_centerY); make.centerY.equalTo(centerContainer.mas_centerY);
// emoji
make.width.height.mas_equalTo(24); make.width.height.mas_equalTo(24);
}]; }];
[self.titleLabelInternal mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLabelInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconViewInternal.mas_right).offset(6); make.left.equalTo(self.iconViewInternal.mas_right).offset(3);
make.right.equalTo(self.contentView.mas_right).offset(-10); make.top.equalTo(centerContainer.mas_top);
make.centerY.equalTo(self.contentView.mas_centerY); make.bottom.equalTo(centerContainer.mas_bottom);
}]; make.right.equalTo(centerContainer.mas_right);
//
[self.contentView addSubview:self.loadingView];
[self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.contentView.mas_right).offset(-10);
make.width.height.mas_equalTo(16);
}]; }];
} }
return self; return self;
@@ -56,6 +68,8 @@
emoji.text = @"🙂"; // emoji.text = @"🙂"; //
emoji.textAlignment = NSTextAlignmentCenter; emoji.textAlignment = NSTextAlignmentCenter;
emoji.font = [UIFont systemFontOfSize:20]; emoji.font = [UIFont systemFontOfSize:20];
emoji.adjustsFontSizeToFitWidth = YES;
emoji.minimumScaleFactor = 0.8;
[_iconViewInternal addSubview:emoji]; [_iconViewInternal addSubview:emoji];
[emoji mas_makeConstraints:^(MASConstraintMaker *make) { [emoji mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(_iconViewInternal); make.edges.equalTo(_iconViewInternal);
@@ -67,8 +81,11 @@
- (UILabel *)titleLabelInternal { - (UILabel *)titleLabelInternal {
if (!_titleLabelInternal) { if (!_titleLabelInternal) {
_titleLabelInternal = [[UILabel alloc] init]; _titleLabelInternal = [[UILabel alloc] init];
_titleLabelInternal.font = [UIFont systemFontOfSize:15 weight:UIFontWeightSemibold]; _titleLabelInternal.font = [KBFont medium:10];
_titleLabelInternal.textColor = [UIColor blackColor]; _titleLabelInternal.textColor = [UIColor colorWithHex:0x1B1F1A];
//
_titleLabelInternal.numberOfLines = 2;
_titleLabelInternal.lineBreakMode = NSLineBreakByTruncatingTail;
} }
return _titleLabelInternal; return _titleLabelInternal;
} }

View File

@@ -11,6 +11,8 @@
@protocol KBFunctionViewDelegate <NSObject> @protocol KBFunctionViewDelegate <NSObject>
@optional @optional
- (void)functionView:(KBFunctionView *_Nullable)functionView didTapToolActionAtIndex:(NSInteger)index; - (void)functionView:(KBFunctionView *_Nullable)functionView didTapToolActionAtIndex:(NSInteger)index;
- (void)functionView:(KBFunctionView *_Nullable)functionView didRightTapToolActionAtIndex:(NSInteger)index;
@end @end
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN

View File

@@ -106,16 +106,16 @@
[self.barViewInternal mas_makeConstraints:^(MASConstraintMaker *make) { [self.barViewInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self); make.left.right.equalTo(self);
make.top.equalTo(self.mas_top).offset(6); make.top.equalTo(self.mas_top).offset(6);
make.height.mas_equalTo(48); make.height.mas_equalTo(52);
}]; }];
// //
[self addSubview:self.rightButtonContainer]; [self addSubview:self.rightButtonContainer];
[self.rightButtonContainer mas_makeConstraints:^(MASConstraintMaker *make) { [self.rightButtonContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.mas_right).offset(-6); make.right.equalTo(self.mas_right).offset(-4);
make.top.equalTo(self.barViewInternal.mas_bottom).offset(8); make.top.equalTo(self.barViewInternal.mas_bottom).offset(0);
make.bottom.equalTo(self.mas_bottom).offset(-10); make.bottom.equalTo(self.mas_bottom).offset(-10);
make.width.mas_equalTo(72); make.width.mas_equalTo(60);
}]; }];
// //
@@ -125,10 +125,10 @@
[self.rightButtonContainer addSubview:self.sendButtonInternal]; [self.rightButtonContainer addSubview:self.sendButtonInternal];
// //
CGFloat smallH = 44; CGFloat smallH = 41;
CGFloat bigH = 56; CGFloat bigH = 56;
// 10 276 8 AutoLayout // 10 276 8 AutoLayout
CGFloat vSpace = 8; CGFloat vSpace = 4;
[self.pasteButtonInternal mas_makeConstraints:^(MASConstraintMaker *make) { [self.pasteButtonInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.rightButtonContainer.mas_top); make.top.equalTo(self.rightButtonContainer.mas_top);
make.left.right.equalTo(self.rightButtonContainer); make.left.right.equalTo(self.rightButtonContainer);
@@ -156,18 +156,18 @@
// 2. // 2.
[self addSubview:self.pasteViewInternal]; [self addSubview:self.pasteViewInternal];
[self.pasteViewInternal mas_makeConstraints:^(MASConstraintMaker *make) { [self.pasteViewInternal mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).offset(12); make.left.equalTo(self.mas_left).offset(vSpace);
make.right.equalTo(self.rightButtonContainer.mas_left).offset(-12); make.right.equalTo(self.rightButtonContainer.mas_left).offset(-vSpace);
make.top.equalTo(self.barViewInternal.mas_bottom).offset(8); make.top.equalTo(self.barViewInternal.mas_bottom).offset(0);
make.height.mas_equalTo(48); make.height.mas_equalTo(smallH);
}]; }];
// 3. Tag List View // 3. Tag List View
[self addSubview:self.tagListView]; [self addSubview:self.tagListView];
[self.tagListView mas_makeConstraints:^(MASConstraintMaker *make) { [self.tagListView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).offset(12); make.left.equalTo(self.pasteViewInternal);
make.right.equalTo(self.rightButtonContainer.mas_left).offset(-12); make.right.equalTo(self.rightButtonContainer.mas_left).offset(-vSpace);
make.top.equalTo(self.pasteViewInternal.mas_bottom).offset(10); make.top.equalTo(self.pasteViewInternal.mas_bottom).offset(vSpace);
make.bottom.equalTo(self.mas_bottom).offset(-10); make.bottom.equalTo(self.mas_bottom).offset(-10);
}]; }];
} }
@@ -176,13 +176,13 @@
- (void)reloadDemoData { - (void)reloadDemoData {
// //
self.itemsInternal = @[KBLocalized(@"高情商"), self.itemsInternal = @[KBLocalized(@"Warm hearted man"),
KBLocalized(@"暖味拉扯"), KBLocalized(@"Warm2 hearted man"),
KBLocalized(@"风趣幽默"), KBLocalized(@"Warm3 hearted man"),
KBLocalized(@"撩女生"), KBLocalized(@"撩女生啊u发顺丰大师傅"),
KBLocalized(@"社交惬匿"), KBLocalized(@"Warm = man"),
KBLocalized(@"情场高手"), KBLocalized(@"Warm hearted man"),
KBLocalized(@"一枚暖男"), KBLocalized(@"一枚暖男发放"),
KBLocalized(@"聊天搭子"), KBLocalized(@"聊天搭子"),
KBLocalized(@"表达爱意"), KBLocalized(@"表达爱意"),
KBLocalized(@"更多话术")]; KBLocalized(@"更多话术")];
@@ -537,6 +537,9 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
- (void)functionBarView:(KBFunctionBarView *)bar didTapRightAtIndex:(NSInteger)index { - (void)functionBarView:(KBFunctionBarView *)bar didTapRightAtIndex:(NSInteger)index {
// / // /
if ([self.delegate respondsToSelector:@selector(functionView:didRightTapToolActionAtIndex:)]) {
[self.delegate functionView:self didRightTapToolActionAtIndex:index];
}
} }
- (KBFunctionPasteView *)pasteViewInternal { - (KBFunctionPasteView *)pasteViewInternal {
@@ -563,11 +566,11 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
} }
- (UIButton *)buildRightButtonWithTitle:(NSString *)title color:(UIColor *)color { - (UIButton *)buildRightButtonWithTitle:(NSString *)title color:(UIColor *)color {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.backgroundColor = color; btn.backgroundColor = color;
btn.layer.cornerRadius = 12.0; btn.layer.cornerRadius = 8.0;
btn.layer.masksToBounds = YES; btn.layer.masksToBounds = YES;
btn.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; btn.titleLabel.font = [KBFont medium:13];
[btn setTitle:title forState:UIControlStateNormal]; [btn setTitle:title forState:UIControlStateNormal];
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
return btn; return btn;
@@ -583,14 +586,12 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
- (UIButton *)deleteButtonInternal { - (UIButton *)deleteButtonInternal {
if (!_deleteButtonInternal) { if (!_deleteButtonInternal) {
// _deleteButtonInternal = [UIButton buttonWithType:UIButtonTypeCustom];
_deleteButtonInternal = [UIButton buttonWithType:UIButtonTypeSystem]; _deleteButtonInternal.backgroundColor = [UIColor colorWithHex:0xB9BDC8];
_deleteButtonInternal.backgroundColor = [UIColor colorWithWhite:0.92 alpha:1.0]; _deleteButtonInternal.layer.cornerRadius = 8.0;
_deleteButtonInternal.layer.cornerRadius = 12.0;
_deleteButtonInternal.layer.masksToBounds = YES; _deleteButtonInternal.layer.masksToBounds = YES;
_deleteButtonInternal.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; [_deleteButtonInternal setImage:[UIImage imageNamed:@"kb_del_icon"] forState:UIControlStateNormal];
[_deleteButtonInternal setTitle:KBLocalized(@"Delete") forState:UIControlStateNormal];
[_deleteButtonInternal setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[_deleteButtonInternal addTarget:self action:@selector(onTapDelete) forControlEvents:UIControlEventTouchUpInside]; [_deleteButtonInternal addTarget:self action:@selector(onTapDelete) forControlEvents:UIControlEventTouchUpInside];
} }
return _deleteButtonInternal; return _deleteButtonInternal;
@@ -598,11 +599,11 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
- (UIButton *)clearButtonInternal { - (UIButton *)clearButtonInternal {
if (!_clearButtonInternal) { if (!_clearButtonInternal) {
_clearButtonInternal = [UIButton buttonWithType:UIButtonTypeSystem]; _clearButtonInternal = [UIButton buttonWithType:UIButtonTypeCustom];
_clearButtonInternal.backgroundColor = [UIColor colorWithWhite:0.92 alpha:1.0]; _clearButtonInternal.backgroundColor = [UIColor colorWithHex:0xB9BDC8];
_clearButtonInternal.layer.cornerRadius = 12.0; _clearButtonInternal.layer.cornerRadius = 8.0;
_clearButtonInternal.layer.masksToBounds = YES; _clearButtonInternal.layer.masksToBounds = YES;
_clearButtonInternal.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; _clearButtonInternal.titleLabel.font = [KBFont medium:13];
[_clearButtonInternal setTitle:KBLocalized(@"Clear") forState:UIControlStateNormal]; [_clearButtonInternal setTitle:KBLocalized(@"Clear") forState:UIControlStateNormal];
[_clearButtonInternal setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [_clearButtonInternal setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[_clearButtonInternal addTarget:self action:@selector(onTapClear) forControlEvents:UIControlEventTouchUpInside]; [_clearButtonInternal addTarget:self action:@selector(onTapClear) forControlEvents:UIControlEventTouchUpInside];
@@ -610,9 +611,9 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
return _clearButtonInternal; return _clearButtonInternal;
} }
- (UIButton *)sendButtonInternal { - (UIButton *)sendButtonInternal {
if (!_sendButtonInternal) { if (!_sendButtonInternal) {
_sendButtonInternal = [self buildRightButtonWithTitle:KBLocalized(@"Send") color:[UIColor colorWithRed:0.13 green:0.73 blue:0.60 alpha:1.0]]; _sendButtonInternal = [self buildRightButtonWithTitle:KBLocalized(@"Send") color:[UIColor colorWithHex:0x02BEAC]];
[_sendButtonInternal addTarget:self action:@selector(onTapSend) forControlEvents:UIControlEventTouchUpInside]; [_sendButtonInternal addTarget:self action:@selector(onTapSend) forControlEvents:UIControlEventTouchUpInside];
} }
return _sendButtonInternal; return _sendButtonInternal;

View File

@@ -110,6 +110,8 @@
"Gender" = "Gender"; "Gender" = "Gender";
"User ID" = "User ID"; "User ID" = "User ID";
" Paste Ta's Words" = " Paste Ta's Words";
// Search & history // Search & history
"Clear history" = "Clear history"; "Clear history" = "Clear history";

View File

@@ -111,6 +111,8 @@
"Gender" = "性别"; "Gender" = "性别";
"User ID" = "用户ID"; "User ID" = "用户ID";
" Paste Ta's Words" = " 粘贴TA的话";
// 搜索与历史(英文 key // 搜索与历史(英文 key
"Clear history" = "清空历史"; "Clear history" = "清空历史";
"Delete all history?" = "是否删除所有历史记录?"; "Delete all history?" = "是否删除所有历史记录?";

View File

@@ -23,6 +23,7 @@
#import "FGIAPManager.h" #import "FGIAPManager.h"
#import "KBSexSelVC.h" #import "KBSexSelVC.h"
#import "KBKeyboardPermissionManager.h" #import "KBKeyboardPermissionManager.h"
#import "KBVipPay.h"
// bundle id target // bundle id target
// PRODUCT_BUNDLE_IDENTIFIER // PRODUCT_BUNDLE_IDENTIFIER
@@ -140,7 +141,8 @@
NULL, NULL, true); NULL, NULL, true);
if ([entry isEqualToString:@"recharge"]) { if ([entry isEqualToString:@"recharge"]) {
// App // App
[KBHUD showInfo:@"去充值"]; // [KBHUD showInfo:@"去充值"];
} else { } else {
// //
[self kb_presentLoginSheetIfNeeded]; [self kb_presentLoginSheetIfNeeded];
@@ -171,7 +173,9 @@
return YES; return YES;
}else if ([host isEqualToString:@"recharge"]) { // kbkeyboard://settings }else if ([host isEqualToString:@"recharge"]) { // kbkeyboard://settings
// [self kb_openAppSettings]; // [self kb_openAppSettings];
[KBHUD showInfo:@"去充值"]; // [KBHUD showInfo:@"去充值"];
KBVipPay *vc = [[KBVipPay alloc] init];
[KB_CURRENT_NAV pushViewController:vc animated:true];
return YES; return YES;
} }
return NO; return NO;