Move filter buttons to the top right and the settings button to bottom left. Issue #1554

This commit is contained in:
Maurice Parker 2020-01-07 17:39:45 -07:00
parent 92cfbc767b
commit b5d1858fef
4 changed files with 42 additions and 31 deletions

View File

@ -65,12 +65,12 @@
</connections> </connections>
</tableView> </tableView>
<toolbarItems> <toolbarItems>
<barButtonItem image="line.horizontal.3.decrease.circle" catalog="system" id="Khk-Hd-iNS"/> <barButtonItem title="Item" image="gear" catalog="system" id="AK3-N5-4ke"/>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Kjl-Sb-QP1"/> <barButtonItem style="plain" systemItem="flexibleSpace" id="Kjl-Sb-QP1"/>
<barButtonItem systemItem="add" id="PVr-3K-nPg"/> <barButtonItem systemItem="add" id="PVr-3K-nPg"/>
</toolbarItems> </toolbarItems>
<navigationItem key="navigationItem" title="Feeds" largeTitleDisplayMode="never" id="lE1-xw-gjH"> <navigationItem key="navigationItem" title="Feeds" largeTitleDisplayMode="never" id="lE1-xw-gjH">
<barButtonItem key="leftBarButtonItem" title="Item" image="gear" catalog="system" id="AK3-N5-4ke"/> <barButtonItem key="rightBarButtonItem" image="line.horizontal.3.decrease.circle" catalog="system" id="Khk-Hd-iNS"/>
</navigationItem> </navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/> <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
</tableViewController> </tableViewController>

View File

@ -65,12 +65,12 @@
</connections> </connections>
</tableView> </tableView>
<toolbarItems> <toolbarItems>
<barButtonItem image="line.horizontal.3.decrease.circle" catalog="system" id="Khk-Hd-iNS"/> <barButtonItem title="Item" image="gear" catalog="system" id="AK3-N5-4ke"/>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Kjl-Sb-QP1"/> <barButtonItem style="plain" systemItem="flexibleSpace" id="Kjl-Sb-QP1"/>
<barButtonItem systemItem="add" id="PVr-3K-nPg"/> <barButtonItem systemItem="add" id="PVr-3K-nPg"/>
</toolbarItems> </toolbarItems>
<navigationItem key="navigationItem" title="Feeds" largeTitleDisplayMode="always" id="lE1-xw-gjH"> <navigationItem key="navigationItem" title="Feeds" largeTitleDisplayMode="always" id="lE1-xw-gjH">
<barButtonItem key="leftBarButtonItem" title="Item" image="gear" catalog="system" id="AK3-N5-4ke"/> <barButtonItem key="rightBarButtonItem" image="line.horizontal.3.decrease.circle" catalog="system" id="Khk-Hd-iNS"/>
</navigationItem> </navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/> <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
</tableViewController> </tableViewController>

View File

@ -119,12 +119,12 @@
</connections> </connections>
</tableView> </tableView>
<toolbarItems> <toolbarItems>
<barButtonItem image="line.horizontal.3.decrease.circle" catalog="system" id="af2-lj-EcA"> <barButtonItem title="Item" image="markAllAsRead" id="fTv-eX-72r">
<userDefinedRuntimeAttributes> <userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="FIlter Articles"/> <userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Mark All as Read"/>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
<connections> <connections>
<action selector="toggleFilter:" destination="Kyk-vK-QRX" id="jxP-b2-V1n"/> <action selector="markAllAsRead:" destination="Kyk-vK-QRX" id="4nd-Gg-APm"/>
</connections> </connections>
</barButtonItem> </barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="53V-wq-bat"/> <barButtonItem style="plain" systemItem="flexibleSpace" id="53V-wq-bat"/>
@ -139,12 +139,12 @@
</barButtonItem> </barButtonItem>
</toolbarItems> </toolbarItems>
<navigationItem key="navigationItem" title="Timeline" largeTitleDisplayMode="never" id="wcC-1L-ug4"> <navigationItem key="navigationItem" title="Timeline" largeTitleDisplayMode="never" id="wcC-1L-ug4">
<barButtonItem key="rightBarButtonItem" title="Item" image="markAllAsRead" id="fTv-eX-72r"> <barButtonItem key="rightBarButtonItem" image="line.horizontal.3.decrease.circle" catalog="system" id="af2-lj-EcA">
<userDefinedRuntimeAttributes> <userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Mark All as Read"/> <userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="FIlter Articles"/>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
<connections> <connections>
<action selector="markAllAsRead:" destination="Kyk-vK-QRX" id="4nd-Gg-APm"/> <action selector="toggleFilter:" destination="Kyk-vK-QRX" id="jxP-b2-V1n"/>
</connections> </connections>
</barButtonItem> </barButtonItem>
</navigationItem> </navigationItem>
@ -163,6 +163,7 @@
<!--Feeds--> <!--Feeds-->
<scene sceneID="smW-Zh-WAh"> <scene sceneID="smW-Zh-WAh">
<objects> <objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
<tableViewController storyboardIdentifier="MasterFeedViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterFeedViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController"> <tableViewController storyboardIdentifier="MasterFeedViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterFeedViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="r7i-6Z-zg0"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="r7i-6Z-zg0">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
@ -185,9 +186,8 @@
<outlet property="delegate" destination="7bK-jq-Zjz" id="RA6-mI-bju"/> <outlet property="delegate" destination="7bK-jq-Zjz" id="RA6-mI-bju"/>
</connections> </connections>
</tableView> </tableView>
<toolbarItems/> <toolbarItems>
<navigationItem key="navigationItem" title="Feeds" id="Zdf-7t-Un8"> <barButtonItem title="Settings" image="gear" catalog="system" id="TlU-Pg-ATe">
<barButtonItem key="leftBarButtonItem" title="Settings" image="gear" catalog="system" id="TlU-Pg-ATe">
<userDefinedRuntimeAttributes> <userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Settings"/> <userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Settings"/>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
@ -195,11 +195,34 @@
<action selector="settings:" destination="7bK-jq-Zjz" id="Y8a-lz-Im7"/> <action selector="settings:" destination="7bK-jq-Zjz" id="Y8a-lz-Im7"/>
</connections> </connections>
</barButtonItem> </barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Rbh-Vg-Wo8"/>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Vhj-bc-20A"/>
<barButtonItem systemItem="add" id="YFE-wd-vFC">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Add Item"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="add:" destination="7bK-jq-Zjz" id="d1n-0d-2gR"/>
</connections>
</barButtonItem>
</toolbarItems>
<navigationItem key="navigationItem" title="Feeds" id="Zdf-7t-Un8">
<barButtonItem key="rightBarButtonItem" image="line.horizontal.3.decrease.circle" catalog="system" id="9ro-XY-5xU">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Feeds Filter"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="toggleFilter:" destination="7bK-jq-Zjz" id="jmL-ei-avl"/>
</connections>
</barButtonItem>
</navigationItem> </navigationItem>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/> <simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/> <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="addNewItemButton" destination="YFE-wd-vFC" id="NMJ-uE-zGh"/>
<outlet property="filterButton" destination="9ro-XY-5xU" id="PSL-lE-ITK"/>
</connections>
</tableViewController> </tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="900" y="-759"/> <point key="canvasLocation" x="900" y="-759"/>
</scene> </scene>

View File

@ -14,9 +14,9 @@ import RSTree
class MasterFeedViewController: UITableViewController, UndoableCommandRunner { class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
private var filterButton: UIBarButtonItem! @IBOutlet weak var filterButton: UIBarButtonItem!
private var refreshProgressView: RefreshProgressView? private var refreshProgressView: RefreshProgressView?
private var addNewItemButton: UIBarButtonItem! @IBOutlet weak var addNewItemButton: UIBarButtonItem!
lazy var dataSource = makeDataSource() lazy var dataSource = makeDataSource()
var undoableCommands = [UndoableCommand]() var undoableCommands = [UndoableCommand]()
@ -400,7 +400,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
coordinator.showSettings() coordinator.showSettings()
} }
@objc func toggleFilter(_ sender: Any) { @IBAction func toggleFilter(_ sender: Any) {
if coordinator.isReadFeedsFiltered { if coordinator.isReadFeedsFiltered {
filterButton.image = AppAssets.filterInactiveImage filterButton.image = AppAssets.filterInactiveImage
coordinator.showAllFeeds() coordinator.showAllFeeds()
@ -410,7 +410,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
} }
} }
@objc func add(_ sender: UIBarButtonItem) { @IBAction func add(_ sender: UIBarButtonItem) {
coordinator.showAdd(.feed) coordinator.showAdd(.feed)
} }
@ -668,20 +668,8 @@ private extension MasterFeedViewController {
} }
self.refreshProgressView = refreshProgressView self.refreshProgressView = refreshProgressView
filterButton = UIBarButtonItem(image: AppAssets.filterInactiveImage, style: .plain, target: self, action: #selector(toggleFilter(_:)))
filterButton.accLabelText = NSLocalizedString("Filter Feeds", comment: "Filter Feeds")
let spaceItemButton1 = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
let refreshProgressItemButton = UIBarButtonItem(customView: refreshProgressView) let refreshProgressItemButton = UIBarButtonItem(customView: refreshProgressView)
let spaceItemButton2 = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) toolbarItems?.insert(refreshProgressItemButton, at: 2)
addNewItemButton = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(add(_:)))
setToolbarItems([filterButton,
spaceItemButton1,
refreshProgressItemButton,
spaceItemButton2,
addNewItemButton
], animated: false)
} }
func updateUI() { func updateUI() {