Skip to content

Commit 044013e

Browse files
committed
Add ZLImageEditorUIConfiguration. Change the authority of ZLEditImageViewController to open.
1 parent eb4c2e7 commit 044013e

13 files changed

+413
-264
lines changed

Sources/Extensions/Bundle+ZLImageEditor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ extension Bundle {
108108
private class func getLanguage() -> String {
109109
var language = "en"
110110

111-
switch ZLImageEditorConfiguration.default().languageType {
111+
switch ZLImageEditorUIConfiguration.default().languageType {
112112
case .system:
113113
language = Locale.preferredLanguages.first ?? "en"
114114

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//
2+
// UIColor+ZLImageEditor.swift
3+
// ZLImageEditor
4+
//
5+
// Created by long on 2022/5/13.
6+
//
7+
// Copyright (c) 2020 Long Zhang <495181165@qq.com>
8+
//
9+
// Permission is hereby granted, free of charge, to any person obtaining a copy
10+
// of this software and associated documentation files (the "Software"), to deal
11+
// in the Software without restriction, including without limitation the rights
12+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
// copies of the Software, and to permit persons to whom the Software is
14+
// furnished to do so, subject to the following conditions:
15+
//
16+
// The above copyright notice and this permission notice shall be included in
17+
// all copies or substantial portions of the Software.
18+
//
19+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
// THE SOFTWARE.
26+
27+
import UIKit
28+
29+
extension UIColor {
30+
31+
class var adjustSliderNormalColor: UIColor {
32+
ZLImageEditorUIConfiguration.default().adjustSliderNormalColor
33+
}
34+
35+
class var adjustSliderTintColor: UIColor {
36+
ZLImageEditorUIConfiguration.default().adjustSliderTintColor
37+
}
38+
39+
class var editDoneBtnBgColor: UIColor {
40+
ZLImageEditorUIConfiguration.default().editDoneBtnBgColor
41+
}
42+
43+
class var editDoneBtnTitleColor: UIColor {
44+
ZLImageEditorUIConfiguration.default().editDoneBtnTitleColor
45+
}
46+
47+
class var ashbinNormalBgColor: UIColor {
48+
ZLImageEditorUIConfiguration.default().ashbinNormalBgColor
49+
}
50+
51+
class var ashbinTintBgColor: UIColor {
52+
ZLImageEditorUIConfiguration.default().ashbinTintBgColor
53+
}
54+
55+
}

Sources/General/ZLAdjustSlider.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// ZLAdjustSlider.swift
3-
// ZLPhotoBrowser
3+
// ZLImageEditor
44
//
55
// Created by long on 2021/12/17.
66
//
@@ -86,20 +86,20 @@ class ZLAdjustSlider: UIView {
8686
}
8787

8888
private func setupUI() {
89-
shadowView.backgroundColor = ZLImageEditorConfiguration.default().adjustSliderNormalColor
89+
shadowView.backgroundColor = .adjustSliderNormalColor
9090
shadowView.layer.cornerRadius = sliderWidth / 2
9191
shadowView.layer.shadowColor = UIColor.black.withAlphaComponent(0.4).cgColor
9292
shadowView.layer.shadowOffset = .zero
9393
shadowView.layer.shadowOpacity = 1
9494
shadowView.layer.shadowRadius = 3
9595
addSubview(shadowView)
9696

97-
whiteView.backgroundColor = ZLImageEditorConfiguration.default().adjustSliderNormalColor
97+
whiteView.backgroundColor = .adjustSliderNormalColor
9898
whiteView.layer.cornerRadius = sliderWidth / 2
9999
whiteView.layer.masksToBounds = true
100100
addSubview(whiteView)
101101

102-
tintView.backgroundColor = ZLImageEditorConfiguration.default().adjustSliderTintColor
102+
tintView.backgroundColor = .adjustSliderTintColor
103103
whiteView.addSubview(tintView)
104104

105105
separator.backgroundColor = zlRGB(230, 230, 230)

Sources/General/ZLClipImageViewController.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ class ZLClipImageViewController: UIViewController {
8888

8989
var bottomToolLineView: UIView!
9090

91-
var cancelBtn: UIButton!
91+
lazy var cancelBtn = ZLEnlargeButton(type: .custom)
9292

93-
var revertBtn: UIButton!
93+
lazy var revertBtn = ZLEnlargeButton(type: .custom)
9494

95-
var doneBtn: UIButton!
95+
lazy var doneBtn = ZLEnlargeButton(type: .custom)
9696

97-
var rotateBtn: UIButton!
97+
lazy var rotateBtn = ZLEnlargeButton(type: .custom)
9898

9999
var clipRatioColView: UICollectionView!
100100

@@ -313,32 +313,28 @@ class ZLClipImageViewController: UIViewController {
313313
self.bottomToolLineView.backgroundColor = zlRGB(240, 240, 240)
314314
self.bottomToolView.addSubview(self.bottomToolLineView)
315315

316-
self.cancelBtn = UIButton(type: .custom)
317316
self.cancelBtn.setImage(getImage("zl_close"), for: .normal)
318317
self.cancelBtn.adjustsImageWhenHighlighted = false
319-
self.cancelBtn.zl_enlargeValidTouchArea(inset: 20)
318+
self.cancelBtn.enlargeInset = 20
320319
self.cancelBtn.addTarget(self, action: #selector(cancelBtnClick), for: .touchUpInside)
321320
self.bottomToolView.addSubview(self.cancelBtn)
322321

323-
self.revertBtn = UIButton(type: .custom)
324322
self.revertBtn.setTitleColor(.white, for: .normal)
325323
self.revertBtn.setTitle(localLanguageTextValue(.revert), for: .normal)
326-
self.revertBtn.zl_enlargeValidTouchArea(inset: 20)
324+
self.revertBtn.enlargeInset = 20
327325
self.revertBtn.titleLabel?.font = ZLImageEditorLayout.bottomToolTitleFont
328326
self.revertBtn.addTarget(self, action: #selector(revertBtnClick), for: .touchUpInside)
329327
self.bottomToolView.addSubview(self.revertBtn)
330328

331-
self.doneBtn = UIButton(type: .custom)
332329
self.doneBtn.setImage(getImage("zl_right"), for: .normal)
333330
self.doneBtn.adjustsImageWhenHighlighted = false
334-
self.doneBtn.zl_enlargeValidTouchArea(inset: 20)
331+
self.doneBtn.enlargeInset = 20
335332
self.doneBtn.addTarget(self, action: #selector(doneBtnClick), for: .touchUpInside)
336333
self.bottomToolView.addSubview(self.doneBtn)
337334

338-
self.rotateBtn = UIButton(type: .custom)
339335
self.rotateBtn.setImage(getImage("zl_rotateimage"), for: .normal)
340336
self.rotateBtn.adjustsImageWhenHighlighted = false
341-
self.rotateBtn.zl_enlargeValidTouchArea(inset: 20)
337+
self.rotateBtn.enlargeInset = 20
342338
self.rotateBtn.addTarget(self, action: #selector(rotateBtnClick), for: .touchUpInside)
343339
self.view.addSubview(self.rotateBtn)
344340

0 commit comments

Comments
 (0)