prototype for loading party screen done

This commit is contained in:
Okechi 2016-01-29 02:14:15 -05:00
parent 115eae3134
commit 4bc10d3a80
3 changed files with 149 additions and 1 deletions

View File

@ -488,6 +488,102 @@
</objects> </objects>
<point key="canvasLocation" x="2346" y="-630"/> <point key="canvasLocation" x="2346" y="-630"/>
</scene> </scene>
<!--Loading Party-->
<scene sceneID="LIL-lT-hZJ">
<objects>
<viewController title="Loading Party" id="C6s-vA-8F4" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ho3-BC-prZ"/>
<viewControllerLayoutGuide type="bottom" id="VGM-iY-3D2"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kLG-Xf-Gmd">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="J3e-IP-vgR">
<rect key="frame" x="70" y="74" width="180" height="180"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vmk-P9-oz6" userLabel="Change Song">
<rect key="frame" x="84" y="262" width="153" height="25"/>
<state key="normal" title="Button">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="fnx-cI-MJO">
<rect key="frame" x="60" y="317" width="200" height="100"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="bFM-de-c07">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="InvitedCollectionCell" id="flV-pJ-j2W">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vfW-Rs-nkH">
<rect key="frame" x="6" y="6" width="38" height="38"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</collectionViewCell>
</cells>
</collectionView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="syM-XP-IbG">
<rect key="frame" x="0.0" y="527" width="320" height="41"/>
<color key="backgroundColor" red="1" green="0.18659413420000001" blue="0.1031019395" alpha="1" colorSpace="calibratedRGB"/>
<state key="normal" title="Cancel Invites">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gvV-XF-lQc">
<rect key="frame" x="100" y="288" width="121" height="21"/>
<attributedString key="attributedText">
<fragment content="Invited Friends:">
<attributes>
<color key="NSColor" cocoaTouchSystemColor="darkTextColor"/>
<font key="NSFont" size="17" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ka6-m2-5hr">
<rect key="frame" x="70" y="20" width="180" height="21"/>
<attributedString key="attributedText">
<fragment content="Song Selected:">
<attributes>
<color key="NSColor" cocoaTouchSystemColor="darkTextColor"/>
<font key="NSFont" size="17" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Song by Artist" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4wF-iM-37c">
<rect key="frame" x="24" y="45" width="272" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="znj-Yd-xhQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3672" y="-630"/>
</scene>
<!--Song Selection View Controller--> <!--Song Selection View Controller-->
<scene sceneID="IkJ-pX-wAP"> <scene sceneID="IkJ-pX-wAP">
<objects> <objects>
@ -608,6 +704,9 @@
<connections> <connections>
<outlet property="searchDisplayController" destination="Le1-SR-p7g" id="B5Z-qo-0DN"/> <outlet property="searchDisplayController" destination="Le1-SR-p7g" id="B5Z-qo-0DN"/>
<outlet property="table" destination="iAI-5U-c8e" id="hcz-UQ-Mmg"/> <outlet property="table" destination="iAI-5U-c8e" id="hcz-UQ-Mmg"/>
<segue destination="C6s-vA-8F4" kind="popoverPresentation" identifier="LoadingPartySegue" popoverAnchorView="iAI-5U-c8e" id="zDR-tX-KYY">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="f9E-Q6-Co1" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="f9E-Q6-Co1" userLabel="First Responder" sceneMemberID="firstResponder"/>

View File

@ -8,6 +8,7 @@
import Foundation import Foundation
import MultipeerConnectivity import MultipeerConnectivity
import MediaPlayer
protocol PartyServiceManagerDelegate { protocol PartyServiceManagerDelegate {
@ -47,6 +48,9 @@ class PartyServiceManager: NSObject {
var connectingPeersDictionary = NSMutableDictionary() var connectingPeersDictionary = NSMutableDictionary()
var disconnectedPeersDictionary = NSMutableDictionary() var disconnectedPeersDictionary = NSMutableDictionary()
//party variables
var currentSong: MPMediaItem! = nil
/*init(){ /*init(){
//self.serviceAdvertiser = MCNearbyServiceAdvertiser(peer: self.myPeerID, discoveryInfo: nil, serviceType: self.PartyServiceType) //self.serviceAdvertiser = MCNearbyServiceAdvertiser(peer: self.myPeerID, discoveryInfo: nil, serviceType: self.PartyServiceType)
@ -132,6 +136,10 @@ class PartyServiceManager: NSObject {
println("Started Browsing for peers") println("Started Browsing for peers")
} }
func setSong(media: MPMediaItem!){
self.currentSong = media
}
//Deprecated //Deprecated
/* /*
func setData(dispName: String){ func setData(dispName: String){

View File

@ -10,7 +10,7 @@ import UIKit
import MediaPlayer import MediaPlayer
class SongSelectionViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { class SongSelectionViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
var party: PartyServiceManager! = nil
@IBOutlet weak var table: UITableView! @IBOutlet weak var table: UITableView!
@ -118,6 +118,47 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
} }
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if( indexPath.row == 0){
}
else{
switch self.filter{
//return albums cell
case "albums":
let cell = self.table.dequeueReusableCellWithIdentifier("AlbumCell", forIndexPath: indexPath) as? AlbumCell
var albumsQuery = MPMediaQuery.albumsQuery()
var albums = albumsQuery.items
var rowItem: MPMediaItem = albums[indexPath.row - 1] as! MPMediaItem
//segue to song selection from album selection
//return artists cell
case "artists":
let cell = self.table.dequeueReusableCellWithIdentifier("ArtistCell", forIndexPath: indexPath) as? ArtistCell
var artistsQuery = MPMediaQuery.artistsQuery()
var artists = artistsQuery.items
var rowItem: MPMediaItem = artists[indexPath.row - 1] as! MPMediaItem
//segue to song selction from artist
//return song cell
default:
let cell = self.table.dequeueReusableCellWithIdentifier("SongCell", forIndexPath: indexPath) as? SongCell
var songsQuery = MPMediaQuery.songsQuery()
var songs = songsQuery.items
var rowItem: MPMediaItem = songs[indexPath.row - 1] as! MPMediaItem
self.party.setSong(rowItem)
}
}
} }
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {