From d7d2d1548fd457f0936343f3a48e66de95ce4c9a Mon Sep 17 00:00:00 2001 From: Hugin Date: Wed, 1 May 2019 15:36:27 +0800 Subject: [PATCH] =?UTF-8?q?CPU=20FPS=20Memory=20NetFlow=204=E4=B8=AA?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=8E=A7=E4=BB=B6=E6=A8=AA=E5=B1=8F=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommonUI/Oscillogram/DoraemonOscillogramView.m | 12 ++++++------ .../Oscillogram/DoraemonOscillogramViewController.m | 9 ++++++--- .../CommonUI/Oscillogram/DoraemonOscillogramWindow.m | 7 ++++++- .../Function/DoraemonCPUOscillogramViewController.m | 8 ++++---- .../Function/DoraemonFPSOscillogramViewController.m | 9 +++++---- .../DoraemonMemoryOscillogramViewController.m | 8 ++++---- .../View/DoraemonNetFlowOscillogramViewController.m | 8 ++++---- 7 files changed, 35 insertions(+), 26 deletions(-) diff --git a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramView.m b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramView.m index 0cbbf28a..6367c5ee 100644 --- a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramView.m +++ b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramView.m @@ -37,7 +37,7 @@ - (instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { - _kStartX = kDoraemonSizeFrom750(52); + _kStartX = kDoraemonSizeFrom750_Landscape(52); self.backgroundColor = [UIColor clearColor]; self.showsVerticalScrollIndicator = NO; @@ -50,18 +50,18 @@ _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; @@ -71,7 +71,7 @@ _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]; } @@ -170,7 +170,7 @@ 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]; } diff --git a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramViewController.m index b84eb4d9..c2ec2cfa 100644 --- a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramViewController.m @@ -13,7 +13,10 @@ @end @implementation DoraemonOscillogramViewController - - - +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + dispatch_async(dispatch_get_main_queue(), ^{ + self.view.window.frame = CGRectMake(0, 0, size.height, size.width); + }); +} @end diff --git a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramWindow.m b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramWindow.m index 9d873c87..73c986e5 100644 --- a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramWindow.m +++ b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramWindow.m @@ -30,6 +30,7 @@ if (self) { self.windowLevel = UIWindowLevelStatusBar + 1.f; self.backgroundColor = [UIColor doraemon_colorWithHex:0x000000 andAlpha:0.33]; + self.layer.masksToBounds = YES; [self addRootVc]; } @@ -54,7 +55,11 @@ - (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]; } diff --git a/iOS/DoraemonKit/Src/Core/Plugin/CPU/Function/DoraemonCPUOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/Plugin/CPU/Function/DoraemonCPUOscillogramViewController.m index 9e6703bb..b7c1dcc1 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/CPU/Function/DoraemonCPUOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/CPU/Function/DoraemonCPUOscillogramViewController.m @@ -32,19 +32,19 @@ 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"]; diff --git a/iOS/DoraemonKit/Src/Core/Plugin/FPS/Function/DoraemonFPSOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/Plugin/FPS/Function/DoraemonFPSOscillogramViewController.m index 07ad8fed..f36f652f 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/FPS/Function/DoraemonFPSOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/FPS/Function/DoraemonFPSOscillogramViewController.m @@ -32,19 +32,20 @@ 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"]; diff --git a/iOS/DoraemonKit/Src/Core/Plugin/Memory/Function/DoraemonMemoryOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/Plugin/Memory/Function/DoraemonMemoryOscillogramViewController.m index 531a0f3a..d9843fcd 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/Memory/Function/DoraemonMemoryOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/Memory/Function/DoraemonMemoryOscillogramViewController.m @@ -32,19 +32,19 @@ 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]]]; diff --git a/iOS/DoraemonKit/Src/Core/Plugin/NetFlow/Function/View/DoraemonNetFlowOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/Plugin/NetFlow/Function/View/DoraemonNetFlowOscillogramViewController.m index 7360b2ac..04f14db7 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/NetFlow/Function/View/DoraemonNetFlowOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/NetFlow/Function/View/DoraemonNetFlowOscillogramViewController.m @@ -31,19 +31,19 @@ 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 highestNetFlow]]]; -- GitLab