ارفع راسك فوق انته سوري حر ... :green_heart::green_heart:

Skip to content
Snippets Groups Projects
Commit 6a26cdef authored by George's avatar George
Browse files

add corners

parent 8023ff8f
Branches
No related tags found
No related merge requests found
......@@ -84,6 +84,7 @@
53CD5F5E2C1505EC0010424B /* UIWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CD5F5D2C1505EC0010424B /* UIWindow.swift */; };
53CD5F612C15A6210010424B /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CD5F5F2C15A6210010424B /* SettingViewController.swift */; };
53CD5F622C15A6210010424B /* SettingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 53CD5F602C15A6210010424B /* SettingViewController.xib */; };
53E3A2092C19D17100C9B95E /* PreviewImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53E3A2082C19D17100C9B95E /* PreviewImageViewController.swift */; };
53EDED962C18387E00DB8DF9 /* TYPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDED922C18387E00DB8DF9 /* TYPageControl.m */; };
53EDED972C18387E00DB8DF9 /* TYCyclePagerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDED932C18387E00DB8DF9 /* TYCyclePagerView.m */; };
53EDED982C18387E00DB8DF9 /* TYCyclePagerTransformLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 53EDED942C18387E00DB8DF9 /* TYCyclePagerTransformLayout.m */; };
......@@ -234,6 +235,7 @@
53CD5F5D2C1505EC0010424B /* UIWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIWindow.swift; sourceTree = "<group>"; };
53CD5F5F2C15A6210010424B /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = "<group>"; };
53CD5F602C15A6210010424B /* SettingViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SettingViewController.xib; sourceTree = "<group>"; };
53E3A2082C19D17100C9B95E /* PreviewImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewImageViewController.swift; sourceTree = "<group>"; };
53EDED902C18387E00DB8DF9 /* TYCyclePagerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TYCyclePagerView.h; sourceTree = "<group>"; };
53EDED912C18387E00DB8DF9 /* TYCyclePagerTransformLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TYCyclePagerTransformLayout.h; sourceTree = "<group>"; };
53EDED922C18387E00DB8DF9 /* TYPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TYPageControl.m; sourceTree = "<group>"; };
......@@ -564,6 +566,7 @@
children = (
53EDED9C2C183CDF00DB8DF9 /* BannerView.swift */,
53EDED9E2C183CEB00DB8DF9 /* BannerView.xib */,
53E3A2082C19D17100C9B95E /* PreviewImageViewController.swift */,
);
path = CustomViews;
sourceTree = "<group>";
......@@ -987,6 +990,7 @@
ECA1FAA4254DEB140081F00B /* CustomPDFView.swift in Sources */,
53014FA32C11A8E80071CE39 /* ZoomGestureController.swift in Sources */,
53EDED962C18387E00DB8DF9 /* TYPageControl.m in Sources */,
53E3A2092C19D17100C9B95E /* PreviewImageViewController.swift in Sources */,
EC70252A254E066400BE1958 /* SettingsViewController+Safari.swift in Sources */,
53014F9B2C11A8E80071CE39 /* CGAffineTransform+Utils.swift in Sources */,
53014FBC2C11A8E80071CE39 /* CaptureSession.swift in Sources */,
......
No preview for this file type
......@@ -14,8 +14,8 @@
filePath = "MiniScanner/Modules/EditViewController/EditViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "219"
endingLineNumber = "219"
startingLineNumber = "230"
endingLineNumber = "230"
landmarkName = "saveFileAndShare(with:name:)"
landmarkType = "7">
</BreakpointContent>
......
......@@ -56,6 +56,9 @@ class ShareSheetViewController: UIViewController {
fileNameTextField.placeholder = "File name"
backgroundView.layer.cornerRadius = 30
backgroundView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
pdfImage.layer.cornerRadius = 10
pdfImage.clipsToBounds = true
pdfImage.contentMode = .scaleAspectFill
}
private func setup() {
......
......@@ -12,6 +12,7 @@ import FSPagerView
protocol BannerViewDelegate {
func updateSelectedIndex(index: Int)
func delete(index: Int)
func preview(index: Int)
}
class BannerView: UIView {
......@@ -134,6 +135,10 @@ extension BannerView: FSPagerViewDataSource,FSPagerViewDelegate {
}
extension BannerView: FSPagerViewCellDelegate {
func preview(at: Int) {
delegate?.preview(index: at)
}
func delete(at: Int) {
delegate?.delete(index: at)
}
......
//
// PreviewImageViewController.swift
// MiniScanner
//
// Created by George Makhoul on 12/06/2024.
// Copyright © 2024 AppsNectar. All rights reserved.
//
import UIKit
import WebKit
class PreviewImageViewController: UIViewController {
var previewImage = UIImageView()
var image: UIImage?
override func viewDidLoad() {
super.viewDidLoad()
self.previewImage = UIImageView(frame: view.bounds)
previewImage.contentMode = .scaleAspectFill
previewImage.image = image
self.view.addSubview(previewImage)
previewImage.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
}
......@@ -9,6 +9,8 @@
import UIKit
import LNExtensionExecutor
import NBBottomSheet
import QuickLook
public protocol EditViewControllerDelegate: NSObjectProtocol {
func editViewController(_ editViewController: EditViewController, finished session: MultiPageScanSession)
}
......@@ -28,6 +30,7 @@ public class EditViewController: UIViewController {
private var sharedFolder: AppConfigurator.Folder? = AppConfigurator.Folder(name: "Shared", savedName: "shared", isSelected: true)
var selectedFolder: AppConfigurator.Folder?
private var localFileManager: LocalFileManager?
private var fileURL: URL?
lazy private var activityIndicator: UIActivityIndicatorView = {
let activityIndicator = UIActivityIndicatorView(style: .large)
......@@ -175,6 +178,14 @@ public class EditViewController: UIViewController {
// MARK: - BannerViewDelegate
extension EditViewController: BannerViewDelegate {
func preview(index: Int) {
let previewController = PreviewImageViewController()
if let image = scanSession?.scannedItems[index].renderedImage?.retrieveImage() {
previewController.image = image
}
present(previewController, animated: true)
}
func delete(index: Int) {
let alertController = UIAlertController(title: "Alert", message: "Are you sure you want to delete this image?", preferredStyle: .alert)
......@@ -306,3 +317,14 @@ extension EditViewController: ShareSheetViewControllerDelegate {
}
}
}
// MARK: - QLPreviewControllerDataSource
extension EditViewController: QLPreviewControllerDataSource {
public func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
1
}
public func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
return fileURL! as QLPreviewItem
}
}
......@@ -9,9 +9,12 @@
import UIKit
public protocol FSPagerViewCellDelegate {
func delete(at: Int)
func preview(at: Int)
}
open class FSPagerViewCell: UICollectionViewCell {
var topLeftButton: UIButton!
var trashButton: UIButton!
var previewButton: UIButton!
open var delegate: FSPagerViewCellDelegate?
open var index: Int?
......@@ -44,20 +47,29 @@ open class FSPagerViewCell: UICollectionViewCell {
return _imageView
}
let imageView = UIImageView(frame: .zero)
imageView.layer.cornerRadius = 10
imageView.clipsToBounds = true
self.contentView.addSubview(imageView)
_imageView = imageView
let xPosition = ((self.contentView.bounds.width) - 50) / 2
let yPosition = (self.contentView.bounds.height) - 70
let xPosition = 0
let yPosition = (self.contentView.bounds.height) - 50
trashButton = UIButton(frame: CGRect(x: xPosition, y: Int(yPosition), width: 50, height: 50)) // Adjust frame as needed
self.contentView.addSubview(trashButton) // Add the button to the cell's contentView
trashButton.setImage(UIImage(systemName: "trash.fill"), for: .normal)
trashButton.addTarget(self, action: #selector(topLeftButtonTapped), for: .touchUpInside) // Set the button action
trashButton.tintColor = .red
topLeftButton = UIButton(frame: CGRect(x: xPosition, y: yPosition, width: 50, height: 50)) // Adjust frame as needed
self.contentView.addSubview(topLeftButton) // Add the button to the cell's contentView
topLeftButton.setImage(UIImage(systemName: "trash.fill"), for: .normal)
topLeftButton.addTarget(self, action: #selector(topLeftButtonTapped), for: .touchUpInside) // Set the button action
topLeftButton.tintColor = .red
topLeftButton.layer.cornerRadius = 25
topLeftButton.layer.borderColor = UIColor.red.cgColor
topLeftButton.layer.borderWidth = 2
let previewXPosition = self.contentView.bounds.width - 50
let previewYPosition = (self.contentView.bounds.height) - 50
previewButton = UIButton(frame: CGRect(x: Int(previewXPosition), y: Int(previewYPosition), width: 50, height: 50)) // Adjust frame as needed
self.contentView.addSubview(previewButton) // Add the button to the cell's contentView
previewButton.setImage(UIImage(systemName: "eye"), for: .normal)
previewButton.addTarget(self, action: #selector(imagePreview), for: .touchUpInside) // Set the button action
previewButton.tintColor = .red
return imageView
}
......@@ -130,6 +142,10 @@ open class FSPagerViewCell: UICollectionViewCell {
delegate?.delete(at: index ?? -1)
}
@objc func imagePreview() {
delegate?.preview(at: index ?? -1)
}
deinit {
if let textLabel = _textLabel {
textLabel.removeObserver(self, forKeyPath: "font", context: kvoContext)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment