[iphonex] [ios] Updated navigation control view layout.

This commit is contained in:
Ilya Grechuhin 2017-12-28 12:37:16 +03:00 committed by Roman Kuznetsov
parent c0c96f1b88
commit e954559a56
2 changed files with 46 additions and 29 deletions

View file

@ -88,10 +88,29 @@
</connections>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YYv-pG-Wkw" userLabel="Street name" customClass="NavigationStreetNameView" customModule="cm_dbg" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="1024" height="65.5"/>
<rect key="frame" x="0.0" y="0.0" width="1024" height="57.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WID-Um-Va6" userLabel="BackgroundView">
<rect key="frame" x="-100" y="-100" width="1224" height="157.5"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.shadowRadius">
<integer key="value" value="2"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="layer.shadowUIColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.23999999999999999" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="layer.shadowOpacity">
<integer key="value" value="1"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="size" keyPath="layer.shadowOffset">
<size key="value" width="0.0" height="1"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="600" verticalCompressionResistancePriority="600" text="Ленинградский проспект" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ShI-bz-5g8">
<rect key="frame" x="112" y="32" width="904" height="21.5"/>
<rect key="frame" x="112" y="24" width="904" height="21.5"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
</accessibility>
@ -103,31 +122,20 @@
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" notEnabled="YES"/>
</accessibility>
<constraints>
<constraint firstItem="ShI-bz-5g8" firstAttribute="top" secondItem="YYv-pG-Wkw" secondAttribute="top" constant="32" id="KK1-dA-hII"/>
<constraint firstAttribute="bottom" secondItem="WID-Um-Va6" secondAttribute="bottom" id="5ox-Cb-hJc"/>
<constraint firstItem="ShI-bz-5g8" firstAttribute="top" secondItem="YYv-pG-Wkw" secondAttribute="top" constant="24" id="KK1-dA-hII"/>
<constraint firstAttribute="trailing" secondItem="ShI-bz-5g8" secondAttribute="trailing" priority="999" constant="8" id="ZPY-xp-9Ew"/>
<constraint firstAttribute="trailing" secondItem="WID-Um-Va6" secondAttribute="trailing" constant="-100" id="f4N-aC-XO3"/>
<constraint firstItem="ShI-bz-5g8" firstAttribute="leading" secondItem="YYv-pG-Wkw" secondAttribute="leading" priority="300" constant="112" id="nVP-3U-KG2"/>
<constraint firstItem="WID-Um-Va6" firstAttribute="leading" secondItem="YYv-pG-Wkw" secondAttribute="leading" constant="-100" id="s8Q-4n-55U"/>
<constraint firstItem="WID-Um-Va6" firstAttribute="top" secondItem="YYv-pG-Wkw" secondAttribute="top" constant="-100" id="spZ-F3-yP2"/>
<constraint firstAttribute="bottom" secondItem="ShI-bz-5g8" secondAttribute="bottom" constant="12" id="w0r-Ip-f9E"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.shadowRadius">
<integer key="value" value="2"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="layer.shadowUIColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.23999999999999999" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="layer.shadowOpacity">
<integer key="value" value="1"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="size" keyPath="layer.shadowOffset">
<size key="value" width="0.0" height="1"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Aa6-N8-acP" userLabel="Turns" customClass="NavigationTurnsView" customModule="cm_dbg" customModuleProvider="target">
<rect key="frame" x="8" y="28" width="96" height="153"/>

View file

@ -54,11 +54,15 @@ final class NavigationControlView: SolidTouchView, MWMTextToSpeechObserver, MWMT
if isVisible {
addView()
} else {
dimBackground.setVisible(false, completion: {
self.removeFromSuperview()
})
removeView()
}
alpha = isVisible ? 0 : 1
DispatchQueue.main.async {
self.superview?.animateConstraints {
self.alpha = self.isVisible ? 1 : 0
self.hiddenConstraint.isActive = !self.isVisible
}
}
hiddenConstraint.isActive = !isVisible
}
}
@ -73,8 +77,8 @@ final class NavigationControlView: SolidTouchView, MWMTextToSpeechObserver, MWMT
dimBackground.setVisible(isExtended, completion: nil)
extendedView.isHidden = !isExtended
superview?.animateConstraints(animations: {
extendedConstraint.isActive = isExtended
superview!.animateConstraints(animations: {
self.extendedConstraint.isActive = self.isExtended
})
}
}
@ -97,7 +101,6 @@ final class NavigationControlView: SolidTouchView, MWMTextToSpeechObserver, MWMT
trailingAnchor.constraint(equalTo: tAnchor).isActive = true
hiddenConstraint = topAnchor.constraint(equalTo: ownerView.bottomAnchor)
hiddenConstraint.priority = UILayoutPriority.defaultHigh
hiddenConstraint.isActive = true
let visibleConstraint = progressView.bottomAnchor.constraint(equalTo: bAnchor)
@ -106,6 +109,14 @@ final class NavigationControlView: SolidTouchView, MWMTextToSpeechObserver, MWMT
extendedConstraint = bottomAnchor.constraint(equalTo: bAnchor)
extendedConstraint.priority = UILayoutPriority(rawValue: UILayoutPriority.RawValue(Int(UILayoutPriority.defaultHigh.rawValue) - 1))
ownerView.layoutIfNeeded()
}
private func removeView() {
dimBackground.setVisible(false, completion: {
self.removeFromSuperview()
})
}
override func mwm_refreshUI() {
@ -178,9 +189,7 @@ final class NavigationControlView: SolidTouchView, MWMTextToSpeechObserver, MWMT
speedWithLegend.append(NSAttributedString(string: info.speedUnits, attributes: routingLegendAttributes))
speedWithLegendLabel.attributedText = speedWithLegend
progressView.animateConstraints(animations: {
routingProgress.constant = progressView.width * info.progress / 100
})
self.routingProgress.constant = self.progressView.width * info.progress / 100
}
@IBAction