Skip to content

Commit

Permalink
Recent file Ui update (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
anubhavpulkit authored Jul 6, 2020
1 parent f8c52a0 commit 9b51474
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ class FilesGridCollectionCell: FilesBaseCollectionCell {
nameLabel.text = recentFile.fileName
showFile()

if #available(iOS 13.0, *) {
nameLabel.textColor = UIColor.label
downloadIcon.tintColor = UIColor.label
moreButton.tintColor = UIColor.label
} else {
nameLabel.textColor = UIColor.white
downloadIcon.tintColor = UIColor.white
moreButton.tintColor = UIColor.white
}
setupArtWork(recentFile: recentFile, iconImageView: iconImageView)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ class FilesListCollectionViewCell: FilesBaseCollectionCell {
sizeModifiedLabel.text = "\(recentFile.fileDisplayText), \(recentFile.filesSize)"

setupArtWork(recentFile: recentFile, iconImageView: iconImageView)

if #available(iOS 13.0, *) {
nameLabel.textColor = UIColor.label
sizeModifiedLabel.textColor = UIColor.label
downloadIcon.tintColor = UIColor.label
moreButton.tintColor = UIColor.label
} else {
nameLabel.textColor = UIColor.white
sizeModifiedLabel.textColor = UIColor.white
downloadIcon.tintColor = UIColor.white
moreButton.tintColor = UIColor.white
}
}

func showDirectory(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ extension RecentFilesViewController: UICollectionViewDelegate, UICollectionViewD
}
shareAction.backgroundColor = #colorLiteral(red: 0.2704460415, green: 0.5734752943, blue: 1, alpha: 1)
shareAction.font = UIFont.systemFont(ofSize: 18, weight: .bold)
shareAction.textColor = .white
if #available(iOS 13.0, *) {
shareAction.textColor = .label
} else {
shareAction.textColor = .white
}
return [shareAction]
}else{
let state = checkFileOfflineState(recentFile)
Expand All @@ -103,15 +107,23 @@ extension RecentFilesViewController: UICollectionViewDelegate, UICollectionViewD

downloadAction.backgroundColor = #colorLiteral(red: 0.2172219259, green: 0.7408193211, blue: 0.1805167178, alpha: 1)
downloadAction.font = UIFont.systemFont(ofSize: 18, weight: .bold)
downloadAction.textColor = .white
if #available(iOS 13.0, *) {
downloadAction.textColor = .label
} else {
downloadAction.textColor = .white
}
return [downloadAction]
}else if state == .downloaded{
let removeDownloadAction = SwipeAction(style: .default, title: "Remove Download") { (action, indexPath) in
self.removeOfflineFile(indexPath: indexPath)
}

removeDownloadAction.backgroundColor = #colorLiteral(red: 0.9490196078, green: 0.1215686275, blue: 0.1882352941, alpha: 1)
removeDownloadAction.textColor = .white
if #available(iOS 13.0, *) {
removeDownloadAction.textColor = .label
} else {
removeDownloadAction.textColor = .white
}
removeDownloadAction.font = UIFont.systemFont(ofSize: 18, weight: .bold)
return [removeDownloadAction]
}else if state == .downloading{
Expand All @@ -122,7 +134,11 @@ extension RecentFilesViewController: UICollectionViewDelegate, UICollectionViewD
}

cancelDownloadAction.backgroundColor = #colorLiteral(red: 0.9490196078, green: 0.1215686275, blue: 0.1882352941, alpha: 1)
cancelDownloadAction.textColor = .white
if #available(iOS 13.0, *) {
cancelDownloadAction.textColor = .label
} else {
cancelDownloadAction.textColor = .white
}
cancelDownloadAction.font = UIFont.systemFont(ofSize: 18, weight: .bold)
return [cancelDownloadAction]
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ extension RecentFilesViewController{
downloadImageView?.setAnchorSize(width: 80, height: 80)

progressView = UIProgressView(progressViewStyle: .bar)
progressView?.trackTintColor = .white
if #available(iOS 13.0, *) {
progressView?.trackTintColor = .label
} else {
progressView?.trackTintColor = .white
}
progressView?.setProgress(0.0, animated: true)
progressView?.setAnchorSize(width: nil, height: 2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class RecentFilesViewController: BaseUIViewController {
super.viewDidLoad()
setupNotifications()

if #available(iOS 13.0, *) {
self.view.backgroundColor = UIColor.secondarySystemBackground
searchBar.searchTextField.tintColor = UIColor.label
searchBar.searchTextField.textColor = UIColor.label
} else {
self.view.backgroundColor = UIColor(named: "formal")
}
let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress))
filesCollectionView.addGestureRecognizer(longPressGesture)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,6 @@
</connections>
</searchBar>
</subviews>
<color key="backgroundColor" red="0.12156862745098039" green="0.12941176470588234" blue="0.14117647058823529" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="Bh1-zs-yY6" firstAttribute="leading" secondItem="Y6Y-Pz-rkA" secondAttribute="leading" constant="8" id="Fr4-YF-PNY"/>
<constraint firstItem="UYa-o9-baz" firstAttribute="trailing" secondItem="tLj-rv-YNE" secondAttribute="trailing" constant="4" id="J1C-1n-wuT"/>
Expand Down Expand Up @@ -1789,10 +1788,10 @@
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translucent="NO" id="q0O-wS-iVn">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="barTintColor" red="0.090196078431372548" green="0.10196078431372549" blue="0.10980392156862745" alpha="1" colorSpace="calibratedRGB"/>
<color key="tintColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="barTintColor" name="tabBarBackground"/>
<textAttributes key="titleTextAttributes">
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="textColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</textAttributes>
</navigationBar>
<nil name="viewControllers"/>
Expand Down

0 comments on commit 9b51474

Please sign in to comment.