diff --git a/iOS/MasterTimeline/Cell/MasterTimelineDefaultCellLayout.swift b/iOS/MasterTimeline/Cell/MasterTimelineDefaultCellLayout.swift index 62dfdf895..b1070a2eb 100644 --- a/iOS/MasterTimeline/Cell/MasterTimelineDefaultCellLayout.swift +++ b/iOS/MasterTimeline/Cell/MasterTimelineDefaultCellLayout.swift @@ -15,9 +15,11 @@ struct MasterTimelineDefaultCellLayout: MasterTimelineCellLayout { static let unreadCircleMarginLeft = CGFloat(integerLiteral: 0) static let unreadCircleDimension = CGFloat(integerLiteral: 12) + static let unreadCircleSize = CGSize(width: MasterTimelineDefaultCellLayout.unreadCircleDimension, height: MasterTimelineDefaultCellLayout.unreadCircleDimension) static let unreadCircleMarginRight = CGFloat(integerLiteral: 8) static let starDimension = CGFloat(integerLiteral: 16) + static let starSize = CGSize(width: MasterTimelineDefaultCellLayout.starDimension, height: MasterTimelineDefaultCellLayout.starDimension) static let avatarSize = CGSize(width: 48.0, height: 48.0) static let avatarMarginRight = CGFloat(integerLiteral: 8) diff --git a/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift b/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift index b512da4f8..7e55f3dfd 100644 --- a/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift +++ b/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift @@ -187,12 +187,30 @@ private extension MasterTimelineTableViewCell { } func updateUnreadIndicator() { - showOrHideView(unreadIndicatorView, cellData.read || cellData.starred) - unreadIndicatorView.setNeedsDisplay() + let hide = cellData.read || cellData.starred + self.unreadIndicatorView.isHidden = hide + self.unreadIndicatorView.frame.size = !hide ? CGSize.zero : MasterTimelineDefaultCellLayout.unreadCircleSize + UIView.animate( + withDuration: 0.5, + delay: 0.0, + usingSpringWithDamping: 0.5, + initialSpringVelocity: 0.2, + animations: { + self.unreadIndicatorView.frame.size = !hide ? MasterTimelineDefaultCellLayout.unreadCircleSize : CGSize.zero + }) } func updateStarView() { - showOrHideView(starView, !cellData.starred) + self.starView.isHidden = !self.cellData.starred + self.starView.frame.size = self.cellData.starred ? CGSize.zero : MasterTimelineDefaultCellLayout.starSize + UIView.animate( + withDuration: 0.5, + delay: 0.0, + usingSpringWithDamping: 0.5, + initialSpringVelocity: 0.2, + animations: { + self.starView.frame.size = self.cellData.starred ? MasterTimelineDefaultCellLayout.starSize : CGSize.zero + }) } func updateAvatar() { @@ -233,10 +251,6 @@ private extension MasterTimelineTableViewCell { } } - func showOrHideView(_ view: UIView, _ shouldHide: Bool) { - shouldHide ? hideView(view) : showView(view) - } - func updateSubviews() { updateTitleView() updateSummaryView()