Add + Update screen : PlayMusic
This commit is contained in:
@@ -5,6 +5,7 @@ import ContainerControllerSwift
|
||||
|
||||
extension PlaylistOneItem {
|
||||
struct State {
|
||||
var type: ViewCallsPlayerType = .none
|
||||
var firstImage: UIImage?
|
||||
var subtitleText: String?
|
||||
var text2: String?
|
||||
@@ -12,7 +13,8 @@ extension PlaylistOneItem {
|
||||
var handlers: Handlers = .init()
|
||||
}
|
||||
struct Handlers {
|
||||
var onClickAt: (()->(Void))?
|
||||
|
||||
var onClickAt: ((_ selType: ViewCallsPlayerType)->(Void))?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,25 +69,59 @@ class PlaylistOneCell: TableAdapterCell {
|
||||
@IBOutlet private weak var label3: UILabel?
|
||||
|
||||
@IBOutlet override var selectedView: UIView? { didSet { } }
|
||||
@IBOutlet var cardView: UIView?
|
||||
@IBOutlet var ccardView: UIView?
|
||||
@IBOutlet var button: UIButton?
|
||||
|
||||
override func awakeFromNib() {
|
||||
separator(hide: true)
|
||||
button?.tapHideAnimation(
|
||||
view: cardView,
|
||||
type: .alpha(0.5),
|
||||
callback: { [weak self] type in
|
||||
if type == .touchUpInside {
|
||||
self?.data?.state.handlers.onClickAt?()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
button?.tapClassic({ [weak self] down in
|
||||
UIView.animate(withDuration: down ? 0.0 : 0.35) {
|
||||
self?.ccardView?.alpha = down ? 0.2 : 0.0
|
||||
}
|
||||
if !down {
|
||||
|
||||
if let playerType = self?.data?.state.type {
|
||||
self?.data?.state.handlers.onClickAt?(playerType)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// button?.tapHideAnimation(
|
||||
// view: cardView,
|
||||
// type: .alpha(0.5),
|
||||
// callback: { [weak self] type in
|
||||
// if type == .touchUpInside {
|
||||
// self?.data?.state.handlers.onClickAt?()
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? PlaylistOneCellData else { return }
|
||||
self.data = data
|
||||
|
||||
|
||||
if let playerType = self.data?.state.type {
|
||||
|
||||
|
||||
let firstImage = ViewCallsPlayer.getImage( playerType)
|
||||
let subtitleText = ViewCallsPlayer.getTitle( playerType)
|
||||
let text2 = ViewCallsPlayer.getSubtitle( playerType)
|
||||
let text3 = "4:10"
|
||||
|
||||
self.data?.state.firstImage = firstImage
|
||||
self.data?.state.subtitleText = subtitleText
|
||||
self.data?.state.text2 = text2
|
||||
self.data?.state.text3 = text3
|
||||
|
||||
firstImageView?.image = firstImage
|
||||
subtitleLabel?.text = subtitleText
|
||||
label2?.text = text2
|
||||
label3?.text = text3
|
||||
}
|
||||
|
||||
firstImageView?.image = data.state.firstImage
|
||||
subtitleLabel?.text = data.state.subtitleText
|
||||
label2?.text = data.state.text2
|
||||
|
||||
@@ -52,14 +52,16 @@
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="11"/>
|
||||
<color key="textColor" red="0.5058823823928833" green="0.50980395078659058" blue="0.54117649793624878" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="4:10" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="100" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SGp-y5-hcF" userLabel="4:10">
|
||||
<rect key="frame" x="268" y="23" width="35" height="27"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="4:10" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="100" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SGp-y5-hcF" userLabel="4:10">
|
||||
<rect key="frame" x="278" y="18.5" width="25" height="27"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="27" id="ZUN-H6-WEO"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="11"/>
|
||||
<color key="textColor" red="0.5058823823928833" green="0.50980395078659058" blue="0.54117649793624878" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</label>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5rF-eA-GVk" userLabel="Frame 89512">
|
||||
<rect key="frame" x="317" y="16" width="29" height="30"/>
|
||||
<rect key="frame" x="317" y="18" width="29" height="30"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" alpha="0.5" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="iconPlaylistMore" translatesAutoresizingMaskIntoConstraints="NO" id="dZ0-Sj-4nm">
|
||||
<rect key="frame" x="0.0" y="0.0" width="29" height="30"/>
|
||||
@@ -74,17 +76,31 @@
|
||||
<constraint firstAttribute="height" constant="30" id="wZE-a8-FLj"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7ZZ-NP-3X2">
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="u2E-Di-Nkd" userLabel=" PlaylistOne">
|
||||
<rect key="frame" x="0.0" y="0.0" width="373" height="64"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7ZZ-NP-3X2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="373" height="64"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="SGp-y5-hcF" firstAttribute="centerY" secondItem="5w9-4X-Ppe" secondAttribute="centerY" id="27B-9z-Jn4"/>
|
||||
<constraint firstItem="7ZZ-NP-3X2" firstAttribute="top" secondItem="5w9-4X-Ppe" secondAttribute="top" id="CvJ-IP-NMI"/>
|
||||
<constraint firstItem="7ZZ-NP-3X2" firstAttribute="leading" secondItem="5w9-4X-Ppe" secondAttribute="leading" id="DWP-eL-saq"/>
|
||||
<constraint firstItem="n3f-vv-0Pt" firstAttribute="leading" secondItem="5w9-4X-Ppe" secondAttribute="leading" constant="28" id="GqR-Xj-dfG"/>
|
||||
<constraint firstItem="5rF-eA-GVk" firstAttribute="centerY" secondItem="5w9-4X-Ppe" secondAttribute="centerY" constant="1" id="JcS-cn-sXs"/>
|
||||
<constraint firstAttribute="trailing" secondItem="u2E-Di-Nkd" secondAttribute="trailing" id="KBv-lU-uAs"/>
|
||||
<constraint firstItem="u2E-Di-Nkd" firstAttribute="top" secondItem="5w9-4X-Ppe" secondAttribute="top" id="Pb3-tk-DC0"/>
|
||||
<constraint firstItem="n3f-vv-0Pt" firstAttribute="top" secondItem="5w9-4X-Ppe" secondAttribute="top" constant="5" id="R9R-bp-Gya"/>
|
||||
<constraint firstItem="5rF-eA-GVk" firstAttribute="top" secondItem="5w9-4X-Ppe" secondAttribute="top" constant="16" id="UAs-FD-Pf3"/>
|
||||
<constraint firstAttribute="bottom" secondItem="u2E-Di-Nkd" secondAttribute="bottom" id="UpY-xb-MzF"/>
|
||||
<constraint firstItem="u2E-Di-Nkd" firstAttribute="leading" secondItem="5w9-4X-Ppe" secondAttribute="leading" id="phW-la-eQB"/>
|
||||
<constraint firstItem="5rF-eA-GVk" firstAttribute="leading" secondItem="SGp-y5-hcF" secondAttribute="trailing" constant="14" id="qdX-oO-EpJ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="5rF-eA-GVk" secondAttribute="trailing" constant="27" id="tyX-bu-UHb"/>
|
||||
<constraint firstItem="SGp-y5-hcF" firstAttribute="centerY" secondItem="5w9-4X-Ppe" secondAttribute="centerY" id="vtD-ck-Uci"/>
|
||||
<constraint firstAttribute="bottom" secondItem="7ZZ-NP-3X2" secondAttribute="bottom" id="xK5-Lj-RdW"/>
|
||||
<constraint firstAttribute="trailing" secondItem="7ZZ-NP-3X2" secondAttribute="trailing" id="yD7-3E-dIM"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
@@ -98,11 +114,13 @@
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<outlet property="button" destination="7ZZ-NP-3X2" id="OGz-mW-LLN"/>
|
||||
<outlet property="ccardView" destination="u2E-Di-Nkd" id="81e-Gs-J50"/>
|
||||
<outlet property="firstImageView" destination="tPe-B9-pZV" id="ubZ-Nb-grU"/>
|
||||
<outlet property="label2" destination="XLd-DB-Fl7" id="ogN-5J-dup"/>
|
||||
<outlet property="label3" destination="SGp-y5-hcF" id="U9E-29-q3U"/>
|
||||
<outlet property="subtitleLabel" destination="0eD-dL-Ugw" id="r4k-Md-cEY"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-100" y="-49"/>
|
||||
<point key="canvasLocation" x="-100" y="-49.475262368815599"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
|
||||
+2
-2
@@ -11,11 +11,11 @@
|
||||
<scene sceneID="SDB-mK-l0T">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="PlaylistViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="azT-09-ln3" customClass="PlaylistViewController" customModule="ContainerController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="kPA-uf-PXN">
|
||||
<view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="kPA-uf-PXN">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="qSd-FA-5ZQ" customClass="TableAdapterView" customModule="ContainerControllerSwift">
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="qSd-FA-5ZQ" customClass="TableAdapterView" customModule="ContainerControllerSwift">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<color key="backgroundColor" red="0.93725490196078431" green="0.94901960784313721" blue="0.96078431372549022" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</tableView>
|
||||
|
||||
+121
-46
@@ -7,17 +7,25 @@ class PlaylistViewController: StoryboardController {
|
||||
@IBOutlet var imgViewH: NSLayoutConstraint!
|
||||
@IBOutlet var imgViewW: NSLayoutConstraint!
|
||||
@IBOutlet var imgViewY: NSLayoutConstraint!
|
||||
|
||||
@IBOutlet weak var tableView: TableAdapterView!
|
||||
var containers: [ContainerController] = []
|
||||
|
||||
var footerView: PlaylistFooterPlayView?
|
||||
|
||||
var containerTableView: TableAdapterView?
|
||||
var container: ContainerController?
|
||||
|
||||
var container2TableView: TableAdapterView?
|
||||
var container2: ContainerController?
|
||||
|
||||
var hideFooterView: PlaylistFooterPlayView?
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
self.navBarHide = true
|
||||
|
||||
let color1 = #colorLiteral(red: 0.1273144384, green: 0.1311024159, blue: 0.1562976594, alpha: 1)
|
||||
let color1 = #colorLiteral(red: 0.1254901961, green: 0.1294117647, blue: 0.1568627451, alpha: 1)
|
||||
|
||||
title = "Playlist"
|
||||
view.backgroundColor = color1
|
||||
@@ -43,23 +51,64 @@ class PlaylistViewController: StoryboardController {
|
||||
// titleView2.frame = CGRect(x: 0, y: 0, width: ScreenSize.width, height: 162)
|
||||
// view.addSubview(titleView2)
|
||||
|
||||
|
||||
addContainerr(position: .init(top: 50, middle: 310, bottom: 100))
|
||||
|
||||
self.container?.move(type: .middle)
|
||||
|
||||
main(delay: 0.5) {
|
||||
self.container?.move(type: .middle )
|
||||
}
|
||||
|
||||
|
||||
|
||||
// var items2: [TableAdapterItem] = []
|
||||
// items2.append( PlayMusicItItem(state: .init(handlers: .init(
|
||||
// onPlayAt: { play in
|
||||
//
|
||||
// }, onFastForwardAt: { type in
|
||||
//
|
||||
// }, onMoreAt: {
|
||||
//
|
||||
// }, onBottomAllAt: {
|
||||
//
|
||||
// }))) )
|
||||
// let header2 = PlayMusicItGribView()
|
||||
//
|
||||
// let ccc2 = addContainer(position: .init(top: 0, bottom: 98), radius: 0, items: items2, delegate: self, addBackShadow: true, header: header2)
|
||||
//
|
||||
// self.container2TableView = ccc2.1
|
||||
// self.container2 = ccc2.0
|
||||
//
|
||||
//
|
||||
// self.container2?.move(type: .hide)
|
||||
//
|
||||
// main(delay: 0.5) {
|
||||
// self.container2?.move(type: .top )
|
||||
// }
|
||||
//
|
||||
// containers.append(ccc2.0)
|
||||
//
|
||||
|
||||
|
||||
let fr2 = CGRect(x: 0, y: ScreenSize.height - 98, width: ScreenSize.width, height: 98)
|
||||
let footer = PlaylistFooterPlayView()
|
||||
footer.frame = fr2
|
||||
view.addSubview(footer)
|
||||
footerView = footer
|
||||
footerView?.clickCallback = {
|
||||
hideFooterView = footer
|
||||
hideFooterView?.clickCallback = {
|
||||
|
||||
if (self.containers.count != 0) {
|
||||
|
||||
self.containers[0].move(type: .middle)
|
||||
self.container2?.move(type: .top)
|
||||
|
||||
}
|
||||
}
|
||||
self.footerView?.alpha = 0
|
||||
self.hideFooterView?.alpha = 0
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
func addContainerr(position: ContainerPosition) {
|
||||
@@ -88,8 +137,20 @@ class PlaylistViewController: StoryboardController {
|
||||
let fr2 = CGRect(x: 0, y: 0, width: ScreenSize.width, height: 98)
|
||||
let footer = PlaylistFooterPlayView()
|
||||
footer.frame = fr2
|
||||
|
||||
footer.clickCallback = {
|
||||
|
||||
if (self.containers.count != 0) {
|
||||
|
||||
self.container2?.move(type: .top)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
container.add(footerView: footer)
|
||||
|
||||
|
||||
|
||||
// var imgHeader = UIImage(named: "imgWalletsHeader2")?.withTintColor(color, renderingMode: .alwaysTemplate)
|
||||
|
||||
let color1 = #colorLiteral(red: 0.07450980392, green: 0.08235294118, blue: 0.1137254902, alpha: 1)
|
||||
@@ -110,7 +171,8 @@ class PlaylistViewController: StoryboardController {
|
||||
table.indicatorStyle = .default
|
||||
// container.add(scrollView: addCollectionView())
|
||||
|
||||
|
||||
self.containerTableView = table
|
||||
self.container = container
|
||||
|
||||
let img1 = #imageLiteral(resourceName: "imgPlaylistMain")
|
||||
let img2 = #imageLiteral(resourceName: "imgPlaylistFlume")
|
||||
@@ -132,12 +194,13 @@ class PlaylistViewController: StoryboardController {
|
||||
] )
|
||||
|
||||
container.add(scrollView: table)
|
||||
container.move(type: .bottom)
|
||||
// container.move(type: .bottom)
|
||||
|
||||
main(delay: 1.05) {
|
||||
container.move(type: .middle
|
||||
)
|
||||
}
|
||||
|
||||
// main(delay: 1.05) {
|
||||
// container.move(type: .middle
|
||||
// )
|
||||
// }
|
||||
|
||||
containers.append(container)
|
||||
|
||||
@@ -148,27 +211,38 @@ class PlaylistViewController: StoryboardController {
|
||||
override func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
if animation {
|
||||
|
||||
|
||||
|
||||
if (containers.count != 0) {
|
||||
if type == .bottom {
|
||||
|
||||
containers[0].footerView?.alpha = 0
|
||||
|
||||
|
||||
containers[0].view.alpha = 0
|
||||
} else {
|
||||
containers[0].footerView?.alpha = 1
|
||||
containers[0].view.alpha = 1
|
||||
if containerController == self.container2 {
|
||||
UIView.animate(withDuration: 2) {
|
||||
if type == .bottom {
|
||||
self.container2?.view.alpha = 0
|
||||
self.container?.move(type: .top)
|
||||
} else {
|
||||
|
||||
self.container2?.view.alpha = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
UIView.animate(withDuration: 0.35) {
|
||||
if type == .bottom { self.footerView?.alpha = 1 }
|
||||
else { self.footerView?.alpha = 0 }
|
||||
|
||||
else if containerController == self.container {
|
||||
|
||||
if (containers.count != 0) {
|
||||
if type == .bottom {
|
||||
|
||||
containers[0].footerView?.alpha = 0
|
||||
|
||||
|
||||
containers[0].view.alpha = 0
|
||||
} else {
|
||||
containers[0].footerView?.alpha = 1
|
||||
containers[0].view.alpha = 1
|
||||
}
|
||||
}
|
||||
|
||||
// main {
|
||||
UIView.animate(withDuration: 0.35) {
|
||||
if type == .bottom { self.hideFooterView?.alpha = 1 }
|
||||
else { self.hideFooterView?.alpha = 0 }
|
||||
|
||||
}
|
||||
|
||||
// main {
|
||||
|
||||
if type == .bottom {
|
||||
|
||||
@@ -202,38 +276,39 @@ class PlaylistViewController: StoryboardController {
|
||||
self.view.layoutIfNeeded()
|
||||
|
||||
if type == .bottom {
|
||||
// self.imgView.alpha = 1
|
||||
// self.imgView.alpha = 1
|
||||
|
||||
self.tableView.alpha = 1
|
||||
// self.imgViewH.constant = ScreenSize.height
|
||||
// self.imgViewW.constant = ScreenSize.width
|
||||
// self.imgViewY.constant = 0
|
||||
// self.imgView.layer.cornerRadius = 0
|
||||
// self.imgViewH.constant = ScreenSize.height
|
||||
// self.imgViewW.constant = ScreenSize.width
|
||||
// self.imgViewY.constant = 0
|
||||
// self.imgView.layer.cornerRadius = 0
|
||||
|
||||
} else if type == .middle {
|
||||
self.tableView.alpha = 1
|
||||
|
||||
// self.imgViewW.constant = 313
|
||||
// self.imgViewH.constant = 162
|
||||
// self.imgViewY.constant = 196
|
||||
// self.imgViewW.constant = 313
|
||||
// self.imgViewH.constant = 162
|
||||
// self.imgViewY.constant = 196
|
||||
|
||||
// self.imgView.alpha = 1
|
||||
// self.imgView.layer.cornerRadius = 9
|
||||
// self.imgView.alpha = 1
|
||||
// self.imgView.layer.cornerRadius = 9
|
||||
|
||||
} else {
|
||||
|
||||
// self.imgViewW.constant = 313
|
||||
// self.imgViewH.constant = 162
|
||||
// self.imgViewY.constant = 196
|
||||
// self.imgViewW.constant = 313
|
||||
// self.imgViewH.constant = 162
|
||||
// self.imgViewY.constant = 196
|
||||
|
||||
self.tableView.alpha = 0
|
||||
// self.imgView.layer.cornerRadius = 9
|
||||
// self.imgView.layer.cornerRadius = 9
|
||||
}
|
||||
}
|
||||
|
||||
// } //
|
||||
// } //
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user