mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-12-27 08:45:22 -05:00
added files via upload
This commit is contained in:
17
Tweaks/FLEX/Core/Views/Cells/FLEXCodeFontCell.h
Normal file
17
Tweaks/FLEX/Core/Views/Cells/FLEXCodeFontCell.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// FLEXCodeFontCell.h
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner on 12/27/19.
|
||||
// Copyright © 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXMultilineTableViewCell.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FLEXCodeFontCell : FLEXMultilineDetailTableViewCell
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
34
Tweaks/FLEX/Core/Views/Cells/FLEXCodeFontCell.m
Normal file
34
Tweaks/FLEX/Core/Views/Cells/FLEXCodeFontCell.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// FLEXCodeFontCell.m
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner on 12/27/19.
|
||||
// Copyright © 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXCodeFontCell.h"
|
||||
#import "UIFont+FLEX.h"
|
||||
|
||||
@implementation FLEXCodeFontCell
|
||||
|
||||
- (void)postInit {
|
||||
[super postInit];
|
||||
|
||||
self.titleLabel.font = UIFont.flex_codeFont;
|
||||
self.subtitleLabel.font = UIFont.flex_codeFont;
|
||||
|
||||
self.titleLabel.adjustsFontSizeToFitWidth = YES;
|
||||
self.titleLabel.minimumScaleFactor = 0.9;
|
||||
self.subtitleLabel.adjustsFontSizeToFitWidth = YES;
|
||||
self.subtitleLabel.minimumScaleFactor = 0.75;
|
||||
|
||||
// Disable mutli-line pre iOS 11
|
||||
if (@available(iOS 11, *)) {
|
||||
self.subtitleLabel.numberOfLines = 5;
|
||||
} else {
|
||||
self.titleLabel.numberOfLines = 1;
|
||||
self.subtitleLabel.numberOfLines = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
13
Tweaks/FLEX/Core/Views/Cells/FLEXKeyValueTableViewCell.h
Normal file
13
Tweaks/FLEX/Core/Views/Cells/FLEXKeyValueTableViewCell.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// FLEXKeyValueTableViewCell.h
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner Bennett on 1/23/20.
|
||||
// Copyright © 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXTableViewCell.h"
|
||||
|
||||
@interface FLEXKeyValueTableViewCell : FLEXTableViewCell
|
||||
|
||||
@end
|
||||
17
Tweaks/FLEX/Core/Views/Cells/FLEXKeyValueTableViewCell.m
Normal file
17
Tweaks/FLEX/Core/Views/Cells/FLEXKeyValueTableViewCell.m
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// FLEXKeyValueTableViewCell.m
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner Bennett on 1/23/20.
|
||||
// Copyright © 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXKeyValueTableViewCell.h"
|
||||
|
||||
@implementation FLEXKeyValueTableViewCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
return [super initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseIdentifier];
|
||||
}
|
||||
|
||||
@end
|
||||
24
Tweaks/FLEX/Core/Views/Cells/FLEXMultilineTableViewCell.h
Normal file
24
Tweaks/FLEX/Core/Views/Cells/FLEXMultilineTableViewCell.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// FLEXMultilineTableViewCell.h
|
||||
// FLEX
|
||||
//
|
||||
// Created by Ryan Olson on 2/13/15.
|
||||
// Copyright (c) 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXTableViewCell.h"
|
||||
|
||||
/// A cell with both labels set to be multi-line capable.
|
||||
@interface FLEXMultilineTableViewCell : FLEXTableViewCell
|
||||
|
||||
+ (CGFloat)preferredHeightWithAttributedText:(NSAttributedString *)attributedText
|
||||
maxWidth:(CGFloat)contentViewWidth
|
||||
style:(UITableViewStyle)style
|
||||
showsAccessory:(BOOL)showsAccessory;
|
||||
|
||||
@end
|
||||
|
||||
/// A \c FLEXMultilineTableViewCell initialized with \c UITableViewCellStyleSubtitle
|
||||
@interface FLEXMultilineDetailTableViewCell : FLEXMultilineTableViewCell
|
||||
|
||||
@end
|
||||
67
Tweaks/FLEX/Core/Views/Cells/FLEXMultilineTableViewCell.m
Normal file
67
Tweaks/FLEX/Core/Views/Cells/FLEXMultilineTableViewCell.m
Normal file
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// FLEXMultilineTableViewCell.m
|
||||
// FLEX
|
||||
//
|
||||
// Created by Ryan Olson on 2/13/15.
|
||||
// Copyright (c) 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXMultilineTableViewCell.h"
|
||||
#import "UIView+FLEX_Layout.h"
|
||||
#import "FLEXUtility.h"
|
||||
|
||||
@interface FLEXMultilineTableViewCell ()
|
||||
@property (nonatomic, readonly) UILabel *_titleLabel;
|
||||
@property (nonatomic, readonly) UILabel *_subtitleLabel;
|
||||
@property (nonatomic) BOOL constraintsUpdated;
|
||||
@end
|
||||
|
||||
@implementation FLEXMultilineTableViewCell
|
||||
|
||||
- (void)postInit {
|
||||
[super postInit];
|
||||
|
||||
self.titleLabel.numberOfLines = 0;
|
||||
self.subtitleLabel.numberOfLines = 0;
|
||||
}
|
||||
|
||||
+ (UIEdgeInsets)labelInsets {
|
||||
return UIEdgeInsetsMake(10.0, 16.0, 10.0, 8.0);
|
||||
}
|
||||
|
||||
+ (CGFloat)preferredHeightWithAttributedText:(NSAttributedString *)attributedText
|
||||
maxWidth:(CGFloat)contentViewWidth
|
||||
style:(UITableViewStyle)style
|
||||
showsAccessory:(BOOL)showsAccessory {
|
||||
CGFloat labelWidth = contentViewWidth;
|
||||
|
||||
// Content view inset due to accessory view observed on iOS 8.1 iPhone 6.
|
||||
if (showsAccessory) {
|
||||
labelWidth -= 34.0;
|
||||
}
|
||||
|
||||
UIEdgeInsets labelInsets = [self labelInsets];
|
||||
labelWidth -= (labelInsets.left + labelInsets.right);
|
||||
|
||||
CGSize constrainSize = CGSizeMake(labelWidth, CGFLOAT_MAX);
|
||||
CGRect boundingBox = [attributedText
|
||||
boundingRectWithSize:constrainSize
|
||||
options:NSStringDrawingUsesLineFragmentOrigin
|
||||
context:nil
|
||||
];
|
||||
CGFloat preferredLabelHeight = FLEXFloor(boundingBox.size.height);
|
||||
CGFloat preferredCellHeight = preferredLabelHeight + labelInsets.top + labelInsets.bottom + 1.0;
|
||||
|
||||
return preferredCellHeight;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation FLEXMultilineDetailTableViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
return [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
|
||||
}
|
||||
|
||||
@end
|
||||
14
Tweaks/FLEX/Core/Views/Cells/FLEXSubtitleTableViewCell.h
Normal file
14
Tweaks/FLEX/Core/Views/Cells/FLEXSubtitleTableViewCell.h
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// FLEXSubtitleTableViewCell.h
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner on 4/17/19.
|
||||
// Copyright © 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXTableViewCell.h"
|
||||
|
||||
/// A cell initialized with \c UITableViewCellStyleSubtitle
|
||||
@interface FLEXSubtitleTableViewCell : FLEXTableViewCell
|
||||
|
||||
@end
|
||||
17
Tweaks/FLEX/Core/Views/Cells/FLEXSubtitleTableViewCell.m
Normal file
17
Tweaks/FLEX/Core/Views/Cells/FLEXSubtitleTableViewCell.m
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// FLEXSubtitleTableViewCell.m
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner on 4/17/19.
|
||||
// Copyright © 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXSubtitleTableViewCell.h"
|
||||
|
||||
@implementation FLEXSubtitleTableViewCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
return [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
|
||||
}
|
||||
|
||||
@end
|
||||
23
Tweaks/FLEX/Core/Views/Cells/FLEXTableViewCell.h
Normal file
23
Tweaks/FLEX/Core/Views/Cells/FLEXTableViewCell.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// FLEXTableViewCell.h
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner on 4/17/19.
|
||||
// Copyright © 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface FLEXTableViewCell : UITableViewCell
|
||||
|
||||
/// Use this instead of .textLabel
|
||||
@property (nonatomic, readonly) UILabel *titleLabel;
|
||||
/// Use this instead of .detailTextLabel
|
||||
@property (nonatomic, readonly) UILabel *subtitleLabel;
|
||||
|
||||
/// Subclasses can override this instead of initializers to
|
||||
/// perform additional initialization without lots of boilerplate.
|
||||
/// Remember to call super!
|
||||
- (void)postInit;
|
||||
|
||||
@end
|
||||
57
Tweaks/FLEX/Core/Views/Cells/FLEXTableViewCell.m
Normal file
57
Tweaks/FLEX/Core/Views/Cells/FLEXTableViewCell.m
Normal file
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// FLEXTableViewCell.m
|
||||
// FLEX
|
||||
//
|
||||
// Created by Tanner on 4/17/19.
|
||||
// Copyright © 2020 FLEX Team. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FLEXTableViewCell.h"
|
||||
#import "FLEXUtility.h"
|
||||
#import "FLEXColor.h"
|
||||
#import "FLEXTableView.h"
|
||||
|
||||
@interface UITableView (Internal)
|
||||
// Exists at least since iOS 5
|
||||
- (BOOL)_canPerformAction:(SEL)action forCell:(UITableViewCell *)cell sender:(id)sender;
|
||||
- (void)_performAction:(SEL)action forCell:(UITableViewCell *)cell sender:(id)sender;
|
||||
@end
|
||||
|
||||
@interface UITableViewCell (Internal)
|
||||
// Exists at least since iOS 5
|
||||
@property (nonatomic, readonly) FLEXTableView *_tableView;
|
||||
@end
|
||||
|
||||
@implementation FLEXTableViewCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
[self postInit];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)postInit {
|
||||
UIFont *cellFont = UIFont.flex_defaultTableCellFont;
|
||||
self.titleLabel.font = cellFont;
|
||||
self.subtitleLabel.font = cellFont;
|
||||
self.subtitleLabel.textColor = FLEXColor.deemphasizedTextColor;
|
||||
|
||||
self.titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
|
||||
self.subtitleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
|
||||
|
||||
self.titleLabel.numberOfLines = 1;
|
||||
self.subtitleLabel.numberOfLines = 1;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
return self.textLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)subtitleLabel {
|
||||
return self.detailTextLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user