Merge pull request #2256 from AlphaWallet/#2253

Make camera button in address textfield follow textfield's background color #2253
pull/2262/head
Hwee-Boon Yar 4 years ago committed by GitHub
commit 9acf208739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      AlphaWallet/UI/AddressTextField.swift
  2. 15
      AlphaWallet/UI/Button.swift

@ -241,7 +241,7 @@ class AddressTextField: UIControl {
}
private func makeTargetAddressRightView() -> UIView {
let scanQRCodeButton = Button(size: .normal, style: .borderless)
let scanQRCodeButton = Button(size: .normal, style: .system)
scanQRCodeButton.translatesAutoresizingMaskIntoConstraints = false
scanQRCodeButton.setImage(R.image.qr_code_icon(), for: .normal)
scanQRCodeButton.addTarget(self, action: #selector(openReader), for: .touchUpInside)
@ -253,7 +253,7 @@ class AddressTextField: UIControl {
let targetAddressRightView = [scanQRCodeButton].asStackView(distribution: .fill)
targetAddressRightView.clipsToBounds = false
targetAddressRightView.layer.masksToBounds = false
targetAddressRightView.backgroundColor = .clear
//As of iOS 13, we need to constrain the width of `rightView`
let rightViewFittingSize = targetAddressRightView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)
NSLayoutConstraint.activate([

@ -24,11 +24,13 @@ enum ButtonStyle: Int {
case squared
case border
case borderless
case system
var backgroundColor: UIColor {
switch self {
case .solid, .squared: return Colors.appTint
case .border, .borderless: return .white
case .system: return .clear
}
}
@ -37,13 +39,14 @@ enum ButtonStyle: Int {
case .solid, .squared: return Colors.appTint
case .border: return Colors.appTint
case .borderless: return .white
case .system: return .clear
}
}
var cornerRadius: CGFloat {
switch self {
case .solid, .border: return 5
case .squared, .borderless: return 0
case .squared, .borderless, .system: return 0
}
}
@ -52,7 +55,7 @@ enum ButtonStyle: Int {
case .solid,
.squared,
.border,
.borderless:
.borderless, .system:
return Fonts.semibold(size: 16)!
}
}
@ -60,7 +63,7 @@ enum ButtonStyle: Int {
var textColor: UIColor {
switch self {
case .solid, .squared: return Colors.appWhite
case .border, .borderless: return Colors.appTint
case .border, .borderless, .system: return Colors.appTint
}
}
@ -68,20 +71,20 @@ enum ButtonStyle: Int {
switch self {
case .solid, .squared: return UIColor(white: 1, alpha: 0.8)
case .border: return Colors.appWhite
case .borderless: return Colors.appTint
case .borderless, .system: return Colors.appTint
}
}
var borderColor: UIColor {
switch self {
case .solid, .squared, .border: return GroupedTable.Color.background
case .borderless: return .clear
case .borderless, .system: return .clear
}
}
var borderWidth: CGFloat {
switch self {
case .solid, .squared, .borderless: return 0
case .solid, .squared, .borderless, .system: return 0
case .border: return 1
}
}

Loading…
Cancel
Save