forked from einsteinx2/iSub-old-swift-port
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefines.swift
61 lines (49 loc) · 1.82 KB
/
Defines.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// Defines.swift
// iSub
//
// Created by Benjamin Baron on 12/15/14.
// Copyright (c) 2014 Ben Baron. All rights reserved.
//
import Foundation
import UIKit
func IS_IPAD() -> Bool
{
return UIDevice.currentDevice().userInterfaceIdiom == .Pad
}
func ISMSRegularFont(size: CGFloat) -> UIFont
{
return UIFont(name: "HelveticaNeue", size: size)!
}
func ISMSBoldFont(size: CGFloat) -> UIFont
{
return UIFont(name: "HelveticaNeue-Bold", size: size)!
}
private let BaseWidth : CGFloat = 320
func ISMSNormalize(value: CGFloat, multiplier: CGFloat = 1, maxDelta: CGFloat = 1024) -> CGFloat {
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
return value
}
let screenWidth = UIScreen.mainScreen().bounds.size.width
let percent = (screenWidth - BaseWidth)/screenWidth
let normalizedValue = value * (1 + percent) * multiplier
return min(normalizedValue, value + maxDelta) //capped by a max value if needed
}
func BytesForSecondsAtBitrate(seconds: Int, bitrate: Int) -> Int {
return (bitrate / 8) * 1024 * seconds
}
let ISMSJukeboxTimeout = 60.0
let ISMSHeaderColor = UIColor(red: 200.0/255.0, green: 200.0/255.0, blue: 206.0/255.0, alpha: 1.0)
let ISMSHeaderTextColor = UIColor(red: 77.0/255.0, green: 77.0/255.0, blue: 77.0/255.0, alpha: 1.0)
let ISMSHeaderButtonColor = UIColor(red: 0.0, green: 122.0/255.0, blue: 1.0, alpha: 1.0)
let ISMSArtistFont = ISMSRegularFont(16)
let ISMSAlbumFont = ISMSRegularFont(16)
let ISMSSongFont = ISMSRegularFont(16)
let ISMSiPadBackgroundColor = ISMSHeaderColor
let ISMSiPadCornerRadius = 5.0
let ISMSFolderCellHeight: CGFloat = 44.0
let ISMSSubfolderCellHeight: CGFloat = 50.0
let ISMSSongCellHeight: CGFloat = 44.0
let ISMSAlbumCellHeight: CGFloat = 50.0
let ISMSArtistCellHeight: CGFloat = 44.0
let ISMSCellHeaderHeight: CGFloat = 20.0