Skip to content

Commit

Permalink
Fix mozilla-mobile#5190 - updating Add Search Engine screen's title b…
Browse files Browse the repository at this point in the history
…ox to use the default keyboard
  • Loading branch information
dfperry5 committed Dec 16, 2019
1 parent bbdfee5 commit acd2fec
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Client/Frontend/Settings/CustomSearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ class CustomSearchViewController: SettingsTableViewController {
})
titleField.textField.accessibilityIdentifier = "customEngineTitle"

let urlField = CustomSearchEngineTextView(placeholder: Strings.SettingsAddCustomEngineURLPlaceholder, height: 133, settingIsValid: { text in
let urlField = CustomSearchEngineTextView(placeholder: Strings.SettingsAddCustomEngineURLPlaceholder, height: 133,
keyboardType: .URL, settingIsValid: { text in
//Can check url text text validity here.
return true
}, settingDidChange: {fieldText in
Expand Down Expand Up @@ -180,13 +181,15 @@ class CustomSearchEngineTextView: Setting, UITextViewDelegate {

let textField = UITextView()
let placeholderLabel = UILabel()
var keyboardType: UIKeyboardType = .default

init(defaultValue: String? = nil, placeholder: String, height: CGFloat = 44, settingIsValid isValueValid: ((String?) -> Bool)? = nil, settingDidChange: ((String?) -> Void)? = nil) {
init(defaultValue: String? = nil, placeholder: String, height: CGFloat = 44, keyboardType: UIKeyboardType = .default, settingIsValid isValueValid: ((String?) -> Bool)? = nil, settingDidChange: ((String?) -> Void)? = nil) {
self.defaultValue = defaultValue
self.TextFieldHeight = height
self.settingDidChange = settingDidChange
self.settingIsValid = isValueValid
self.placeholder = placeholder
self.keyboardType = keyboardType
textField.addSubview(placeholderLabel)
super.init(cellHeight: TextFieldHeight)
}
Expand All @@ -204,7 +207,10 @@ class CustomSearchEngineTextView: Setting, UITextViewDelegate {
textField.font = placeholderLabel.font

textField.textContainer.lineFragmentPadding = 0
textField.keyboardType = .URL
textField.keyboardType = keyboardType
if (keyboardType == .default) {
textField.autocapitalizationType = .words
}
textField.autocorrectionType = .no
textField.delegate = self
textField.backgroundColor = UIColor.theme.tableView.rowBackground
Expand Down

0 comments on commit acd2fec

Please sign in to comment.