mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various fixes
This commit is contained in:
@@ -59,7 +59,7 @@ NSString *const TGMediaAssetsGifCellKind = @"TGMediaAssetsGifCellKind";
|
||||
_typeLabel.textColor = [UIColor whiteColor];
|
||||
_typeLabel.backgroundColor = [UIColor clearColor];
|
||||
_typeLabel.textAlignment = NSTextAlignmentLeft;
|
||||
_typeLabel.font = TGSystemFontOfSize(12.0f);
|
||||
_typeLabel.font = TGBoldSystemFontOfSize(13);
|
||||
_typeLabel.text = @"GIF";
|
||||
[_typeLabel sizeToFit];
|
||||
[self addSubview:_typeLabel];
|
||||
@@ -78,7 +78,9 @@ NSString *const TGMediaAssetsGifCellKind = @"TGMediaAssetsGifCellKind";
|
||||
[super layoutSubviews];
|
||||
|
||||
_shadowView.frame = (CGRect){ { 0, self.frame.size.height - _shadowView.frame.size.height }, {self.frame.size.width, _shadowView.frame.size.height } };
|
||||
_typeLabel.frame = (CGRect){ { 5, _shadowView.frame.origin.y }, {self.frame.size.width - 5 - 4, _shadowView.frame.size.height } };
|
||||
|
||||
CGSize typeSize = _typeLabel.frame.size;
|
||||
_typeLabel.frame = CGRectMake(self.frame.size.width - floor(typeSize.width) - 5.0, self.frame.size.height - floor(typeSize.height) - 4.0, typeSize.width, typeSize.height);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -67,13 +67,12 @@ NSString *const TGMediaAssetsVideoCellKind = @"TGMediaAssetsVideoCellKind";
|
||||
|
||||
_iconView = [[UIImageView alloc] init];
|
||||
_iconView.contentMode = UIViewContentModeCenter;
|
||||
[self addSubview:_iconView];
|
||||
|
||||
_durationLabel = [[UILabel alloc] init];
|
||||
_durationLabel.textColor = [UIColor whiteColor];
|
||||
_durationLabel.backgroundColor = [UIColor clearColor];
|
||||
_durationLabel.textAlignment = NSTextAlignmentRight;
|
||||
_durationLabel.font = TGSystemFontOfSize(12.0f);
|
||||
_durationLabel.font = TGBoldSystemFontOfSize(13);
|
||||
[_durationLabel sizeToFit];
|
||||
[self addSubview:_durationLabel];
|
||||
|
||||
@@ -113,6 +112,7 @@ NSString *const TGMediaAssetsVideoCellKind = @"TGMediaAssetsVideoCellKind";
|
||||
durationString = [NSString stringWithFormat:@"%d:%02d", duration / 60, duration % 60];
|
||||
|
||||
_durationLabel.text = durationString;
|
||||
[_durationLabel sizeToFit];
|
||||
|
||||
if (asset.subtypes & TGMediaAssetSubtypeVideoTimelapse)
|
||||
_iconView.image = TGComponentsImageNamed(@"ModernMediaItemTimelapseIcon");
|
||||
@@ -235,7 +235,9 @@ NSString *const TGMediaAssetsVideoCellKind = @"TGMediaAssetsVideoCellKind";
|
||||
self.checkButton.frame = (CGRect){ { self.frame.size.width - self.checkButton.frame.size.width - 2, 2 }, self.checkButton.frame.size };
|
||||
_shadowView.frame = (CGRect){ { 0, self.frame.size.height - _shadowView.frame.size.height }, {self.frame.size.width, _shadowView.frame.size.height } };
|
||||
_iconView.frame = CGRectMake(0, self.frame.size.height - 19, 19, 19);
|
||||
_durationLabel.frame = (CGRect){ { 5, _shadowView.frame.origin.y }, {self.frame.size.width - 5 - 4, _shadowView.frame.size.height } };
|
||||
|
||||
CGSize durationSize = _durationLabel.frame.size;
|
||||
_durationLabel.frame = CGRectMake(self.frame.size.width - floor(durationSize.width) - 5.0, self.frame.size.height - floor(durationSize.height) - 4.0, durationSize.width, durationSize.height);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -51,40 +51,49 @@
|
||||
CGSize itemSize = TGPhotoThumbnailSizeForCurrentScreen();
|
||||
if ([UIScreen mainScreen].scale >= 2.0f - FLT_EPSILON)
|
||||
{
|
||||
if (widescreenWidth >= 736.0f - FLT_EPSILON)
|
||||
if (widescreenWidth >= 844.0f - FLT_EPSILON)
|
||||
{
|
||||
metrics->_normalItemSize = itemSize;
|
||||
metrics->_wideItemSize = itemSize;
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(4.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(4.0f, 2.0f, 1.0f, 2.0f);
|
||||
metrics->_normalLineSpacing = 1.0f;
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(2.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(2.0f, 2.0f, 1.0f, 2.0f);
|
||||
metrics->_normalLineSpacing = 2.0f;
|
||||
metrics->_wideLineSpacing = 2.0f;
|
||||
}
|
||||
else if (widescreenWidth >= 736.0f - FLT_EPSILON)
|
||||
{
|
||||
metrics->_normalItemSize = itemSize;
|
||||
metrics->_wideItemSize = itemSize;
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(2.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(2.0f, 2.0f, 1.0f, 2.0f);
|
||||
metrics->_normalLineSpacing = 2.0f;
|
||||
metrics->_wideLineSpacing = 2.0f;
|
||||
}
|
||||
else if (widescreenWidth >= 667.0f - FLT_EPSILON)
|
||||
{
|
||||
metrics->_normalItemSize = itemSize;
|
||||
metrics->_wideItemSize = CGSizeMake(floor(itemSize.width), floor(itemSize.height));
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(4.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(4.0f, 2.0f, 1.0f, 2.0f);
|
||||
metrics->_normalLineSpacing = 1.0f;
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(2.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(2.0f, 2.0f, 1.0f, 2.0f);
|
||||
metrics->_normalLineSpacing = 2.0f;
|
||||
metrics->_wideLineSpacing = 2.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
metrics->_normalItemSize = itemSize;
|
||||
metrics->_wideItemSize = CGSizeMake(floor(itemSize.width), floor(itemSize.height));
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(4.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(4.0f, 1.0f, 1.0f, 1.0f);
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(2.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(2.0f, 1.0f, 1.0f, 1.0f);
|
||||
metrics->_normalLineSpacing = 2.0f;
|
||||
metrics->_wideLineSpacing = 3.0f;
|
||||
metrics->_wideLineSpacing = 2.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
metrics->_normalItemSize = itemSize;
|
||||
metrics->_wideItemSize = CGSizeMake(floor(itemSize.width), floor(itemSize.height));
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(4.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(4.0f, 1.0f, 1.0f, 1.0f);
|
||||
metrics->_normalEdgeInsets = UIEdgeInsetsMake(2.0f, 0.0f, 2.0f, 0.0f);
|
||||
metrics->_wideEdgeInsets = UIEdgeInsetsMake(2.0f, 1.0f, 1.0f, 1.0f);
|
||||
metrics->_normalLineSpacing = 2.0f;
|
||||
metrics->_wideLineSpacing = 2.0f;
|
||||
}
|
||||
|
||||
@@ -204,9 +204,23 @@ static id<TGNavigationBarMusicPlayerProvider> _musicPlayerProvider;
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[self updateLayout];
|
||||
|
||||
[super layoutSubviews];
|
||||
|
||||
for (UIView *view in self.subviews) {
|
||||
if (iosMajorVersion() >= 11) {
|
||||
view.frame = CGRectOffset(view.frame, 0.0, 6.0);
|
||||
}
|
||||
}
|
||||
|
||||
[self updateLayout];
|
||||
}
|
||||
|
||||
- (CGSize)sizeThatFits:(CGSize)size {
|
||||
if (iosMajorVersion() < 11) {
|
||||
return CGSizeMake(MAX(self.frame.size.width, size.width), 36.0 - 6.0);
|
||||
} else {
|
||||
return [super sizeThatFits:size];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateLayout
|
||||
@@ -217,7 +231,13 @@ static id<TGNavigationBarMusicPlayerProvider> _musicPlayerProvider;
|
||||
if (iosMajorVersion() >= 11 && self.superview.safeAreaInsets.top > FLT_EPSILON)
|
||||
backgroundOverflow = self.superview.safeAreaInsets.top;
|
||||
|
||||
_backgroundContainerView.frame = CGRectMake(0, -backgroundOverflow, self.bounds.size.width, backgroundOverflow + self.bounds.size.height);
|
||||
CGFloat heightAddition = 0.0;
|
||||
if (iosMajorVersion() < 11) {
|
||||
backgroundOverflow = 20.0;
|
||||
heightAddition = 6.0 + TGScreenPixel;
|
||||
}
|
||||
|
||||
_backgroundContainerView.frame = CGRectMake(0, -backgroundOverflow, self.bounds.size.width, backgroundOverflow + self.bounds.size.height + heightAddition);
|
||||
|
||||
if (_barBackgroundView != nil)
|
||||
_barBackgroundView.frame = _backgroundContainerView.bounds;
|
||||
@@ -298,6 +318,10 @@ static id<TGNavigationBarMusicPlayerProvider> _musicPlayerProvider;
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
if (frame.size.height < 56.0) {
|
||||
frame.size.height = 56.0;
|
||||
}
|
||||
|
||||
[super setFrame:frame];
|
||||
|
||||
if (_statusBarBackgroundView != nil && _statusBarBackgroundView.superview != nil)
|
||||
|
||||
@@ -26,27 +26,31 @@ CGSize TGPhotoThumbnailSizeForCurrentScreen()
|
||||
{
|
||||
if (widescreenWidth >= 896.0f - FLT_EPSILON)
|
||||
{
|
||||
return CGSizeMake(103.0f, 103.0f);
|
||||
return CGSizeMake(137.0f - TGScreenPixel, 137.0f - TGScreenPixel);
|
||||
}
|
||||
else if (widescreenWidth >= 844.0f - FLT_EPSILON)
|
||||
{
|
||||
return CGSizeMake(129.0f - TGScreenPixel, 129.0f - TGScreenPixel);
|
||||
}
|
||||
else if (widescreenWidth >= 812.0f - FLT_EPSILON)
|
||||
{
|
||||
return CGSizeMake(93.0f, 93.0f);
|
||||
return CGSizeMake(124.0f - TGScreenPixel, 124.0f - TGScreenPixel);
|
||||
}
|
||||
else if (widescreenWidth >= 736.0f - FLT_EPSILON)
|
||||
{
|
||||
return CGSizeMake(103.0f, 103.0f);
|
||||
return CGSizeMake(137.0f - TGScreenPixel, 137.0f - TGScreenPixel);
|
||||
}
|
||||
else if (widescreenWidth >= 667.0f - FLT_EPSILON)
|
||||
{
|
||||
return CGSizeMake(93.0f, 93.5f);
|
||||
return CGSizeMake(124.0f - TGScreenPixel, 124.0f - TGScreenPixel);
|
||||
}
|
||||
else
|
||||
{
|
||||
return CGSizeMake(78.5f, 78.5f);
|
||||
return CGSizeMake(106.0f - TGScreenPixel, 106.0f - TGScreenPixel);
|
||||
}
|
||||
}
|
||||
|
||||
return CGSizeMake(78.5f, 78.5f);
|
||||
return CGSizeMake(106.0f, 106.0f);
|
||||
}
|
||||
|
||||
CGSize TGScaleToSize(CGSize size, CGSize maxSize)
|
||||
|
||||
@@ -347,7 +347,7 @@ const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f;
|
||||
[_doneButton setTitle:TGLocalized(@"Common.Done") forState:UIControlStateNormal];
|
||||
_doneButton.titleLabel.font = TGSystemFontOfSize(17.0);
|
||||
[_doneButton sizeToFit];
|
||||
[_wrapperView addSubview:_doneButton];
|
||||
// [_wrapperView addSubview:_doneButton];
|
||||
|
||||
void (^settingsPressed)(void) = ^
|
||||
{
|
||||
|
||||
@@ -1026,7 +1026,7 @@ static id<LegacyComponentsContext> _defaultContext = nil;
|
||||
|
||||
- (CGFloat)navigationBarHeightForInterfaceOrientation:(UIInterfaceOrientation)orientation
|
||||
{
|
||||
static CGFloat portraitHeight = 44.0f;
|
||||
static CGFloat portraitHeight = 56.0f;
|
||||
static CGFloat landscapeHeight = 32.0f;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^
|
||||
@@ -1035,13 +1035,13 @@ static id<LegacyComponentsContext> _defaultContext = nil;
|
||||
CGFloat widescreenWidth = MAX(screenSize.width, screenSize.height);
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && ABS(widescreenWidth - 736) > FLT_EPSILON)
|
||||
{
|
||||
portraitHeight = 44.0f;
|
||||
landscapeHeight = 32.0f;
|
||||
portraitHeight = 56.0f;
|
||||
landscapeHeight = 56.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
portraitHeight = 44.0f;
|
||||
landscapeHeight = 44.0f;
|
||||
portraitHeight = 56.0f;
|
||||
landscapeHeight = 56.0f;
|
||||
}
|
||||
});
|
||||
bool large = UIInterfaceOrientationIsPortrait(orientation) || self.alwaysUseTallNavigationBarHeight;
|
||||
|
||||
Reference in New Issue
Block a user