widget layout tool improvements

This commit is contained in:
True Zhuanjia committed 2026-03-22 14:01:09 +08:00
1 parent d092b93a29
commit dbe91f5b07
6 files changed
+253 -71

No files matched your search

+123 -54
View File
@@ -1387,52 +1387,6 @@
} }
} }
}, },
"Alias (optional)" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "别名 (允许留空)"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "別名 (可選)"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "別名 (可選)"
}
}
}
},
"Alias label (optional)" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "别名标签 (可留空)"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "別名標籤 (可選)"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "別名標籤 (可選)"
}
}
}
},
"All Settings" : { "All Settings" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -2032,25 +1986,25 @@
} }
} }
}, },
"Command" : { "Command: " : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "命令" "value" : "命令: "
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "指令" "value" : "指令: "
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "指令" "value" : "指令: "
} }
} }
} }
@@ -2902,6 +2856,29 @@
} }
} }
}, },
"e.g. ctrl, lswheel, wasdpad..." : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "如ctrl, lswheel, wasdpad..."
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "如ctrl, lswheel, wasdpad..."
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "如ctrl, lswheel, wasdpad..."
}
}
}
},
"edgeSlidingSensitivityStackTip" : { "edgeSlidingSensitivityStackTip" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -4332,6 +4309,29 @@
} }
} }
}, },
"Label: " : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "标签: "
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "標籤: "
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "標籤: "
}
}
}
},
"Later" : { "Later" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -5324,6 +5324,29 @@
} }
} }
}, },
"No widget selected" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "请先点选一个控件"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "請先點選一個小工具"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "請先點選一個小工具"
}
}
}
},
"Nothing to Undo" : { "Nothing to Undo" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -5710,6 +5733,29 @@
} }
} }
}, },
"optional" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "可留空"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "可選"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "可選"
}
}
}
},
"Options" : { "Options" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -6935,6 +6981,29 @@
} }
} }
}, },
"r - round/circle, s - square/rect" : {
"extractionState" : "manual",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "r - 圆形, s - 方形"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "r - 圓形, s - 方形"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "r - 圓形, s - 方形"
}
}
}
},
"Read Widget Instruction" : { "Read Widget Instruction" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -7771,25 +7840,25 @@
} }
} }
}, },
"Shape (r - round, s - square)" : { "Shape: " : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "按键形状 (r - 圆形, s - 方形)" "value" : "形状: "
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "形狀 (r - 圓形, s - 方形)" "value" : "形狀: "
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "形狀 (r - 圓形, s - 方形)" "value" : "形狀: "
} }
} }
} }
+21
View File
@@ -106,6 +106,27 @@ import Foundation
} }
} }
@objc static var autoPopSoftKeyboard: Bool = true
@objc static var textFieldShouldResignAfterReturn: Bool = false
@objc static func getAtrributedPlaceHolder(text:String)-> NSAttributedString {
if #available(iOS 13.0, *) {
return NSAttributedString(
string: text,
attributes: [
.font: UIFont.systemFont(ofSize: 15),
.foregroundColor: UIColor.placeholderText
])
} else {
return NSAttributedString(
string: text,
attributes: [
.font: UIFont.systemFont(ofSize: 15),
.foregroundColor: UIColor.lightText
])
}
}
static var kScaleLayerKey: UInt8 = 0 static var kScaleLayerKey: UInt8 = 0
@objc static func setVerticalScale(view: UIView, show: Bool) { @objc static func setVerticalScale(view: UIView, show: Bool) {
// 移除旧的 // 移除旧的
@@ -659,6 +659,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
} }
- (IBAction) addTapped:(id)sender{ - (IBAction) addTapped:(id)sender{
GenericUtils.autoPopSoftKeyboard = false;
NSMutableDictionary* widgetInitParams = [NSMutableDictionary dictionary]; NSMutableDictionary* widgetInitParams = [NSMutableDictionary dictionary];
@@ -667,24 +668,51 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = [LocalizationHelper localizedStringForKey:@"Command"]; UILabel *label = [[UILabel alloc] init];
label.text = [LocalizationHelper localizedStringForKey:@"Command: "];
label.font = [UIFont systemFontOfSize:15];
[label sizeToFit];
textField.leftView = label;
textField.leftViewMode = UITextFieldViewModeAlways;
textField.attributedPlaceholder = [GenericUtils getAtrributedPlaceHolderWithText:[LocalizationHelper localizedStringForKey:@"e.g. ctrl, lswheel, wasdpad..."]];
textField.font = [UIFont systemFontOfSize:15];
textField.keyboardType = UIKeyboardTypeASCIICapable; textField.keyboardType = UIKeyboardTypeASCIICapable;
textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.delegate = self;
}]; }];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = [LocalizationHelper localizedStringForKey:@"Alias label (optional)"]; UILabel *label = [[UILabel alloc] init];
label.text = [LocalizationHelper localizedStringForKey:@"Label: "];
label.font = [UIFont systemFontOfSize:15];
[label sizeToFit];
textField.leftView = label;
textField.leftViewMode = UITextFieldViewModeAlways;
textField.attributedPlaceholder = [GenericUtils getAtrributedPlaceHolderWithText:[LocalizationHelper localizedStringForKey:@"optional"]];
textField.font = [UIFont systemFontOfSize:15];
textField.keyboardType = UIKeyboardTypeDefault; textField.keyboardType = UIKeyboardTypeDefault;
textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.delegate = self;
}]; }];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = [LocalizationHelper localizedStringForKey:@"Shape (r - round, s - square)"]; UILabel *label = [[UILabel alloc] init];
label.text = [LocalizationHelper localizedStringForKey:@"Shape: "];
label.font = [UIFont systemFontOfSize:15];
[label sizeToFit];
textField.leftView = label;
textField.leftViewMode = UITextFieldViewModeAlways;
textField.attributedPlaceholder = [GenericUtils getAtrributedPlaceHolderWithText:[LocalizationHelper localizedStringForKey:@"r - round/circle, s - square/rect"]];
textField.font = [UIFont systemFontOfSize:15];
textField.keyboardType = UIKeyboardTypeASCIICapable; textField.keyboardType = UIKeyboardTypeASCIICapable;
textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.delegate = self;
}]; }];
@@ -719,6 +747,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
- (IBAction) editTapped:(id)sender{ - (IBAction) editTapped:(id)sender{
GenericUtils.autoPopSoftKeyboard = false;
NSMutableDictionary* widgetInitParams = [NSMutableDictionary dictionary]; NSMutableDictionary* widgetInitParams = [NSMutableDictionary dictionary];
@@ -726,29 +755,67 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
message:[LocalizationHelper localizedStringForKey:@"Edit Selected Widget"] message:[LocalizationHelper localizedStringForKey:@"Edit Selected Widget"]
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
if(self->selectedWidgetView == nil) return; if(self->selectedWidgetView == nil) {
AlertControllerUtil.autoCompletion = true;
[AlertControllerUtil showAlertIn:self
title:@""
message:[LocalizationHelper localizedStringForKey:@"No widget selected"]
withCancel:NO
buttonTitle:@""
countdown:1
action:^{}
completion:^{}];
return;
};
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = [LocalizationHelper localizedStringForKey:@"Command"]; UILabel *label = [[UILabel alloc] init];
label.text = [LocalizationHelper localizedStringForKey:@"Command: "];
label.font = [UIFont systemFontOfSize:15];
[label sizeToFit];
textField.leftView = label;
textField.leftViewMode = UITextFieldViewModeAlways;
textField.attributedPlaceholder = [GenericUtils getAtrributedPlaceHolderWithText:[LocalizationHelper localizedStringForKey:@"e.g. ctrl, lswheel, wasdpad..."]];
textField.font = [UIFont systemFontOfSize:15];
textField.keyboardType = UIKeyboardTypeASCIICapable; textField.keyboardType = UIKeyboardTypeASCIICapable;
textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.delegate = self;
textField.text = [self->selectedWidgetView.cmdString lowercaseString]; textField.text = [self->selectedWidgetView.cmdString lowercaseString];
}]; }];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = [LocalizationHelper localizedStringForKey:@"Alias label (optional)"]; UILabel *label = [[UILabel alloc] init];
label.text = [LocalizationHelper localizedStringForKey:@"Label: "];
label.font = [UIFont systemFontOfSize:15];
[label sizeToFit];
textField.leftView = label;
textField.leftViewMode = UITextFieldViewModeAlways;
textField.attributedPlaceholder = [GenericUtils getAtrributedPlaceHolderWithText:[LocalizationHelper localizedStringForKey:@"optional"]];
textField.font = [UIFont systemFontOfSize:15];
textField.keyboardType = UIKeyboardTypeDefault; textField.keyboardType = UIKeyboardTypeDefault;
textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.delegate = self;
textField.text = self->selectedWidgetView.widgetLabel; textField.text = self->selectedWidgetView.widgetLabel;
}]; }];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = [LocalizationHelper localizedStringForKey:@"Shape (r - round, s - square)"]; UILabel *label = [[UILabel alloc] init];
label.text = [LocalizationHelper localizedStringForKey:@"Shape: "];
label.font = [UIFont systemFontOfSize:15];
[label sizeToFit];
textField.leftView = label;
textField.leftViewMode = UITextFieldViewModeAlways;
textField.attributedPlaceholder = [GenericUtils getAtrributedPlaceHolderWithText:[LocalizationHelper localizedStringForKey:@"r - round/circle, s - square/rect"]];
textField.font = [UIFont systemFontOfSize:15];
textField.keyboardType = UIKeyboardTypeASCIICapable; textField.keyboardType = UIKeyboardTypeASCIICapable;
textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.delegate = self;
textField.text = self->selectedWidgetView.shape; textField.text = self->selectedWidgetView.shape;
if([self->selectedWidgetView.shape isEqualToString: @"largeSquare"]) textField.enabled = false; if([self->selectedWidgetView.shape isEqualToString: @"largeSquare"]) textField.enabled = false;
}]; }];
@@ -897,6 +964,7 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
/* show pop up notification that lets users choose to save the current OSC layout configuration as a profile they can load when they want. User can also choose to cancel out of this pop up */ /* show pop up notification that lets users choose to save the current OSC layout configuration as a profile they can load when they want. User can also choose to cancel out of this pop up */
- (IBAction) saveTapped:(id)sender { - (IBAction) saveTapped:(id)sender {
/* /*
OSCProfile* targetProfile = [profilesManager getAllProfiles][0]; OSCProfile* targetProfile = [profilesManager getAllProfiles][0];
OSCProfile* currentProfile = [profilesManager getSelectedProfile]; OSCProfile* currentProfile = [profilesManager getSelectedProfile];
@@ -1686,12 +1754,24 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
} }
} }
// UITextFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField { - (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder]; // 收起键盘 if(textField == _autoTapField){
[selectedWidgetView setAutoTapIntervalByTextWithStr:textField.text]; [textField resignFirstResponder]; // 收起键盘
[selectedWidgetView setAutoTapIntervalByTextWithStr:textField.text];
}
return YES; return YES;
} }
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if (GenericUtils.autoPopSoftKeyboard) {
return YES;
} else {
GenericUtils.autoPopSoftKeyboard = YES;
return NO;
}
}
- (void)applyShadowForiOS13:(UIStackView* )stack { - (void)applyShadowForiOS13:(UIStackView* )stack {
stack.backgroundColor = [UIColor clearColor]; stack.backgroundColor = [UIColor clearColor];
@@ -20,7 +20,7 @@
#import "HostCollectionViewController.h" #import "HostCollectionViewController.h"
@interface MainFrameViewController : UICollectionViewController <DiscoveryCallback, PairCallback, AppCallback, AppAssetCallback, NSURLConnectionDelegate, SWRevealViewControllerDelegate, HostCardActionDelegate, AppViewUpdateLoopDelegate> @interface MainFrameViewController : UICollectionViewController <DiscoveryCallback, PairCallback, AppCallback, AppAssetCallback, NSURLConnectionDelegate, SWRevealViewControllerDelegate, HostCardActionDelegate, AppViewUpdateLoopDelegate, UITextFieldDelegate>
@property (nonatomic, strong) IBOutlet UIBarButtonItem *settingsButton; @property (nonatomic, strong) IBOutlet UIBarButtonItem *settingsButton;
#if !TARGET_OS_TV #if !TARGET_OS_TV
@@ -723,6 +723,7 @@ static NSMutableSet* hostList;
- (void) addHostTapped { - (void) addHostTapped {
Log(LOG_D, @"Tapped add host"); Log(LOG_D, @"Tapped add host");
GenericUtils.autoPopSoftKeyboard = GenericUtils.isIPhone ? false : true;
UIAlertController* alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Add Host Manually"] UIAlertController* alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Add Host Manually"]
message:[LocalizationHelper localizedStringForKey:@"Enter IP address to add host manually"] message:[LocalizationHelper localizedStringForKey:@"Enter IP address to add host manually"]
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
@@ -732,6 +733,7 @@ static NSMutableSet* hostList;
textField.keyboardType = UIKeyboardTypeASCIICapable; textField.keyboardType = UIKeyboardTypeASCIICapable;
textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo;
textField.delegate = self;
}]; }];
[alertController addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Cancel"] [alertController addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Cancel"]
@@ -2404,6 +2406,15 @@ static NSMutableSet* hostList;
return YES; return YES;
} }
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if (GenericUtils.autoPopSoftKeyboard) {
return YES;
} else {
GenericUtils.autoPopSoftKeyboard = YES;
return NO;
}
}
#if !TARGET_OS_TV #if !TARGET_OS_TV
- (BOOL)shouldAutorotate { - (BOOL)shouldAutorotate {
return YES; return YES;
@@ -37,7 +37,6 @@
bool settingsViewJustLoaded; bool settingsViewJustLoaded;
bool settingsViewJustExpanded; bool settingsViewJustExpanded;
bool settingsViewAlreadyAppeared; bool settingsViewAlreadyAppeared;
bool autoPopKeyboard;
uint16_t oswLayoutFingers; uint16_t oswLayoutFingers;
CustomEdgeSlideGestureRecognizer *slideToCloseSettingsViewRecognizer; CustomEdgeSlideGestureRecognizer *slideToCloseSettingsViewRecognizer;
NSMutableDictionary *_settingStackDict; NSMutableDictionary *_settingStackDict;
@@ -570,7 +569,6 @@ BOOL isCustomResolution(int resolutionSelected) {
settingsViewJustExpanded = false; settingsViewJustExpanded = false;
settingsViewAlreadyAppeared = true; settingsViewAlreadyAppeared = true;
autoPopKeyboard = true;
} }
- (void)viewWillDisappear:(BOOL)animated{ - (void)viewWillDisappear:(BOOL)animated{
@@ -2233,6 +2231,7 @@ BOOL isCustomResolution(int resolutionSelected) {
} }
- (void)showCustomOswTip { - (void)showCustomOswTip {
GenericUtils.autoPopSoftKeyboard = GenericUtils.isIPhone ? false : true;
NSString* edgeSide = self.slideToSettingsScreenEdgeSelector.selectedSegmentIndex == 1 ? [LocalizationHelper localizedStringForKey:@"left"] : [LocalizationHelper localizedStringForKey:@"right"]; NSString* edgeSide = self.slideToSettingsScreenEdgeSelector.selectedSegmentIndex == 1 ? [LocalizationHelper localizedStringForKey:@"left"] : [LocalizationHelper localizedStringForKey:@"right"];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Rebase in Streaming"] UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Rebase in Streaming"]
message:[LocalizationHelper localizedStringForKey:@"Open widget tool in streaming by:\nSliding from %@ screen edge to open cmd tool.\nOr tap %d fingers on stream view, number of fingers required:", edgeSide, self->oswLayoutFingers] message:[LocalizationHelper localizedStringForKey:@"Open widget tool in streaming by:\nSliding from %@ screen edge to open cmd tool.\nOr tap %d fingers on stream view, number of fingers required:", edgeSide, self->oswLayoutFingers]
@@ -2241,6 +2240,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = [LocalizationHelper localizedStringForKey:@"%d", self->oswLayoutFingers]; textField.placeholder = [LocalizationHelper localizedStringForKey:@"%d", self->oswLayoutFingers];
textField.keyboardType = UIKeyboardTypeNumberPad; textField.keyboardType = UIKeyboardTypeNumberPad;
textField.delegate = self;
}]; }];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Cancel"] UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Cancel"]
@@ -2997,7 +2997,7 @@ BOOL isCustomResolution(int resolutionSelected) {
- (void)softKeyboardHeightSwitchFlipped:(UISwitch* )sender{ - (void)softKeyboardHeightSwitchFlipped:(UISwitch* )sender{
if(sender.isOn && !settingsViewJustLoaded){ if(sender.isOn && !settingsViewJustLoaded){
autoPopKeyboard = false; GenericUtils.autoPopSoftKeyboard = false;
[GenericUtils setVerticalScaleWithView:self.view show:true]; [GenericUtils setVerticalScaleWithView:self.view show:true];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@""] UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@""]
message:[LocalizationHelper localizedStringForKey:@"Enter the relative height of the soft keyboard according to the scale (make sure app is in landscape fullscreen mode):"] message:[LocalizationHelper localizedStringForKey:@"Enter the relative height of the soft keyboard according to the scale (make sure app is in landscape fullscreen mode):"]
@@ -3017,7 +3017,6 @@ BOOL isCustomResolution(int resolutionSelected) {
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[GenericUtils setVerticalScaleWithView:self.view show:false]; [GenericUtils setVerticalScaleWithView:self.view show:false];
[sender setOn:self->softKeyboardHeight!=0]; [sender setOn:self->softKeyboardHeight!=0];
self->autoPopKeyboard = true;
}]; }];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"OK"] UIAlertAction *okAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"OK"]
@@ -3026,7 +3025,6 @@ BOOL isCustomResolution(int resolutionSelected) {
self->softKeyboardHeight = [GenericUtils toCGFloat:alertController.textFields[0].text]; self->softKeyboardHeight = [GenericUtils toCGFloat:alertController.textFields[0].text];
[GenericUtils setVerticalScaleWithView:self.view show:false]; [GenericUtils setVerticalScaleWithView:self.view show:false];
[sender setOn:self->softKeyboardHeight!=0]; [sender setOn:self->softKeyboardHeight!=0];
self->autoPopKeyboard = true;
}]; }];
[alertController addAction:cancelAction]; [alertController addAction:cancelAction];
[alertController addAction:okAction]; [alertController addAction:okAction];
@@ -3036,10 +3034,10 @@ BOOL isCustomResolution(int resolutionSelected) {
// UITextFieldDelegate // UITextFieldDelegate
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if (autoPopKeyboard) { if (GenericUtils.autoPopSoftKeyboard) {
return YES; return YES;
} else { } else {
autoPopKeyboard = YES; GenericUtils.autoPopSoftKeyboard = YES;
return NO; return NO;
} }
} }
@@ -3193,6 +3191,7 @@ BOOL isCustomResolution(int resolutionSelected) {
} }
- (void) promptCustomResolutionDialog { - (void) promptCustomResolutionDialog {
GenericUtils.autoPopSoftKeyboard = GenericUtils.isIPhone ? false : true;
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey: @"Enter Custom Resolution"] message:nil preferredStyle:UIAlertControllerStyleAlert]; UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey: @"Enter Custom Resolution"] message:nil preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
@@ -3200,6 +3199,7 @@ BOOL isCustomResolution(int resolutionSelected) {
textField.clearButtonMode = UITextFieldViewModeAlways; textField.clearButtonMode = UITextFieldViewModeAlways;
textField.borderStyle = UITextBorderStyleRoundedRect; textField.borderStyle = UITextBorderStyleRoundedRect;
textField.keyboardType = UIKeyboardTypeNumberPad; textField.keyboardType = UIKeyboardTypeNumberPad;
textField.delegate = self;
if (resolutionTable[RESOLUTION_TABLE_CUSTOM_INDEX].width == 0) { if (resolutionTable[RESOLUTION_TABLE_CUSTOM_INDEX].width == 0) {
textField.text = @""; textField.text = @"";
@@ -3214,6 +3214,7 @@ BOOL isCustomResolution(int resolutionSelected) {
textField.clearButtonMode = UITextFieldViewModeAlways; textField.clearButtonMode = UITextFieldViewModeAlways;
textField.borderStyle = UITextBorderStyleRoundedRect; textField.borderStyle = UITextBorderStyleRoundedRect;
textField.keyboardType = UIKeyboardTypeNumberPad; textField.keyboardType = UIKeyboardTypeNumberPad;
textField.delegate = self;
if (resolutionTable[RESOLUTION_TABLE_CUSTOM_INDEX].height == 0) { if (resolutionTable[RESOLUTION_TABLE_CUSTOM_INDEX].height == 0) {
textField.text = @""; textField.text = @"";