Skip to content

Commit

Permalink
Issue #5901 - fixed placeholders clearing on theem change in customSe…
Browse files Browse the repository at this point in the history
…archVC (#6236)

user input stays on theme change

address extra lines feedback
  • Loading branch information
nishant2718 committed Mar 11, 2020
1 parent 3062b2d commit b940d6b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Client/Frontend/Settings/CustomSearchViewController.swift
Expand Up @@ -135,6 +135,7 @@ class CustomSearchViewController: SettingsTableViewController {
}
self.engineTitle = title
})
titleField.textField.text = engineTitle
titleField.textField.accessibilityIdentifier = "customEngineTitle"

let urlField = CustomSearchEngineTextView(placeholder: Strings.SettingsAddCustomEngineURLPlaceholder, height: 133,
Expand All @@ -146,6 +147,7 @@ class CustomSearchViewController: SettingsTableViewController {
})

urlField.textField.autocapitalizationType = .none
urlField.textField.text = urlString
urlField.textField.accessibilityIdentifier = "customEngineUrl"

let settings: [SettingSection] = [
Expand All @@ -172,6 +174,10 @@ class CustomSearchEngineTextView: Setting, UITextViewDelegate {

fileprivate let Padding: CGFloat = 8
fileprivate let TextLabelHeight: CGFloat = 44
fileprivate var TextLabelWidth: CGFloat {
let width = textField.frame.width == 0 ? 360 : textField.frame.width
return width
}
fileprivate var TextFieldHeight: CGFloat = 44

fileprivate let defaultValue: String?
Expand Down Expand Up @@ -203,7 +209,8 @@ class CustomSearchEngineTextView: Setting, UITextViewDelegate {
placeholderLabel.adjustsFontSizeToFitWidth = true
placeholderLabel.textColor = UIColor.theme.general.settingsTextPlaceholder ?? UIColor(red: 0.0, green: 0.0, blue: 0.0980392, alpha: 0.22)
placeholderLabel.text = placeholder
placeholderLabel.frame = CGRect(width: textField.frame.width, height: TextLabelHeight)
placeholderLabel.isHidden = !textField.text.isEmpty
placeholderLabel.frame = CGRect(width: TextLabelWidth, height: TextLabelHeight)
textField.font = placeholderLabel.font

textField.textContainer.lineFragmentPadding = 0
Expand Down

0 comments on commit b940d6b

Please sign in to comment.