Some appearance tweaks
This commit is contained in:
@@ -110,7 +110,7 @@ class BrowserView: UIView
|
|||||||
|
|
||||||
// Fix web view content insets
|
// Fix web view content insets
|
||||||
if let webView = webView {
|
if let webView = webView {
|
||||||
webView.scrollView.layer.masksToBounds = false // allow content to draw under titlebar/toolbar
|
webView.scrollView.layer.masksToBounds = true
|
||||||
webView.frame = bounds.inset(by: webViewContentInset)
|
webView.frame = bounds.inset(by: webViewContentInset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ class BrowserViewController: UIViewController, WKNavigationDelegate, WKUIDelegat
|
|||||||
previewProvider: nil) { (menuElements: [UIMenuElement]) -> UIMenu? in
|
previewProvider: nil) { (menuElements: [UIMenuElement]) -> UIMenu? in
|
||||||
|
|
||||||
let openInNewTab = UIAction(title: "Open in New Tab",
|
let openInNewTab = UIAction(title: "Open in New Tab",
|
||||||
image: UIImage(systemName: "plus.app"),
|
image: UIImage(systemName: "plus.app"),
|
||||||
identifier: nil,
|
identifier: nil,
|
||||||
discoverabilityTitle: nil,
|
discoverabilityTitle: nil,
|
||||||
attributes: [],
|
attributes: [],
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ReliefButton: UIButton
|
|||||||
internal let backgroundView = GradientView(direction: .vertical, colors: ReliefButton.gradientColors(inverted: false, darkMode: false))
|
internal let backgroundView = GradientView(direction: .vertical, colors: ReliefButton.gradientColors(inverted: false, darkMode: false))
|
||||||
|
|
||||||
static let padding = CGFloat(24.0)
|
static let padding = CGFloat(24.0)
|
||||||
static let cornerRadius = CGFloat(4.0)
|
static let cornerRadius = CGFloat(6.0)
|
||||||
static let borderWidth = CGFloat(1.0)
|
static let borderWidth = CGFloat(1.0)
|
||||||
|
|
||||||
override var isHighlighted: Bool {
|
override var isHighlighted: Bool {
|
||||||
@@ -55,12 +55,14 @@ class ReliefButton: UIButton
|
|||||||
shadowView.layer.masksToBounds = false
|
shadowView.layer.masksToBounds = false
|
||||||
shadowView.layer.shouldRasterize = true
|
shadowView.layer.shouldRasterize = true
|
||||||
shadowView.layer.rasterizationScale = UIScreen.main.scale
|
shadowView.layer.rasterizationScale = UIScreen.main.scale
|
||||||
|
shadowView.layer.cornerCurve = .continuous
|
||||||
addSubview(shadowView)
|
addSubview(shadowView)
|
||||||
|
|
||||||
backgroundView.layer.cornerRadius = Self.cornerRadius
|
backgroundView.layer.cornerRadius = Self.cornerRadius
|
||||||
backgroundView.isUserInteractionEnabled = false
|
backgroundView.isUserInteractionEnabled = false
|
||||||
backgroundView.layer.masksToBounds = true
|
backgroundView.layer.masksToBounds = true
|
||||||
backgroundView.layer.borderWidth = Self.borderWidth
|
backgroundView.layer.borderWidth = Self.borderWidth
|
||||||
|
backgroundView.layer.cornerCurve = .continuous
|
||||||
addSubview(backgroundView)
|
addSubview(backgroundView)
|
||||||
|
|
||||||
traitCollectionDidChange(nil)
|
traitCollectionDidChange(nil)
|
||||||
@@ -138,13 +140,9 @@ class ReliefButton: UIButton
|
|||||||
sendSubviewToBack(backgroundView)
|
sendSubviewToBack(backgroundView)
|
||||||
sendSubviewToBack(shadowView)
|
sendSubviewToBack(shadowView)
|
||||||
|
|
||||||
let backgroundDimension = bounds.height - 1.0
|
let backgroundDimension = bounds.height
|
||||||
backgroundView.frame = CGRect(origin: .zero, size: CGSize(width: backgroundDimension, height: backgroundDimension))
|
backgroundView.frame = CGRect(origin: .zero, size: CGSize(width: backgroundDimension, height: backgroundDimension))
|
||||||
backgroundView.frame = backgroundView.frame.centeredX(inRect: bounds)
|
backgroundView.frame = backgroundView.frame.centeredX(inRect: bounds)
|
||||||
shadowView.frame = backgroundView.frame
|
shadowView.frame = backgroundView.frame
|
||||||
|
|
||||||
// Offset by a small amount. Visual illusion caused by the shadow
|
|
||||||
backgroundView.frame = backgroundView.frame.offsetBy(dx: 0.0, dy: 1.0)
|
|
||||||
shadowView.frame = shadowView.frame.offsetBy(dx: 0.0, dy: 1.0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class ToolbarView: UIView
|
|||||||
var cancelButtonVisible: Bool = false { didSet { layoutSubviews() } }
|
var cancelButtonVisible: Bool = false { didSet { layoutSubviews() } }
|
||||||
|
|
||||||
let containerView = UIView(frame: .zero)
|
let containerView = UIView(frame: .zero)
|
||||||
let backgroundView = UIVisualEffectView(effect: UIBlurEffect(style: .systemThickMaterial))
|
let backgroundView = GradientView(direction: .vertical, colors: [.tertiarySystemGroupedBackground, .secondarySystemGroupedBackground])
|
||||||
let cancelButton = UIButton(type: .system)
|
let cancelButton = UIButton(type: .system)
|
||||||
|
|
||||||
let leadingButtonsView = ToolbarButtonContainerView(frame: .zero)
|
let leadingButtonsView = ToolbarButtonContainerView(frame: .zero)
|
||||||
@@ -95,11 +95,16 @@ class ToolbarView: UIView
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let urlBar = urlBar {
|
if let urlBar = urlBar {
|
||||||
let origin = CGPoint(
|
var origin = CGPoint(
|
||||||
x: leadingButtonsView.frame.maxX,
|
x: leadingButtonsView.frame.maxX,
|
||||||
y: 0.0
|
y: 0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if origin.x == 0 {
|
||||||
|
// Add some padding if url bar is flush with side
|
||||||
|
origin.x = layoutMargins.left
|
||||||
|
}
|
||||||
|
|
||||||
urlBar.frame = CGRect(
|
urlBar.frame = CGRect(
|
||||||
origin: origin,
|
origin: origin,
|
||||||
size: CGSize(
|
size: CGSize(
|
||||||
@@ -108,7 +113,7 @@ class ToolbarView: UIView
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
urlBar.frame = urlBar.frame.inset(by: urlBarInsets)
|
urlBar.frame = urlBar.frame.inset(by: urlBarInsets).inset(by: buttonContainerInset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class URLBar: UIView
|
class URLBar: ReliefButton
|
||||||
{
|
{
|
||||||
let textField = UITextField(frame: .zero)
|
let textField = UITextField(frame: .zero)
|
||||||
let refreshButton = UIButton(frame: .zero)
|
let refreshButton = UIButton(frame: .zero)
|
||||||
@@ -23,8 +23,6 @@ class URLBar: UIView
|
|||||||
didSet { updateProgressIndicator() }
|
didSet { updateProgressIndicator() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private let backgroundView = UIVisualEffectView(effect: UIBlurEffect(style: .systemThickMaterial))
|
|
||||||
private let shadowView = UIView(frame: .zero)
|
|
||||||
private let fadeMaskView = UIImageView(frame: .zero)
|
private let fadeMaskView = UIImageView(frame: .zero)
|
||||||
|
|
||||||
private let progressIndicatorView = ProgressIndicatorView()
|
private let progressIndicatorView = ProgressIndicatorView()
|
||||||
@@ -33,21 +31,14 @@ class URLBar: UIView
|
|||||||
private let refreshImage = UIImage(systemName: "arrow.clockwise")
|
private let refreshImage = UIImage(systemName: "arrow.clockwise")
|
||||||
private let stopImage = UIImage(systemName: "xmark")
|
private let stopImage = UIImage(systemName: "xmark")
|
||||||
|
|
||||||
private let backgroundCornerRadius: CGFloat = 4
|
private let backgroundCornerRadius: CGFloat = 0
|
||||||
|
|
||||||
convenience init() {
|
override init() {
|
||||||
self.init(frame: .zero)
|
super.init()
|
||||||
|
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
|
|
||||||
backgroundView.layer.masksToBounds = true
|
backgroundView.addSubview(progressIndicatorView)
|
||||||
backgroundView.layer.cornerRadius = backgroundCornerRadius
|
|
||||||
backgroundView.layer.borderWidth = 1
|
|
||||||
backgroundView.layer.borderColor = UIColor.secondarySystemFill.cgColor
|
|
||||||
backgroundView.isUserInteractionEnabled = false
|
|
||||||
addSubview(backgroundView)
|
|
||||||
|
|
||||||
backgroundView.contentView.addSubview(progressIndicatorView)
|
|
||||||
|
|
||||||
textField.backgroundColor = .clear
|
textField.backgroundColor = .clear
|
||||||
textField.textContentType = .URL
|
textField.textContentType = .URL
|
||||||
@@ -82,6 +73,10 @@ class URLBar: UIView
|
|||||||
setErrorButtonAnimating(false)
|
setErrorButtonAnimating(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
private func updateProgressIndicator() {
|
private func updateProgressIndicator() {
|
||||||
setErrorButtonAnimating(false)
|
setErrorButtonAnimating(false)
|
||||||
|
|
||||||
@@ -176,7 +171,7 @@ class URLBar: UIView
|
|||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
backgroundView.frame = bounds
|
backgroundView.frame = bounds
|
||||||
shadowView.frame = bounds
|
shadowView.frame = bounds
|
||||||
progressIndicatorView.frame = backgroundView.contentView.bounds
|
progressIndicatorView.frame = backgroundView.bounds
|
||||||
textField.frame = bounds.insetBy(dx: 6.0, dy: 0)
|
textField.frame = bounds.insetBy(dx: 6.0, dy: 0)
|
||||||
|
|
||||||
var fadeCutoffLocation: CGFloat = 0.8
|
var fadeCutoffLocation: CGFloat = 0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user