Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radio history #12

Merged
merged 11 commits into from
Nov 8, 2021
Prev Previous commit
Next Next commit
Some final adjustments with new radio view layout
  • Loading branch information
sitomani committed Oct 27, 2021
commit fe16dc75a1054064c05c9fc5ad67ae301f89bcd5
4 changes: 2 additions & 2 deletions 4champ/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
setupAVSession()
cleanupFiles()
// UNCOMMENT BELOW TWO LINES TO TEST LOCAL NOTIFICATIONS
settings.prevCollectionSize = 0
settings.newestPlayed = 152890
// settings.prevCollectionSize = 0
// settings.newestPlayed = 152890

updateLatest()
UIApplication.shared.beginReceivingRemoteControlEvents()
Expand Down
6 changes: 3 additions & 3 deletions 4champ/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" alpha="0.5" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="In this session" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xOC-w0-98Y">
<rect key="frame" x="20" y="221" width="335" height="16"/>
<rect key="frame" x="20" y="219" width="335" height="16"/>
<fontDescription key="fontDescription" name="DINAlternate-Bold" family="DIN Alternate" pointSize="13"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -232,7 +232,7 @@
<constraint firstItem="PQr-Ze-W5v" firstAttribute="trailing" secondItem="YZW-HR-7AL" secondAttribute="trailing" constant="10" id="VeX-Mh-tp5"/>
<constraint firstItem="xOC-w0-98Y" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" constant="20" id="Wc0-En-mfq"/>
<constraint firstItem="PQr-Ze-W5v" firstAttribute="trailing" secondItem="QUj-fw-iU8" secondAttribute="trailing" constant="74" id="XHa-uh-TaM"/>
<constraint firstItem="xOC-w0-98Y" firstAttribute="top" secondItem="RQm-Tf-BLL" secondAttribute="bottom" constant="4" id="buj-Jc-cVx"/>
<constraint firstItem="xOC-w0-98Y" firstAttribute="top" secondItem="RQm-Tf-BLL" secondAttribute="bottom" constant="2" id="buj-Jc-cVx"/>
<constraint firstItem="TVg-ts-xlz" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" constant="20" id="cVD-Fa-67C"/>
<constraint firstItem="YZW-HR-7AL" firstAttribute="top" secondItem="PQr-Ze-W5v" secondAttribute="top" constant="9" id="eaS-8A-lRx"/>
<constraint firstItem="zEe-nb-Fcg" firstAttribute="top" secondItem="F68-Dd-9Qo" secondAttribute="bottom" constant="2" id="jfW-yn-67d"/>
Expand All @@ -243,7 +243,7 @@
<constraint firstItem="RQm-Tf-BLL" firstAttribute="top" secondItem="Ac5-pb-fyE" secondAttribute="bottom" constant="4" id="sz2-Ap-mMN"/>
<constraint firstItem="F68-Dd-9Qo" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" constant="20" id="twK-CW-5rG"/>
<constraint firstItem="RQm-Tf-BLL" firstAttribute="top" secondItem="TVg-ts-xlz" secondAttribute="bottom" constant="8" id="ucR-wn-bN9"/>
<constraint firstItem="F68-Dd-9Qo" firstAttribute="top" secondItem="xOC-w0-98Y" secondAttribute="bottom" id="ucy-9c-rkQ"/>
<constraint firstItem="F68-Dd-9Qo" firstAttribute="top" secondItem="xOC-w0-98Y" secondAttribute="bottom" constant="2" id="ucy-9c-rkQ"/>
<constraint firstItem="YZW-HR-7AL" firstAttribute="leading" secondItem="qcG-Wi-evM" secondAttribute="trailing" constant="10" id="ue5-Lv-IBl"/>
<constraint firstItem="zEe-nb-Fcg" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" id="yZi-LK-Ymc"/>
</constraints>
Expand Down
2 changes: 1 addition & 1 deletion 4champ/Scenes/Radio/RadioSessionCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RadioSessionCell: UITableViewCell {
moduleTitle.font = fnt

let separatorView = UIView.init(frame: .zero)
separatorView.backgroundColor = UIColor.white.withAlphaComponent(0.1)
separatorView.backgroundColor = Appearance.radioSeparatorColor
separatorView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(separatorView)
contentView.addSubview(moduleTitle);
Expand Down
13 changes: 10 additions & 3 deletions 4champ/Scenes/Radio/RadioViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class RadioViewController: UIViewController, RadioDisplayLogic
@IBOutlet weak var prevButton: UIButton?
@IBOutlet weak var nextButton: UIButton?

@IBOutlet weak var tableDivider: UIView? // view between table currentModuleView
@IBOutlet weak var radioTable: UITableView?
@IBOutlet weak var tableBottomConstraint: NSLayoutConstraint?

Expand Down Expand Up @@ -137,7 +138,8 @@ class RadioViewController: UIViewController, RadioDisplayLogic
radioTable?.delegate = self
radioTable?.separatorStyle = .none
radioTable?.register(RadioSessionCell.self, forCellReuseIdentifier: RadioSessionCell.ReuseId)

tableDivider?.backgroundColor = Appearance.radioSeparatorColor

setupGradientBackground()

let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(longPressed(sender:)))
Expand All @@ -156,6 +158,11 @@ class RadioViewController: UIViewController, RadioDisplayLogic
}
}

override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
gradientLayer.frame = CGRect.init(x: 0, y: 0, width: view.frame.width, height: currentModuleView?.frame.height ?? 100)
}

@objc func notificationsPressed(sender: UINavigationItem) {
interactor?.requestLocalNotifications()
}
Expand All @@ -178,13 +185,13 @@ class RadioViewController: UIViewController, RadioDisplayLogic
gradientLayer.removeAnimation(forKey: GradientAnimationDirection.in.rawValue)
gradientLayer.removeAnimation(forKey: GradientAnimationDirection.out.rawValue)

let startAlphas: [CGFloat] = direction == .in ? [0, 0] : [1,0.2]
let startAlphas: [CGFloat] = direction == .in ? [0, 0] : [1,0.4]
gradientLayer.colors = [gradientColorTop.withAlphaComponent(startAlphas[0]).cgColor, gradientColorBottom.withAlphaComponent(startAlphas[1]).cgColor]

let gradientChangeAnimation = CABasicAnimation(keyPath: "colors")
gradientChangeAnimation.duration = 0.5

let endAlphas: [CGFloat] = direction == .in ? [1, 0.2] : [0,0]
let endAlphas: [CGFloat] = direction == .in ? [1, 0.4] : [0,0]

gradientChangeAnimation.toValue = [
gradientColorTop.withAlphaComponent(endAlphas[0]).cgColor,
Expand Down