Skip to content

Commit

Permalink
Merge pull request didi#168 from HuginChen/master
Browse files Browse the repository at this point in the history
解决旋转黑边 didi#158
  • Loading branch information
yixiangboy authored May 5, 2019
2 parents a5672f2 + d7d2d15 commit bc3a98a
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ @implementation DoraemonOscillogramView
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
_kStartX = kDoraemonSizeFrom750(52);
_kStartX = kDoraemonSizeFrom750_Landscape(52);

self.backgroundColor = [UIColor clearColor];
self.showsVerticalScrollIndicator = NO;
Expand All @@ -50,18 +50,18 @@ - (instancetype)initWithFrame:(CGRect)frame{
_pointList = [NSMutableArray array];
_pointLayerList = [NSMutableArray array];

_bottomLine = [[UIView alloc] initWithFrame:CGRectMake(_kStartX, self.doraemon_height-kDoraemonSizeFrom750(1), self.doraemon_width, kDoraemonSizeFrom750(1))];
_bottomLine = [[UIView alloc] initWithFrame:CGRectMake(_kStartX, self.doraemon_height-kDoraemonSizeFrom750_Landscape(1), self.doraemon_width, kDoraemonSizeFrom750_Landscape(1))];
_bottomLine.backgroundColor = [UIColor doraemon_colorWithString:@"#999999"];
[self addSubview:_bottomLine];

_lowValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.doraemon_height-kDoraemonSizeFrom750(28)/2, _kStartX, kDoraemonSizeFrom750(28))];
_lowValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.doraemon_height-kDoraemonSizeFrom750_Landscape(28)/2, _kStartX, kDoraemonSizeFrom750_Landscape(28))];
_lowValueLabel.text = @"0";
_lowValueLabel.textColor = [UIColor whiteColor];
_lowValueLabel.textAlignment = NSTextAlignmentCenter;
_lowValueLabel.font = [UIFont systemFontOfSize:10];
[self addSubview:_lowValueLabel];

_highValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, -kDoraemonSizeFrom750(28)/2, _kStartX, kDoraemonSizeFrom750(28))];
_highValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, -kDoraemonSizeFrom750_Landscape(28)/2, _kStartX, kDoraemonSizeFrom750_Landscape(28))];
_highValueLabel.text = @"100";
_highValueLabel.textColor = [UIColor whiteColor];
_highValueLabel.textAlignment = NSTextAlignmentCenter;
Expand All @@ -71,7 +71,7 @@ - (instancetype)initWithFrame:(CGRect)frame{
_tipLabel = [[UILabel alloc] init];
_tipLabel.textColor = [UIColor doraemon_colorWithString:@"#00DFDD"];
_tipLabel.textAlignment = NSTextAlignmentCenter;
_tipLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
_tipLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
_tipLabel.lineBreakMode = NSLineBreakByClipping;
[self addSubview:_tipLabel];
}
Expand Down Expand Up @@ -170,7 +170,7 @@ - (void)addPointLayer:(CGPoint)point{
CALayer *pointLayer = [CALayer layer];
pointLayer.backgroundColor = [UIColor doraemon_colorWithString:@"#00DFDD"].CGColor;
pointLayer.cornerRadius = 2;
pointLayer.frame = CGRectMake(point.x-kDoraemonSizeFrom750(8)/2, point.y-kDoraemonSizeFrom750(8)/2, kDoraemonSizeFrom750(8), kDoraemonSizeFrom750(8));
pointLayer.frame = CGRectMake(point.x-kDoraemonSizeFrom750_Landscape(8)/2, point.y-kDoraemonSizeFrom750_Landscape(8)/2, kDoraemonSizeFrom750_Landscape(8), kDoraemonSizeFrom750_Landscape(8));
[_pointLayerList addObject:pointLayer];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ @interface DoraemonOscillogramViewController ()
@end

@implementation DoraemonOscillogramViewController



- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
dispatch_async(dispatch_get_main_queue(), ^{
self.view.window.frame = CGRectMake(0, 0, size.height, size.width);
});
}
@end
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ - (instancetype)initWithFrame:(CGRect)frame{
if (self) {
self.windowLevel = UIWindowLevelStatusBar + 1.f;
self.backgroundColor = [UIColor doraemon_colorWithHex:0x000000 andAlpha:0.33];
self.layer.masksToBounds = YES;

[self addRootVc];
}
Expand All @@ -54,7 +55,11 @@ - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{

- (void)show{
self.hidden = NO;
self.frame = CGRectMake(0, 0, DoraemonScreenWidth, kDoraemonSizeFrom750(480)+IPHONE_TOPSENSOR_HEIGHT);
if (kInterfaceOrientationPortrait) {
self.frame = CGRectMake(0, 0, DoraemonScreenWidth, kDoraemonSizeFrom750(480)+IPHONE_TOPSENSOR_HEIGHT);
} else {
self.frame = CGRectMake(0, 0, DoraemonScreenHeight, kDoraemonSizeFrom750_Landscape(480)+IPHONE_TOPSENSOR_HEIGHT);
}
[_vc startRecord];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ - (void)commonInit {
self.layer.borderWidth = 1.;
self.layer.borderColor = [UIColor doraemon_colorWithHex:0x999999 andAlpha:0.2].CGColor;
self.windowLevel = UIWindowLevelAlert;
[[DoraemonVisualInfoViewController alloc] init];
self.rootViewController = [[DoraemonVisualInfoViewController alloc] init];

UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
Expand Down
10 changes: 4 additions & 6 deletions iOS/DoraemonKit/Src/Core/Entry/DoraemonEntryView.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ @interface DoraemonEntryView()
@implementation DoraemonEntryView

- (instancetype)init{
_kEntryViewSize = kDoraemonSizeFrom750(116);
_kEntryViewSize = 58;
self = [super initWithFrame:CGRectMake(0, DoraemonScreenHeight/3, _kEntryViewSize, _kEntryViewSize)];
if (self) {


if (self) {
self.backgroundColor = [UIColor clearColor];
self.windowLevel = UIWindowLevelStatusBar + 100.f;
self.layer.masksToBounds = YES;
NSString *version= [UIDevice currentDevice].systemVersion;
if(version.doubleValue >=10.0) {
if (!self.rootViewController) {
Expand All @@ -50,8 +49,7 @@ - (instancetype)init{
entryBtn.layer.cornerRadius = 20.;
[entryBtn addTarget:self action:@selector(entryClick:) forControlEvents:UIControlEventTouchUpInside];
[self.rootViewController.view addSubview:entryBtn];
_entryBtn = entryBtn;

_entryBtn = entryBtn;
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
[self addGestureRecognizer:pan];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ - (void)viewDidLoad {
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = DoraemonLocalizedString(@"CPU检测");
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
titleLabel.textColor = [UIColor whiteColor];
[self.view addSubview:titleLabel];
[titleLabel sizeToFit];
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750_Landscape(10), titleLabel.doraemon_width, titleLabel.doraemon_height);

UIButton *closeBtn = [[UIButton alloc] init];
[closeBtn setImage:[UIImage doraemon_imageNamed:@"doraemon_close_white"] forState:UIControlStateNormal];
closeBtn.frame = CGRectMake(self.view.doraemon_width-kDoraemonSizeFrom750(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750(60), kDoraemonSizeFrom750(60));
closeBtn.frame = CGRectMake((kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight)-kDoraemonSizeFrom750_Landscape(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750_Landscape(60), kDoraemonSizeFrom750_Landscape(60));
[closeBtn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeBtn];

_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750(24), self.view.doraemon_width, kDoraemonSizeFrom750(400))];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750_Landscape(24), (kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight), kDoraemonSizeFrom750_Landscape(400))];
_oscillogramView.backgroundColor = [UIColor clearColor];
[_oscillogramView setLowValue:@"0"];
[_oscillogramView setHightValue:@"100"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@implementation DoraemonColorPickPlugin

- (void)pluginDidLoad{
- (void)pluginDidLoad {
[[DoraemonColorPickWindow shareInstance] show];
[[DoraemonColorPickInfoWindow shareInstance] show];
[[DoraemonHomeWindow shareInstance] hide];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ - (instancetype)initWithFrame:(CGRect)frame {

- (void)commonInit {
self.backgroundColor = [UIColor whiteColor];
self.layer.cornerRadius = kDoraemonSizeFrom750(8);
self.layer.cornerRadius = kDoraemonSizeFrom750_Landscape(8);
self.layer.borderWidth = 1.;
self.layer.borderColor = [UIColor doraemon_colorWithHex:0x999999 andAlpha:0.2].CGColor;

Expand All @@ -44,16 +44,16 @@ - (void)commonInit {
- (void)layoutSubviews {
[super layoutSubviews];

CGFloat colorWidth = kDoraemonSizeFrom750(28);
CGFloat colorHeight = kDoraemonSizeFrom750(28);
self.colorView.frame = CGRectMake(kDoraemonSizeFrom750(32), (self.doraemon_height - colorHeight) / 2.0, colorWidth, colorHeight);
CGFloat colorWidth = kDoraemonSizeFrom750_Landscape(28);
CGFloat colorHeight = kDoraemonSizeFrom750_Landscape(28);
self.colorView.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(32), (self.doraemon_height - colorHeight) / 2.0, colorWidth, colorHeight);

CGFloat colorValueWidth = kDoraemonSizeFrom750(150);
self.colorValueLbl.frame = CGRectMake(self.colorView.doraemon_right + kDoraemonSizeFrom750(20), 0, colorValueWidth, self.doraemon_height);
self.colorValueLbl.frame = CGRectMake(self.colorView.doraemon_right + kDoraemonSizeFrom750_Landscape(20), 0, colorValueWidth, self.doraemon_height);

CGFloat closeWidth = kDoraemonSizeFrom750(44);
CGFloat closeHeight = kDoraemonSizeFrom750(44);
self.closeBtn.frame = CGRectMake(self.doraemon_width - closeWidth - kDoraemonSizeFrom750(32), (self.doraemon_height - closeHeight) / 2.0, closeWidth, closeHeight);
CGFloat closeWidth = kDoraemonSizeFrom750_Landscape(44);
CGFloat closeHeight = kDoraemonSizeFrom750_Landscape(44);
self.closeBtn.frame = CGRectMake(self.doraemon_width - closeWidth - kDoraemonSizeFrom750_Landscape(32), (self.doraemon_height - closeHeight) / 2.0, closeWidth, closeHeight);
}

#pragma mark - Public
Expand All @@ -72,11 +72,6 @@ - (void)closeBtnClicked:(id)sender {
}

#pragma mark - Private

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
// NSLog(@"PickInfoView---触摸开始");
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

UITouch *touch = [touches anyObject];
Expand All @@ -91,9 +86,6 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
self.transform = CGAffineTransformTranslate(self.transform, offsetX, offsetY);
}

- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
// NSLog(@"PickInfoView---触摸结束");
}

#pragma mark - Getter

Expand All @@ -110,7 +102,7 @@ - (UILabel *)colorValueLbl {
if (!_colorValueLbl) {
_colorValueLbl = [[UILabel alloc] init];
_colorValueLbl.textColor = [UIColor doraemon_black_1];
_colorValueLbl.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(28)];
_colorValueLbl.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(28)];
}
return _colorValueLbl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@
#import "DoraemonColorPickInfoView.h"
#import "DoraemonDefine.h"

@interface DoraemonColorPickInfoController: UIViewController

@end

@implementation DoraemonColorPickInfoController
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
dispatch_async(dispatch_get_main_queue(), ^{
self.view.window.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(30), DoraemonScreenHeight - (size.height < size.width ? size.height : size.width) - kDoraemonSizeFrom750_Landscape(30), size.height, size.width);
});
}
@end

@interface DoraemonColorPickInfoWindow () <DoraemonColorPickInfoViewDelegate>

@property (nonatomic, strong) DoraemonColorPickInfoView *pickInfoView;
Expand All @@ -29,12 +42,18 @@ + (DoraemonColorPickInfoWindow *)shareInstance{
}

- (instancetype)init {
self = [super initWithFrame:CGRectMake(kDoraemonSizeFrom750(30), DoraemonScreenHeight - kDoraemonSizeFrom750(100) - kDoraemonSizeFrom750(30) - IPHONE_SAFEBOTTOMAREA_HEIGHT, DoraemonScreenWidth - 2*kDoraemonSizeFrom750(30), kDoraemonSizeFrom750(100))];

if (kInterfaceOrientationPortrait) {
self = [super initWithFrame:CGRectMake(kDoraemonSizeFrom750_Landscape(30), DoraemonScreenHeight - kDoraemonSizeFrom750_Landscape(100) - kDoraemonSizeFrom750_Landscape(30) - IPHONE_SAFEBOTTOMAREA_HEIGHT, DoraemonScreenWidth - 2*kDoraemonSizeFrom750_Landscape(30), kDoraemonSizeFrom750_Landscape(100))];
} else {
self = [super initWithFrame:CGRectMake(kDoraemonSizeFrom750_Landscape(30), DoraemonScreenHeight - kDoraemonSizeFrom750_Landscape(100) - kDoraemonSizeFrom750_Landscape(30) - IPHONE_SAFEBOTTOMAREA_HEIGHT, DoraemonScreenHeight - 2*kDoraemonSizeFrom750_Landscape(30), kDoraemonSizeFrom750_Landscape(100))];
}

if (self) {
self.backgroundColor = [UIColor clearColor];
self.windowLevel = UIWindowLevelAlert;
if (!self.rootViewController) {
self.rootViewController = [[UIViewController alloc] init];
self.rootViewController = [[DoraemonColorPickInfoController alloc] init];
}

DoraemonColorPickInfoView *pickInfoView = [[DoraemonColorPickInfoView alloc] initWithFrame:self.bounds];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,20 @@ - (void)viewDidLoad {
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = DoraemonLocalizedString(@"帧率检测");
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
titleLabel.textColor = [UIColor whiteColor];
[self.view addSubview:titleLabel];
[titleLabel sizeToFit];
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750_Landscape(10), titleLabel.doraemon_width, titleLabel.doraemon_height);

UIButton *closeBtn = [[UIButton alloc] init];
[closeBtn setImage:[UIImage doraemon_imageNamed:@"doraemon_close_white"] forState:UIControlStateNormal];
closeBtn.frame = CGRectMake(self.view.doraemon_width-kDoraemonSizeFrom750(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750(60), kDoraemonSizeFrom750(60));

closeBtn.frame = CGRectMake((kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight)-kDoraemonSizeFrom750_Landscape(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750_Landscape(60), kDoraemonSizeFrom750_Landscape(60));
[closeBtn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeBtn];

_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750(24), self.view.doraemon_width, kDoraemonSizeFrom750(400))];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750_Landscape(24), (kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight), kDoraemonSizeFrom750_Landscape(400))];
_oscillogramView.backgroundColor = [UIColor clearColor];
[_oscillogramView setLowValue:@"0"];
[_oscillogramView setHightValue:@"60"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ - (void)viewDidLoad {
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = DoraemonLocalizedString(@"内存检测");
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
titleLabel.textColor = [UIColor whiteColor];
[self.view addSubview:titleLabel];
[titleLabel sizeToFit];
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750_Landscape(10), titleLabel.doraemon_width, titleLabel.doraemon_height);

UIButton *closeBtn = [[UIButton alloc] init];
[closeBtn setImage:[UIImage doraemon_imageNamed:@"doraemon_close_white"] forState:UIControlStateNormal];
closeBtn.frame = CGRectMake(self.view.doraemon_width-kDoraemonSizeFrom750(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750(60), kDoraemonSizeFrom750(60));
closeBtn.frame = CGRectMake((kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight)-kDoraemonSizeFrom750_Landscape(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750_Landscape(60), kDoraemonSizeFrom750_Landscape(60));
[closeBtn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeBtn];

_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750(24), self.view.doraemon_width, kDoraemonSizeFrom750(400))];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750_Landscape(24), (kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight), kDoraemonSizeFrom750_Landscape(400))];
_oscillogramView.backgroundColor = [UIColor clearColor];
[_oscillogramView setLowValue:@"0"];
[_oscillogramView setHightValue:[NSString stringWithFormat:@"%zi",[self deviceMemory]]];
Expand Down
Loading

0 comments on commit bc3a98a

Please sign in to comment.