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