mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-26 09:33:25 +01:00
Remove the gear menu from the bottom of the sidebar. Animate in and out the refresh-status view (a la Mail).
This commit is contained in:
parent
21a5a00cd1
commit
51ef880d4f
@ -355,19 +355,19 @@
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="HZs-Zf-G8s" customClass="SidebarStatusBarView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="166" height="0.0"/>
|
||||
<rect key="frame" x="0.0" y="-28" width="166" height="28"/>
|
||||
<subviews>
|
||||
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="agw-l1-HkL">
|
||||
<rect key="frame" x="0.0" y="-3" width="166" height="5"/>
|
||||
<rect key="frame" x="0.0" y="25" width="166" height="5"/>
|
||||
</box>
|
||||
<progressIndicator hidden="YES" wantsLayer="YES" maxValue="100" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="y9c-Xf-2fS">
|
||||
<rect key="frame" x="20" y="-11" width="40" height="20"/>
|
||||
<rect key="frame" x="20" y="3" width="40" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="40" id="1Yw-ER-8pT"/>
|
||||
</constraints>
|
||||
</progressIndicator>
|
||||
<textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iyL-pW-cT6">
|
||||
<rect key="frame" x="62" y="-8" width="86" height="17"/>
|
||||
<rect key="frame" x="62" y="6" width="86" height="17"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="dVE-XG-mlU">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -383,10 +383,11 @@
|
||||
<constraint firstItem="iyL-pW-cT6" firstAttribute="leading" secondItem="y9c-Xf-2fS" secondAttribute="trailing" constant="4" id="TAM-VN-Syu"/>
|
||||
<constraint firstItem="y9c-Xf-2fS" firstAttribute="leading" secondItem="HZs-Zf-G8s" secondAttribute="leading" constant="20" symbolic="YES" id="TV9-iE-nuE"/>
|
||||
<constraint firstItem="agw-l1-HkL" firstAttribute="top" secondItem="HZs-Zf-G8s" secondAttribute="top" id="rBv-S6-j3b"/>
|
||||
<constraint firstAttribute="height" id="xOq-XX-qcd"/>
|
||||
<constraint firstAttribute="height" constant="28" id="xOq-XX-qcd"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="heightConstraint" destination="xOq-XX-qcd" id="wOf-xs-dFM"/>
|
||||
<outlet property="bottomConstraint" destination="UN9-Wa-uxb" id="SYv-ax-8md"/>
|
||||
<outlet property="heightConstraint" destination="xOq-XX-qcd" id="ktU-yd-g8x"/>
|
||||
<outlet property="progressIndicator" destination="y9c-Xf-2fS" id="gaf-6e-siu"/>
|
||||
<outlet property="progressLabel" destination="iyL-pW-cT6" id="Zpv-44-cfX"/>
|
||||
</connections>
|
||||
@ -396,7 +397,7 @@
|
||||
<constraint firstItem="HZs-Zf-G8s" firstAttribute="top" secondItem="cJj-Wv-9ep" secondAttribute="bottom" id="0Zg-oW-o7U"/>
|
||||
<constraint firstItem="cJj-Wv-9ep" firstAttribute="leading" secondItem="bJZ-bH-vgc" secondAttribute="leading" id="5Rs-9M-TKq"/>
|
||||
<constraint firstAttribute="trailing" secondItem="iyL-pW-cT6" secondAttribute="trailing" constant="20" id="Mnm-9S-Qpm"/>
|
||||
<constraint firstAttribute="bottom" secondItem="HZs-Zf-G8s" secondAttribute="bottom" id="UN9-Wa-uxb"/>
|
||||
<constraint firstAttribute="bottom" secondItem="HZs-Zf-G8s" secondAttribute="bottom" constant="-28" id="UN9-Wa-uxb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="HZs-Zf-G8s" secondAttribute="trailing" id="iNE-nb-QEB"/>
|
||||
<constraint firstItem="HZs-Zf-G8s" firstAttribute="leading" secondItem="bJZ-bH-vgc" secondAttribute="leading" id="tPp-xB-CgB"/>
|
||||
<constraint firstItem="cJj-Wv-9ep" firstAttribute="top" secondItem="bJZ-bH-vgc" secondAttribute="top" id="vAT-Wo-8fl"/>
|
||||
|
@ -16,14 +16,10 @@ final class SidebarStatusBarView: NSView {
|
||||
|
||||
@IBOutlet var progressIndicator: NSProgressIndicator!
|
||||
@IBOutlet var progressLabel: NSTextField!
|
||||
@IBOutlet var bottomConstraint: NSLayoutConstraint!
|
||||
@IBOutlet var heightConstraint: NSLayoutConstraint!
|
||||
|
||||
private var isAnimatingProgress = false {
|
||||
didSet {
|
||||
progressIndicator.isHidden = !isAnimatingProgress
|
||||
progressLabel.isHidden = !isAnimatingProgress
|
||||
}
|
||||
}
|
||||
|
||||
private var isAnimatingProgress = false
|
||||
|
||||
private var progress: CombinedRefreshProgress? = nil {
|
||||
didSet {
|
||||
@ -68,25 +64,26 @@ final class SidebarStatusBarView: NSView {
|
||||
private extension SidebarStatusBarView {
|
||||
|
||||
// MARK: Progress
|
||||
|
||||
|
||||
static let animationDuration = 0.2
|
||||
|
||||
func stopProgressIfNeeded() {
|
||||
|
||||
if !isAnimatingProgress {
|
||||
return
|
||||
}
|
||||
|
||||
isAnimatingProgress = false
|
||||
// progressIndicator.needsDisplay = true
|
||||
self.progressIndicator.stopAnimation(self)
|
||||
progressIndicator.isHidden = true
|
||||
progressLabel.isHidden = true
|
||||
|
||||
superview?.layoutSubtreeIfNeeded()
|
||||
|
||||
NSAnimationContext.runAnimationGroup({ (context) in
|
||||
context.duration = 0.2
|
||||
NSAnimationContext.runAnimationGroup{ (context) in
|
||||
context.duration = SidebarStatusBarView.animationDuration
|
||||
context.allowsImplicitAnimation = true
|
||||
heightConstraint.constant = 0
|
||||
bottomConstraint.constant = -(heightConstraint.constant)
|
||||
superview?.layoutSubtreeIfNeeded()
|
||||
}) {
|
||||
progressIndicator.stopAnimation(self)
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,8 +93,18 @@ private extension SidebarStatusBarView {
|
||||
return
|
||||
}
|
||||
isAnimatingProgress = true
|
||||
progressIndicator.isHidden = false
|
||||
progressLabel.isHidden = false
|
||||
progressIndicator.startAnimation(self)
|
||||
heightConstraint.constant = 28
|
||||
|
||||
superview?.layoutSubtreeIfNeeded()
|
||||
|
||||
NSAnimationContext.runAnimationGroup{ (context) in
|
||||
context.duration = SidebarStatusBarView.animationDuration
|
||||
context.allowsImplicitAnimation = true
|
||||
bottomConstraint.constant = 0
|
||||
superview?.layoutSubtreeIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
func updateProgressIndicator(_ progress: CombinedRefreshProgress) {
|
||||
@ -127,11 +134,8 @@ private extension SidebarStatusBarView {
|
||||
return
|
||||
}
|
||||
|
||||
let numberOfTasks = progress.numberOfTasks
|
||||
let numberCompleted = progress.numberCompleted
|
||||
|
||||
let formatString = NSLocalizedString("%@ of %@", comment: "Status bar progress")
|
||||
let s = NSString(format: formatString as NSString, NSNumber(value: numberCompleted), NSNumber(value: numberOfTasks))
|
||||
let s = NSString(format: formatString as NSString, NSNumber(value: progress.numberCompleted), NSNumber(value: progress.numberOfTasks))
|
||||
|
||||
progressLabel.stringValue = s as String
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user