Fix vibrancy for new add web feed folder picker. Issue #1384

This commit is contained in:
Maurice Parker 2019-12-08 10:39:13 -07:00
parent a3dc787fb0
commit 4ad7cd7bdd
6 changed files with 107 additions and 7 deletions

View File

@ -228,6 +228,8 @@
51D5948722668EFA00DFC836 /* MarkStatusCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84702AA31FA27AC0006B8943 /* MarkStatusCommand.swift */; };
51D6A5BC23199C85001C27D8 /* MasterTimelineDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51D6A5BB23199C85001C27D8 /* MasterTimelineDataSource.swift */; };
51D87EE12311D34700E63F03 /* ActivityType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51D87EE02311D34700E63F03 /* ActivityType.swift */; };
51E36E71239D6610006F47A5 /* AddWebFeedSelectFolderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E36E70239D6610006F47A5 /* AddWebFeedSelectFolderTableViewCell.swift */; };
51E36E8C239D6765006F47A5 /* AddWebFeedSelectFolderTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 51E36E8B239D6765006F47A5 /* AddWebFeedSelectFolderTableViewCell.xib */; };
51E3EB33229AB02C00645299 /* ErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E3EB32229AB02C00645299 /* ErrorHandler.swift */; };
51E3EB3D229AB08300645299 /* ErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E3EB3C229AB08300645299 /* ErrorHandler.swift */; };
51E43962238037C400015C31 /* AddWebFeedFolderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E43961238037C400015C31 /* AddWebFeedFolderViewController.swift */; };
@ -1349,6 +1351,8 @@
51CE1C0A23622006005548FC /* RefreshProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshProgressView.swift; sourceTree = "<group>"; };
51D6A5BB23199C85001C27D8 /* MasterTimelineDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTimelineDataSource.swift; sourceTree = "<group>"; };
51D87EE02311D34700E63F03 /* ActivityType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityType.swift; sourceTree = "<group>"; };
51E36E70239D6610006F47A5 /* AddWebFeedSelectFolderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedSelectFolderTableViewCell.swift; sourceTree = "<group>"; };
51E36E8B239D6765006F47A5 /* AddWebFeedSelectFolderTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AddWebFeedSelectFolderTableViewCell.xib; sourceTree = "<group>"; };
51E3EB32229AB02C00645299 /* ErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorHandler.swift; sourceTree = "<group>"; };
51E3EB3C229AB08300645299 /* ErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorHandler.swift; sourceTree = "<group>"; };
51E43961238037C400015C31 /* AddWebFeedFolderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedFolderViewController.swift; sourceTree = "<group>"; };
@ -1969,6 +1973,8 @@
51C4528B2265095F00C03939 /* AddFolderViewController.swift */,
51C452842265093600C03939 /* AddWebFeedViewController.swift */,
51E43961238037C400015C31 /* AddWebFeedFolderViewController.swift */,
51E36E70239D6610006F47A5 /* AddWebFeedSelectFolderTableViewCell.swift */,
51E36E8B239D6765006F47A5 /* AddWebFeedSelectFolderTableViewCell.xib */,
51E4397F23805EBC00015C31 /* AddWebFeedFolderTableViewCell.swift */,
);
path = Add;
@ -3453,6 +3459,7 @@
51CE1C0923621EDA005548FC /* RefreshProgressView.xib in Resources */,
84C9FC9D2262A1A900D921D6 /* Assets.xcassets in Resources */,
514219582353C28900E07E2C /* main_ios.js in Resources */,
51E36E8C239D6765006F47A5 /* AddWebFeedSelectFolderTableViewCell.xib in Resources */,
51C452B82265178500C03939 /* styleSheet.css in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -3814,6 +3821,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
51E36E71239D6610006F47A5 /* AddWebFeedSelectFolderTableViewCell.swift in Sources */,
840D617F2029031C009BC708 /* AppDelegate.swift in Sources */,
51236339236915B100951F16 /* RoundedProgressView.swift in Sources */,
512E08E72268801200BDCFDD /* WebFeedTreeControllerDelegate.swift in Sources */,

View File

@ -18,7 +18,7 @@
<sections>
<tableViewSection id="3tl-Mb-Eno">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" rowHeight="44" id="lyJ-rf-8GA">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" rowHeight="44" id="lyJ-rf-8GA">
<rect key="frame" x="16" y="18" width="343" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="lyJ-rf-8GA" id="eNS-Rp-w0A">
@ -60,7 +60,7 @@
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="44" id="rlc-34-flT" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="44" id="rlc-34-flT">
<rect key="frame" x="16" y="106" width="343" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="rlc-34-flT" id="ZbC-Z6-dtq">
@ -108,7 +108,6 @@
</navigationItem>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
<connections>
<outlet property="folderLabel" destination="htg-Nn-3xi" id="IUG-O4-uw9"/>
<outlet property="nameTextField" destination="u7n-VL-Ho9" id="YQV-Xq-f9q"/>
<outlet property="urlTextField" destination="eRp-AP-WFq" id="FG3-pH-2Fh"/>
</connections>

View File

@ -8,9 +8,19 @@
import UIKit
class AddWebFeedFolderTableViewCell: UITableViewCell {
class AddWebFeedFolderTableViewCell: VibrantTableViewCell {
@IBOutlet weak var icon: UIImageView!
@IBOutlet weak var label: UILabel!
override func updateVibrancy(animated: Bool) {
super.updateVibrancy(animated: animated)
let iconTintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : AppAssets.secondaryAccentColor
UIView.animate(withDuration: duration(animated: animated)) {
self.icon.tintColor = iconTintColor
}
updateLabelVibrancy(label, color: labelColor, animated: animated)
}
}

View File

@ -0,0 +1,22 @@
//
// AddWebFeedSelectFolderTableViewCell.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 12/8/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import UIKit
class AddWebFeedSelectFolderTableViewCell: VibrantTableViewCell {
@IBOutlet weak var folderLabel: UILabel!
@IBOutlet weak var detailLabel: UILabel!
override func updateVibrancy(animated: Bool) {
super.updateVibrancy(animated: animated)
updateLabelVibrancy(folderLabel, color: labelColor, animated: animated)
updateLabelVibrancy(detailLabel, color: labelColor, animated: animated)
}
}

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15509"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="AddWebFeedSelectFolderTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="347" height="46"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Folder" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xCU-fd-wms">
<rect key="frame" x="16" y="12.5" width="49" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Detail" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jCz-VR-Elr">
<rect key="frame" x="287" y="12.5" width="44" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="xCU-fd-wms" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="KCG-KB-QVx"/>
<constraint firstItem="jCz-VR-Elr" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="ZEI-9G-SpU"/>
<constraint firstAttribute="trailing" secondItem="jCz-VR-Elr" secondAttribute="trailing" constant="16" id="rCo-rg-mRd"/>
<constraint firstItem="xCU-fd-wms" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="rZa-T7-Dy4"/>
<constraint firstItem="jCz-VR-Elr" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="xCU-fd-wms" secondAttribute="trailing" constant="8" id="yWW-mq-p2A"/>
</constraints>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<connections>
<outlet property="detailLabel" destination="jCz-VR-Elr" id="wsd-Pn-yBm"/>
<outlet property="folderLabel" destination="xCU-fd-wms" id="cae-UK-oeU"/>
</connections>
<point key="canvasLocation" x="56" y="-164"/>
</view>
</objects>
</document>

View File

@ -16,8 +16,8 @@ class AddWebFeedViewController: UITableViewController, AddContainerViewControlle
@IBOutlet private weak var urlTextField: UITextField!
@IBOutlet private weak var nameTextField: UITextField!
@IBOutlet private weak var folderLabel: UILabel!
private var folderLabel = ""
private var userCancelled = false
weak var delegate: AddContainerViewControllerChildDelegate?
@ -59,6 +59,8 @@ class AddWebFeedViewController: UITableViewController, AddContainerViewControlle
// I couldn't figure out the gap at the top of the UITableView, so I took a hammer to it.
tableView.contentInset = UIEdgeInsets(top: -28, left: 0, bottom: 0, right: 0)
tableView.register(UINib(nibName: "AddWebFeedSelectFolderTableViewCell", bundle: nil), forCellReuseIdentifier: "AddWebFeedSelectFolderTableViewCell")
NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: urlTextField)
}
@ -119,6 +121,16 @@ class AddWebFeedViewController: UITableViewController, AddContainerViewControlle
delegate?.readyToAdd(state: urlTextField.text?.rs_stringMayBeURL() ?? false)
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "AddWebFeedSelectFolderTableViewCell", for: indexPath) as? AddWebFeedSelectFolderTableViewCell
cell!.detailLabel.text = folderLabel
return cell!
} else {
return super.tableView(tableView, cellForRowAt: indexPath)
}
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 2 {
let navController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddWebFeedFolderNavViewController") as! UINavigationController
@ -159,10 +171,11 @@ private extension AddWebFeedViewController {
func updateFolderLabel() {
if let containerName = (container as? DisplayNameProvider)?.nameForDisplay {
if container is Folder {
folderLabel.text = "\(container?.account?.nameForDisplay ?? "") / \(containerName)"
folderLabel = "\(container?.account?.nameForDisplay ?? "") / \(containerName)"
} else {
folderLabel.text = containerName
}
folderLabel = containerName
}
tableView.reloadData()
}
}
}