Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-02-17 20:02:46 +04:00
parent dcf0ccf6eb
commit 5096e5c84d
3 changed files with 16 additions and 7 deletions

View File

@ -1283,16 +1283,23 @@ private final class TimePickerNode: ASDisplayNode {
private func handleTextInput(_ input: String) {
self.typing = true
let maxHoursValue: Int
switch self.dateTimeFormat.timeFormat {
case .military:
maxHoursValue = 23
case .regular:
maxHoursValue = 12
}
var text = input
var typingHours: Int?
var typingMinutes: Int?
if self.selection == .all {
text = String(text.suffix(4))
if text.count < 2 {
typingHours = nil
} else {
if var value = Int(String(text.prefix(2))) {
if value > 24 {
if value > maxHoursValue {
value = value % 10
}
typingHours = value
@ -1307,7 +1314,7 @@ private final class TimePickerNode: ASDisplayNode {
} else if self.selection == .hours {
text = String(text.suffix(2))
if var value = Int(text) {
if value > 24 {
if value > maxHoursValue {
value = value % 10
}
typingHours = value

View File

@ -519,6 +519,7 @@ public class ItemListSingleLineInputItemNode: ListViewItemNode, UITextFieldDeleg
if cleanString != filteredString {
cleanString = filteredString
self.textNode.layer.addShakeAnimation()
let hapticFeedback = HapticFeedback()
hapticFeedback.error()
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1.0, execute: {

View File

@ -61,7 +61,7 @@ const CGFloat TGPhotoPaintSettingsPadPickerWidth = 360.0f;
_eyedropperButton.exclusiveTouch = true;
[_eyedropperButton setImage:TGTintedImage([UIImage imageNamed:@"Editor/Eyedropper"], [UIColor whiteColor]) forState:UIControlStateNormal];
[_eyedropperButton addTarget:self action:@selector(eyedropperButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_eyedropperButton];
// [self addSubview:_eyedropperButton];
_settingsButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 44.0f, 44.0f)];
_settingsButton.exclusiveTouch = true;
@ -211,7 +211,8 @@ const CGFloat TGPhotoPaintSettingsPadPickerWidth = 360.0f;
- (void)layoutSubviews
{
CGFloat inset = 66.0f;
CGFloat leftInset = 23.0f;
CGFloat rightInset = 66.0f;
CGFloat colorPickerHeight = 10.0f;
if (self.frame.size.width > self.frame.size.height)
{
@ -222,14 +223,14 @@ const CGFloat TGPhotoPaintSettingsPadPickerWidth = 360.0f;
}
else
{
_colorPicker.frame = CGRectMake(inset, ceil((self.frame.size.height - colorPickerHeight) / 2.0f), self.frame.size.width - inset - inset, colorPickerHeight);
_colorPicker.frame = CGRectMake(leftInset, ceil((self.frame.size.height - colorPickerHeight) / 2.0f), self.frame.size.width - leftInset - rightInset, colorPickerHeight);
_eyedropperButton.frame = CGRectMake(10.0f, floor((self.frame.size.height - _eyedropperButton.frame.size.height) / 2.0f) + 1.0f, _eyedropperButton.frame.size.width, _eyedropperButton.frame.size.height);
_settingsButton.frame = CGRectMake(self.frame.size.width - _settingsButton.frame.size.width - 10.0f, floor((self.frame.size.height - _settingsButton.frame.size.height) / 2.0f) + 1.0f, _settingsButton.frame.size.width, _settingsButton.frame.size.height);
}
}
else
{
_colorPicker.frame = CGRectMake(ceil((self.frame.size.width - colorPickerHeight) / 2.0f), inset, colorPickerHeight, self.frame.size.height - inset - inset);
_colorPicker.frame = CGRectMake(ceil((self.frame.size.width - colorPickerHeight) / 2.0f), rightInset, colorPickerHeight, self.frame.size.height - leftInset - rightInset);
_eyedropperButton.frame = CGRectMake(floor((self.frame.size.width - _eyedropperButton.frame.size.width) / 2.0f), self.frame.size.height - _eyedropperButton.frame.size.height - 10.0, _eyedropperButton.frame.size.width, _eyedropperButton.frame.size.height);
_settingsButton.frame = CGRectMake(floor((self.frame.size.width - _settingsButton.frame.size.width) / 2.0f), 10.0f, _settingsButton.frame.size.width, _settingsButton.frame.size.height);
}