Fahim/cw-filter #342
|
@ -31,7 +31,7 @@ class BaseStatusTableViewCell: UITableViewCell {
|
|||
@IBOutlet weak var usernameLabel: UILabel!
|
||||
@IBOutlet weak var metaIndicatorsView: StatusMetaIndicatorsView!
|
||||
@IBOutlet weak var contentWarningLabel: EmojiLabel!
|
||||
@IBOutlet weak var collapseButton: UIButton!
|
||||
@IBOutlet weak var collapseButton: StatusCollapseButton!
|
||||
@IBOutlet weak var contentTextView: StatusContentTextView!
|
||||
@IBOutlet weak var cardView: StatusCardView!
|
||||
@IBOutlet weak var attachmentsView: AttachmentsContainerView!
|
||||
|
@ -91,10 +91,7 @@ class BaseStatusTableViewCell: UITableViewCell {
|
|||
avatarImageView.addInteraction(UIDragInteraction(delegate: self))
|
||||
|
||||
attachmentsView.delegate = self
|
||||
|
||||
collapseButton.layer.masksToBounds = true
|
||||
collapseButton.layer.cornerRadius = 5
|
||||
|
||||
|
||||
accessibilityElements = [displayNameLabel!, contentWarningLabel!, collapseButton!, contentTextView!, attachmentsView!, pollView!]
|
||||
|
||||
moreButton.showsMenuAsPrimaryAction = true
|
||||
|
@ -188,6 +185,7 @@ class BaseStatusTableViewCell: UITableViewCell {
|
|||
state.collapsed = false
|
||||
}
|
||||
}
|
||||
collapseButton.title = statusState.reason
|
||||
collapsible = state.collapsible!
|
||||
setCollapsed(state.collapsed!, animated: false)
|
||||
}
|
||||
|
@ -360,40 +358,6 @@ class BaseStatusTableViewCell: UITableViewCell {
|
|||
pollView.isHidden = pollView.poll == nil || collapsed
|
||||
|
||||
let buttonImage = UIImage(systemName: collapsed ? "chevron.down" : "chevron.up")!
|
||||
|
||||
if let buttonImageView = collapseButton.imageView {
|
||||
collapseButton.setImage(buttonImage, for: .normal)
|
||||
|
||||
if animated {
|
||||
buttonImageView.layer.opacity = 0
|
||||
|
||||
// this whole hack is necessary because when just rotating buttonImageView, it moves to the left of the button and then animates back to the center
|
||||
let imageView = UIImageView(image: buttonImageView.image)
|
||||
imageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(imageView)
|
||||
NSLayoutConstraint.activate([
|
||||
imageView.widthAnchor.constraint(equalTo: buttonImageView.widthAnchor),
|
||||
imageView.heightAnchor.constraint(equalTo: buttonImageView.heightAnchor),
|
||||
imageView.centerXAnchor.constraint(equalTo: collapseButton.centerXAnchor),
|
||||
imageView.centerYAnchor.constraint(equalTo: collapseButton.centerYAnchor),
|
||||
])
|
||||
imageView.tintColor = .white
|
||||
|
||||
UIView.animate(withDuration: 0.3, delay: 0) {
|
||||
imageView.transform = CGAffineTransform(rotationAngle: .pi)
|
||||
} completion: { _ in
|
||||
imageView.removeFromSuperview()
|
||||
buttonImageView.layer.opacity = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if collapsed {
|
||||
collapseButton.accessibilityLabel = NSLocalizedString("Expand Status", comment: "expand status button accessibility label")
|
||||
} else {
|
||||
collapseButton.accessibilityLabel = NSLocalizedString("Collapse Status", comment: "collapse status button accessibility label")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IBAction func replyPressed() {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
import UIKit
|
||||
|
||||
class StatusCollapseButton: UIView {
|
||||
var action: (()->Void)!
|
||||
|
||||
var title: String {
|
||||
get {
|
||||
return lblTitle.text ?? ""
|
||||
|
@ -18,7 +20,6 @@ class StatusCollapseButton: UIView {
|
|||
}
|
||||
}
|
||||
|
||||
private var action: (()->Void)!
|
||||
private var lblTitle = UILabel()
|
||||
private var imgView = UIImageView()
|
||||
private var isCollapsed = true
|
||||
|
@ -35,6 +36,7 @@ class StatusCollapseButton: UIView {
|
|||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
setup()
|
||||
}
|
||||
|
||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
|
@ -52,8 +54,10 @@ class StatusCollapseButton: UIView {
|
|||
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
if isCollapsed {
|
||||
imgView.image = UIImage(systemName: "chevron.compact.up")
|
||||
accessibilityLabel = NSLocalizedString("Collapse Status", comment: "collapse status button accessibility label")
|
||||
} else {
|
||||
imgView.image = UIImage(systemName: "chevron.compact.down")
|
||||
accessibilityLabel = NSLocalizedString("Expand Status", comment: "expand status button accessibility label")
|
||||
}
|
||||
isCollapsed.toggle()
|
||||
action()
|
||||
|
@ -64,6 +68,7 @@ class StatusCollapseButton: UIView {
|
|||
self.isUserInteractionEnabled = true
|
||||
layer.cornerRadius = 8
|
||||
backgroundColor = .lightGray
|
||||
accessibilityLabel = NSLocalizedString("Expand Status", comment: "expand status button accessibility label")
|
||||
// Title
|
||||
lblTitle.translatesAutoresizingMaskIntoConstraints = false
|
||||
lblTitle.textColor = .white
|
||||
|
|
|
@ -83,6 +83,8 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
|||
]), size: 0)
|
||||
contentWarningLabel.adjustsFontForContentSizeCategory = true
|
||||
|
||||
collapseButton.action = collapseButtonPressed
|
||||
|
||||
contentTextView.defaultFont = UIFontMetrics.default.scaledFont(for: .systemFont(ofSize: 16))
|
||||
contentTextView.monospaceFont = UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 16, weight: .regular))
|
||||
contentTextView.adjustsFontForContentSizeCategory = true
|
||||
|
|
|
@ -103,28 +103,12 @@
|
|||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O0E-Vf-XYR" customClass="StatusCollapseButton" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="49" width="295" height="30"/>
|
||||
<color key="backgroundColor" systemColor="tintColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="z84-XW-gP3"/>
|
||||
</constraints>
|
||||
<color key="tintColor" systemColor="tintColor"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="chevron.down" catalog="system">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" scale="large"/>
|
||||
</state>
|
||||
<buttonConfiguration key="configuration" style="filled" image="chevron.down" catalog="system">
|
||||
<preferredSymbolConfiguration key="preferredSymbolConfigurationForImage" scale="large"/>
|
||||
<color key="baseForegroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</buttonConfiguration>
|
||||
<connections>
|
||||
<action selector="collapseButtonPressed" destination="BR5-ZS-LIo" eventType="touchUpInside" id="twO-rE-1pQ"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H6N-29-e66" customClass="StatusCollapseButton" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="49" width="295" height="50"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
</view>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" delaysContentTouches="NO" editable="NO" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="waJ-f5-LKv" customClass="StatusContentTextView" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="83" width="295" height="115.5"/>
|
||||
<rect key="frame" x="0.0" y="103" width="295" height="95.5"/>
|
||||
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
||||
<color key="textColor" systemColor="labelColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
|
@ -257,7 +241,7 @@
|
|||
<outlet property="attachmentsView" destination="nbq-yr-2mA" id="MAs-nv-cNN"/>
|
||||
<outlet property="avatarImageView" destination="QMP-j2-HLn" id="73F-6g-drx"/>
|
||||
<outlet property="cardView" destination="LKo-VB-XWl" id="Ypd-Cr-fie"/>
|
||||
<outlet property="collapseButton" destination="O0E-Vf-XYR" id="oTb-VA-JHD"/>
|
||||
<outlet property="collapseButton" destination="H6N-29-e66" id="fbP-GO-n7c"/>
|
||||
<outlet property="contentTextView" destination="waJ-f5-LKv" id="Tyd-9N-WxW"/>
|
||||
<outlet property="contentWarningLabel" destination="inI-Og-YiU" id="TmT-Fq-HVG"/>
|
||||
<outlet property="displayNameLabel" destination="gll-xe-FSr" id="dAN-AD-XMb"/>
|
||||
|
@ -278,7 +262,6 @@
|
|||
</objects>
|
||||
<resources>
|
||||
<image name="arrowshape.turn.up.left.fill" catalog="system" width="128" height="104"/>
|
||||
<image name="chevron.down" catalog="system" width="128" height="70"/>
|
||||
<image name="ellipsis" catalog="system" width="128" height="37"/>
|
||||
<image name="pin.fill" catalog="system" width="116" height="128"/>
|
||||
<image name="repeat" catalog="system" width="128" height="98"/>
|
||||
|
@ -295,8 +278,5 @@
|
|||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
<systemColor name="tintColor">
|
||||
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
Loading…
Reference in New Issue