Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixes to the Cliqz History Panel

  • Loading branch information
Tim Palade authored and mahmoud-adam85 committed May 11, 2018
1 parent 9e3803d commit bd6fabb3315cd14cb5ede7c96a0a4f8ffa28fc4d
@@ -101,8 +101,11 @@ class HistoryPanel: SiteTableViewController, HomePanel {
syncDetailText = ""
}
}


/*Cliqz
@objc fileprivate func longPress(_ longPressGestureRecognizer: UILongPressGestureRecognizer) {
*/
@objc func longPress(_ longPressGestureRecognizer: UILongPressGestureRecognizer) {
guard longPressGestureRecognizer.state == .began else { return }
let touchPoint = longPressGestureRecognizer.location(in: tableView)
guard let indexPath = tableView.indexPathForRow(at: touchPoint) else { return }
@@ -284,8 +287,10 @@ class HistoryPanel: SiteTableViewController, HomePanel {
}
}
}

/* Cliqz
fileprivate func siteForIndexPath(_ indexPath: IndexPath) -> Site? {
*/
func siteForIndexPath(_ indexPath: IndexPath) -> Site? {
let offset = self.categories[sectionLookup[indexPath.section]!].offset
return data[indexPath.row + offset]
}
@@ -26,7 +26,11 @@ class CliqzHistoryPanel: HistoryPanel {
}

override func numberOfSectionsInTableView(_ tableView: UITableView) -> Int {
return 1
var count = 0
for category in self.categories where category.rows > 0 {
count += 1
}
return count
}

override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
@@ -37,13 +41,14 @@ class CliqzHistoryPanel: HistoryPanel {

//setup
label.text = self.tableView(tableView, titleForHeaderInSection: section)
label.font = UIFont.boldSystemFont(ofSize: 14)
label.font = UIFont.systemFont(ofSize: 14)
label.textColor = UIColor.darkText

bubble.addSubview(label)
container.addSubview(bubble)

//styling
bubble.backgroundColor = UIColor.white
bubble.backgroundColor = UIColor.white.withAlphaComponent(0.9)
bubble.layer.cornerRadius = 10


@@ -130,7 +135,7 @@ class CliqzHistoryPanel: HistoryPanel {
}


fileprivate func siteForIndexPath(_ indexPath: IndexPath) -> Site? {
override func siteForIndexPath(_ indexPath: IndexPath) -> Site? {
let section = trueSection(section: indexPath.section)
let offset = self.categories[sectionLookup[section]!].offset
return data[indexPath.row + offset]
@@ -139,6 +144,22 @@ class CliqzHistoryPanel: HistoryPanel {
fileprivate func trueSection(section: Int) -> Int {
return section + 1
}

override func updateNumberOfSyncedDevices(_ count: Int?) {
return
}

override func updateSyncedDevicesCount() -> Success {
return succeed()
}

@objc override func longPress(_ longPressGestureRecognizer: UILongPressGestureRecognizer) {
guard longPressGestureRecognizer.state == .began else { return }
let touchPoint = longPressGestureRecognizer.location(in: tableView)
guard let indexPath = tableView.indexPathForRow(at: touchPoint) else { return }

presentContextMenu(for: indexPath)
}
}

class CliqzSiteTableViewCell: SiteTableViewCell {
@@ -149,30 +170,17 @@ class CliqzSiteTableViewCell: SiteTableViewCell {

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
_textLabel.textColor = .white
_textLabel.font = UIFont.boldSystemFont(ofSize: 16)
_textLabel.layer.shadowColor = UIColor.black.cgColor
_textLabel.layer.shadowOpacity = 0.5
_textLabel.layer.shadowRadius = 0.5
_textLabel.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)

_detailTextLabel.textColor = .white
_detailTextLabel.font = UIFont.systemFont(ofSize: 14, weight: UIFontWeightMedium)
_detailTextLabel.layer.shadowColor = UIColor.black.cgColor
_detailTextLabel.layer.shadowOpacity = 0.5
_detailTextLabel.layer.shadowRadius = 0.5
_detailTextLabel.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)

separatorInset = UIEdgeInsets(top: 0, left: CliqzHistoryPanelUX.separatorLeftInset, bottom: 0, right: 0)
contentView.addSubview(customImageView)
contentView.addSubview(imageShadowView)
setupImageShadow()

customImageView.layer.cornerRadius = CliqzHistoryPanelUX.iconCornerRadius
customImageView.clipsToBounds = true

contentView.addSubview(imageShadowView)
setupImageShadow()
setUpLabels()
}


override func updateConstraints() {

customImageView.snp.remakeConstraints { (make) in
@@ -206,6 +214,7 @@ class CliqzSiteTableViewCell: SiteTableViewCell {
super.prepareForReuse()
separatorInset = UIEdgeInsets(top: 0, left: CliqzHistoryPanelUX.separatorLeftInset, bottom: 0, right: 0)
setupImageShadow()
setUpLabels()
fakeView = nil
}

@@ -241,6 +250,23 @@ class CliqzSiteTableViewCell: SiteTableViewCell {
imageShadowView.layer.shadowRadius = 0.5
imageShadowView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
}

private func setUpLabels() {

_textLabel.textColor = .white
_textLabel.font = UIFont.boldSystemFont(ofSize: 16)
_textLabel.layer.shadowColor = UIColor.black.cgColor
_textLabel.layer.shadowOpacity = 0.5
_textLabel.layer.shadowRadius = 0.5
_textLabel.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)

_detailTextLabel.textColor = .white
_detailTextLabel.font = UIFont.systemFont(ofSize: 14, weight: UIFontWeightMedium)
_detailTextLabel.layer.shadowColor = UIColor.black.cgColor
_detailTextLabel.layer.shadowOpacity = 0.5
_detailTextLabel.layer.shadowRadius = 0.5
_detailTextLabel.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
}
}

extension Array {
@@ -113,7 +113,7 @@ class CliqzHomePanelViewController: UIViewController, UITextFieldDelegate {
}

func setBackgroundImage() {
backgroundView.image = UIImage.cliqzBackgroundImage()
backgroundView.image = UIImage.cliqzBackgroundImage()//?.applyBlur(withRadius: 5, blurType: BOXFILTER, tintColor: UIColor.black.withAlphaComponent(0.1), saturationDeltaFactor: 1.8, maskImage: nil)
}

}

0 comments on commit bd6fabb

Please sign in to comment.