小说绘上架版本

This commit is contained in:
xtfei2011
2021-02-07 11:24:08 +08:00
commit ee5c1c8b12
1762 changed files with 115892 additions and 0 deletions
@@ -0,0 +1,21 @@
//
// TFNovelBookMarkViewCell.h
// TFReader
//
// Created by 谢腾飞 on 2020/12/15.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class TFBookMarkModel;
@interface TFNovelBookMarkViewCell : UITableViewCell
@property (nonatomic ,strong) TFBookMarkModel *bookMarkModel;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,83 @@
//
// TFNovelBookMarkViewCell.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/15.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFNovelBookMarkViewCell.h"
#import "NSObject+Observer.h"
#import "TFBookMarkModel.h"
@interface TFNovelBookMarkViewCell ()
@end
@implementation TFNovelBookMarkViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self createSubviews];
}
return self;
}
- (void)createSubviews
{
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.font = kFont14;
titleLabel.textColor = kBlackColor;
[self.contentView addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView).offset(kMargin);
make.left.equalTo(self.contentView).offset(kMoreHalfMargin);
}];
UILabel *timeLabel = [[UILabel alloc] init];
timeLabel.font = kFont11;
timeLabel.textColor = kGrayTextColor;
timeLabel.textAlignment = NSTextAlignmentRight;
[self.contentView addSubview:timeLabel];
[timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(titleLabel);
make.right.equalTo(self.contentView).offset(-kMoreHalfMargin);
}];
[titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(timeLabel.mas_left).offset(-kMargin);
}];
UILabel *descLabel = [[UILabel alloc] init];
descLabel.numberOfLines = 2;
descLabel.font = kFont12;
descLabel.textColor = kGrayTextColor;
[self.contentView addSubview:descLabel];
[descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(titleLabel.mas_bottom).offset(13);
make.left.equalTo(titleLabel);
make.right.equalTo(self.contentView).offset(-25.0);
}];
UIView *splitLine = [[UIView alloc] init];
splitLine.backgroundColor = kGrayLineColor;
[self.contentView addSubview:splitLine];
[splitLine mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(kCellLineHeight);
make.left.right.bottom.equalTo(self.contentView);
make.top.equalTo(descLabel.mas_bottom).offset(kMoreHalfMargin).priorityLow();
}];
[self addObserver:KEY_PATH(self, bookMarkModel) complete:^(TFNovelBookMarkViewCell * _Nonnull obj, TFBookMarkModel * _Nullable oldVal, TFBookMarkModel * _Nullable newVal) {
titleLabel.text = newVal.chapterTitle ?: @"";
timeLabel.text = [TFUtilsHelper dateStringWithTimestamp:newVal.timestamp] ?: @"";
if ([[newVal.pageContent stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] isEqualToString:@"\U0000fffc"]) {
descLabel.text = TFLocalizedString(@"广告页");
} else {
descLabel.text = newVal.pageContent ?: @"";
}
}];
}
@end
@@ -0,0 +1,19 @@
//
// TFNovelCatalogueViewCell.h
// TFReader
//
// Created by 谢腾飞 on 2020/12/15.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class TFCatalogListModel;
@interface TFNovelCatalogueViewCell : TFBasicTableViewCell
@property (nonatomic ,strong) TFCatalogListModel *chapterModel;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,95 @@
//
// TFNovelCatalogueViewCell.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/15.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFNovelCatalogueViewCell.h"
#import "TFCatalogModel.h"
#import "TFReadRecordManager.h"
@interface TFNovelCatalogueViewCell ()
{
UILabel *chapterNameLabel;
#if TF_Super_Member_Mode && TF_Recharge_Mode
UIImageView *lockIcon;
#endif
}
@end
@implementation TFNovelCatalogueViewCell
- (void)createSubviews
{
[super createSubviews];
self.selectionStyle = UITableViewCellSelectionStyleNone;
#if TF_Super_Member_Mode && TF_Recharge_Mode
lockIcon = [[UIImageView alloc] init];
lockIcon.image = [[UIImage imageNamed:@"book_directory_lock"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
lockIcon.tintColor = kColorRGB(139, 140, 146);
lockIcon.hidden = YES;
[self.contentView addSubview:lockIcon];
[lockIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kMargin);
make.centerY.mas_equalTo(self.contentView.mas_centerY);
make.height.width.mas_equalTo(15);
}];
#endif
// 章节名称
chapterNameLabel = [[UILabel alloc] init];
chapterNameLabel.textColor = kBlackColor;
chapterNameLabel.font = kMainFont;
chapterNameLabel.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:chapterNameLabel];
[chapterNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kMargin);
make.top.mas_equalTo(self.contentView.mas_top);
#if TF_Super_Member_Mode && TF_Recharge_Mode
make.right.mas_equalTo(lockIcon.mas_left).with.offset(- 5);
#else
make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kMargin);
#endif
make.height.mas_equalTo(self.contentView.mas_height);
}];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeLock:) name:Notification_ChangeLock object:nil];
}
- (void)changeLock:(NSNotification *)noti
{
if ([noti.object isEqualToString:self.chapterModel.chapter_id]) {
self.chapterModel.preview = NO;
#if TF_Super_Member_Mode && TF_Recharge_Mode
lockIcon.hidden = YES;
#endif
}
}
- (void)setChapterModel:(TFCatalogListModel *)chapterModel
{
_chapterModel = chapterModel;
chapterNameLabel.text = chapterModel.title?:@"";
#if TF_Super_Member_Mode && TF_Recharge_Mode
if (chapterModel.isPreview == 1) {
lockIcon.hidden = NO;
} else {
lockIcon.hidden = YES;
}
#endif
if ([[TFReadRecordManager shareManagerWithProductionType:TFProductionTypeNovel] getReadingRecordChapter_idWithProduction_id:[chapterModel.book_id integerValue]] == [chapterModel.chapter_id integerValue]) {
chapterNameLabel.textColor = kMainColor;
} else if ([[TFReadRecordManager shareManagerWithProductionType:TFProductionTypeNovel] chapterHasReadedWithProduction_id:[chapterModel.book_id integerValue] chapter_id:[chapterModel.chapter_id integerValue]]) {
chapterNameLabel.textColor = kGrayTextColor;
} else {
chapterNameLabel.textColor = kBlackColor;
}
}
@end