Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from gobbl/fix/menu_list
Browse files Browse the repository at this point in the history
Fixing menu list
  • Loading branch information
TorIsHere committed Jun 16, 2015
2 parents af099f1 + 33b60db commit a083d77
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 65 deletions.
8 changes: 8 additions & 0 deletions adam.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/* Begin PBXBuildFile section */
2150F5011B0EFEE200AFDF5E /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2150F5001B0EFEE200AFDF5E /* ProfileViewController.swift */; };
21577E061B2E875000D4218F /* CurrencyConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21577E051B2E875000D4218F /* CurrencyConverter.swift */; };
21577E081B2E87DB00D4218F /* CurrencyList.plist in Resources */ = {isa = PBXBuildFile; fileRef = 21577E071B2E87DB00D4218F /* CurrencyList.plist */; };
21AF14871B05FA0B00108190 /* RestaurantServerAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21AF14861B05FA0B00108190 /* RestaurantServerAPI.swift */; };
21AF14891B0601C800108190 /* Restaurant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21AF14881B0601C800108190 /* Restaurant.swift */; };
21BF4D171B099714001CDBC3 /* RestaurantCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21BF4D161B099714001CDBC3 /* RestaurantCache.swift */; };
Expand Down Expand Up @@ -51,6 +53,8 @@
/* Begin PBXFileReference section */
2150F4FB1B0ED81C00AFDF5E /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
2150F5001B0EFEE200AFDF5E /* ProfileViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
21577E051B2E875000D4218F /* CurrencyConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrencyConverter.swift; sourceTree = "<group>"; };
21577E071B2E87DB00D4218F /* CurrencyList.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = CurrencyList.plist; sourceTree = "<group>"; };
21AF14861B05FA0B00108190 /* RestaurantServerAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RestaurantServerAPI.swift; sourceTree = "<group>"; };
21AF14881B0601C800108190 /* Restaurant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Restaurant.swift; sourceTree = "<group>"; };
21BF4D161B099714001CDBC3 /* RestaurantCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RestaurantCache.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -216,6 +220,8 @@
children = (
96DA5A141AF284BB0003E506 /* Menu.swift */,
96DA5A161AF2850E0003E506 /* MenuCell.swift */,
21577E051B2E875000D4218F /* CurrencyConverter.swift */,
21577E071B2E87DB00D4218F /* CurrencyList.plist */,
21AF14881B0601C800108190 /* Restaurant.swift */,
);
name = Menu;
Expand Down Expand Up @@ -318,6 +324,7 @@
9656ADA61AECC62800933A8E /* Main.storyboard in Resources */,
9656ADAB1AECC62800933A8E /* LaunchScreen.xib in Resources */,
9656ADA81AECC62800933A8E /* Images.xcassets in Resources */,
21577E081B2E87DB00D4218F /* CurrencyList.plist in Resources */,
21D741281B21A9A9008A8EB5 /* DiscoverView.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -399,6 +406,7 @@
21D7412C1B21AD36008A8EB5 /* DiscoverViewController.swift in Sources */,
96DA5A111AF274670003E506 /* LocationService.swift in Sources */,
9616799B1B2C72BA00A43AD3 /* LocationSearchViewController.swift in Sources */,
21577E061B2E875000D4218F /* CurrencyConverter.swift in Sources */,
96DA5A121AF274670003E506 /* ImageCache.swift in Sources */,
96C24E901B244527006C5806 /* SearchViewController.swift in Sources */,
2150F5011B0EFEE200AFDF5E /* ProfileViewController.swift in Sources */,
Expand Down
48 changes: 18 additions & 30 deletions benri/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@
</navigationItem>
</items>
</navigationBar>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" alwaysBounceHorizontal="YES" showsHorizontalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="363" sectionHeaderHeight="10" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="V9q-mp-oQo">
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="363" sectionHeaderHeight="10" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="V9q-mp-oQo">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" secondItem="V9q-mp-oQo" secondAttribute="height" multiplier="400:679" id="2Zi-YO-aW0"/>
</constraints>
<prototypes>
<tableViewCell contentMode="scaleToFill" restorationIdentifier="Cell" selectionStyle="none" indentationWidth="10" reuseIdentifier="menuCell" rowHeight="370" id="NrS-Yw-x3d" customClass="MenuCell" customModule="adam" customModuleProvider="target">
<rect key="frame" x="0.0" y="65" width="320" height="280"/>
Expand Down Expand Up @@ -195,16 +192,6 @@
</connections>
</tableViewCell>
</prototypes>
<variation key="default">
<mask key="constraints">
<exclude reference="2Zi-YO-aW0"/>
</mask>
</variation>
<variation key="heightClass=regular-widthClass=compact">
<mask key="constraints">
<include reference="2Zi-YO-aW0"/>
</mask>
</variation>
<connections>
<outlet property="dataSource" destination="9pv-A4-QxB" id="o1h-Jf-Gpv"/>
<outlet property="delegate" destination="9pv-A4-QxB" id="VBa-w1-iLK"/>
Expand All @@ -214,17 +201,16 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="tl7-Lj-Y8u" secondAttribute="trailing" id="DzS-oG-Gtx"/>
<constraint firstAttribute="trailing" secondItem="V9q-mp-oQo" secondAttribute="trailing" id="SCP-5G-wKL"/>
<constraint firstItem="tl7-Lj-Y8u" firstAttribute="leading" secondItem="tsR-hK-woN" secondAttribute="leadingMargin" id="X7b-JG-TBl"/>
<constraint firstItem="V9q-mp-oQo" firstAttribute="top" secondItem="tl7-Lj-Y8u" secondAttribute="bottom" id="aQX-uE-qcu">
<variation key="heightClass=regular-widthClass=compact" constant="0.0"/>
</constraint>
<constraint firstItem="V9q-mp-oQo" firstAttribute="leading" secondItem="tsR-hK-woN" secondAttribute="leading" id="cEJ-vG-1o6"/>
<constraint firstAttribute="trailingMargin" secondItem="tl7-Lj-Y8u" secondAttribute="trailing" id="dxo-sp-sB6"/>
<constraint firstItem="V9q-mp-oQo" firstAttribute="leading" secondItem="tsR-hK-woN" secondAttribute="leading" id="dzh-b4-F5E"/>
<constraint firstItem="tl7-Lj-Y8u" firstAttribute="leading" secondItem="tsR-hK-woN" secondAttribute="leading" id="ewk-b8-NPH"/>
<constraint firstItem="tl7-Lj-Y8u" firstAttribute="top" secondItem="Ia1-K6-d13" secondAttribute="bottom" constant="8" id="fYV-iF-Y08">
<variation key="heightClass=regular-widthClass=compact" constant="0.0"/>
</constraint>
<constraint firstAttribute="trailing" secondItem="V9q-mp-oQo" secondAttribute="trailing" id="wqZ-GG-qsL"/>
<constraint firstItem="V9q-mp-oQo" firstAttribute="top" secondItem="tl7-Lj-Y8u" secondAttribute="bottom" id="nJh-Aq-ydN"/>
<constraint firstItem="4ug-Mw-9AY" firstAttribute="top" secondItem="V9q-mp-oQo" secondAttribute="bottom" id="pGI-Fg-S0e"/>
</constraints>
<variation key="default">
<mask key="subviews">
Expand All @@ -237,9 +223,10 @@
<exclude reference="dxo-sp-sB6"/>
<exclude reference="ewk-b8-NPH"/>
<exclude reference="fYV-iF-Y08"/>
<exclude reference="aQX-uE-qcu"/>
<exclude reference="cEJ-vG-1o6"/>
<exclude reference="wqZ-GG-qsL"/>
<exclude reference="SCP-5G-wKL"/>
<exclude reference="dzh-b4-F5E"/>
<exclude reference="nJh-Aq-ydN"/>
<exclude reference="pGI-Fg-S0e"/>
</mask>
</variation>
<variation key="heightClass=regular-widthClass=compact">
Expand All @@ -253,9 +240,10 @@
<exclude reference="dxo-sp-sB6"/>
<include reference="ewk-b8-NPH"/>
<include reference="fYV-iF-Y08"/>
<include reference="aQX-uE-qcu"/>
<include reference="cEJ-vG-1o6"/>
<include reference="wqZ-GG-qsL"/>
<include reference="SCP-5G-wKL"/>
<include reference="dzh-b4-F5E"/>
<include reference="nJh-Aq-ydN"/>
<include reference="pGI-Fg-S0e"/>
</mask>
</variation>
</view>
Expand Down Expand Up @@ -339,7 +327,6 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Let's eat" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uP4-Lj-SxH">
<rect key="frame" x="66" y="81" width="219" height="37"/>
<fontDescription key="fontDescription" name="Helvetica-Light" family="Helvetica" pointSize="33"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
Expand Down Expand Up @@ -369,7 +356,7 @@
<constraints>
<constraint firstAttribute="height" constant="48" id="9QR-kB-egy"/>
</constraints>
<blurEffect style="dark"/>
<blurEffect style="light"/>
<variation key="default">
<mask key="constraints">
<exclude reference="9QR-kB-egy"/>
Expand Down Expand Up @@ -463,9 +450,7 @@
<constraints>
<constraint firstAttribute="height" constant="48" id="0Zn-uN-xA6"/>
</constraints>
<vibrancyEffect>
<blurEffect style="light"/>
</vibrancyEffect>
<blurEffect style="light"/>
<variation key="default">
<mask key="constraints">
<exclude reference="0Zn-uN-xA6"/>
Expand Down Expand Up @@ -638,6 +623,9 @@
<fontDescription key="fontDescription" name="HelveticaNeue-Thin" family="Helvetica Neue" pointSize="15"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
<rect key="frame" x="18" y="13" width="284" height="18"/>
</variation>
</label>
</subviews>
<constraints>
Expand Down
49 changes: 49 additions & 0 deletions benri/CurrencyConverter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// CurrencyConverter.swift
// adam
//
// Created by ariyasuk-k on 6/15/15.
// Copyright (c) 2015 gobbl. All rights reserved.
//

import Foundation

struct CurrencyConverter {

static var symbolDict: NSDictionary? {
get {
if let path = NSBundle.mainBundle().pathForResource("CurrencyList", ofType: "plist") {
return NSDictionary(contentsOfFile: path)
} else {
return nil
}

}
}

static func codeToSymbol(code:String) -> String {
if let dict = CurrencyConverter.symbolDict {
// Use your dict here
for (key, value) in dict {
let myKey = key as! String
if code == myKey {
return value as! String
}
}
}
return code
}

static func symbolToCode(symbol:String) -> String {
if let dict = CurrencyConverter.symbolDict {
// Use your dict here
for (key, value) in dict {
let myValue = value as! String
if symbol == myValue {
return key as! String
}
}
}
return symbol
}
}
18 changes: 18 additions & 0 deletions benri/CurrencyList.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GBP</key>
<string>£</string>
<key>EUR</key>
<string></string>
<key>SGD</key>
<string>S$</string>
<key>THB</key>
<string>฿</string>
<key>USD</key>
<string>$</string>
<key>JPY</key>
<string>¥</string>
</dict>
</plist>
45 changes: 26 additions & 19 deletions benri/FirstViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum ScreenSize {
IPHONE_4_7_INCH,
IPHONE_5_5_INCH
}

func getDeviceSize()->ScreenSize {
let screenSize: CGRect = UIScreen.mainScreen().bounds

Expand Down Expand Up @@ -71,7 +72,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
var isPopulating = false
var isInitiated = false
var lastContentOffset:CGFloat = 0.0

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
Expand Down Expand Up @@ -316,17 +317,31 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
}

func setVisibleNavigationBar(isVisible:Bool) {
// TODO use variable for magic number 72 , 28
// TODO use variable for magic number 64 , 20
if isVisible {
self.navBar.hidden = false
UIView.animateWithDuration(0.3, animations: {
self.menuTableView.frame = CGRectMake(self.menuTableView.frame.origin.x, 72, self.menuTableView.frame.size.width, self.menuTableView.frame.size.height)
})
if self.menuTableView.frame.origin.y == 20 {
UIView.animateWithDuration(0.3, animations: {
self.menuTableView.frame = CGRectMake(self.menuTableView.frame.origin.x, 64, self.menuTableView.frame.size.width, self.menuTableView.frame.size.height - 44)
})
} else {
UIView.animateWithDuration(0.3, animations: {
self.menuTableView.frame = CGRectMake(self.menuTableView.frame.origin.x, 64, self.menuTableView.frame.size.width, self.menuTableView.frame.size.height)
})
}

} else {
self.navBar.hidden = true
UIView.animateWithDuration(0.3, animations: {
self.menuTableView.frame = CGRectMake(self.menuTableView.frame.origin.x, 28, self.menuTableView.frame.size.width, self.menuTableView.frame.size.height)
})
if self.menuTableView.frame.origin.y == 64 {
UIView.animateWithDuration(0.3, animations: {
self.menuTableView.frame = CGRectMake(self.menuTableView.frame.origin.x, 20, self.menuTableView.frame.size.width, self.menuTableView.frame.size.height + 44)
})

} else {
UIView.animateWithDuration(0.3, animations: {
self.menuTableView.frame = CGRectMake(self.menuTableView.frame.origin.x, 20, self.menuTableView.frame.size.width, self.menuTableView.frame.size.height)
})
}
}
}

Expand Down Expand Up @@ -389,20 +404,11 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
}

let menu = menuArray.objectAtIndex(indexPath.row) as! Menu
let restuarant = restuarantList.objectForKey(menu.restaurantID) as! Restaurant
let restaurant = restuarantList.objectForKey(menu.restaurantID) as! Restaurant

/*
if let image = self.imgCache.loadImage(menu.imgURL){
cell.setImageByURL(menu.imgURL)
} else {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)){
cell.setImageByURL(menu.imgURL)
}
}*/
cell.setImageByURL(menu.imgURL)
let storeDistance = self.locationService.getDistanceFrom(restuarant.location)
cell.setMenu(menu, restaurant: restaurant)

cell.setMenuCell(menu.menuName, retaurantName: restuarant.name, distanceVal: storeDistance, pointVal: 1, price: menu.price, address: restuarant.address)
return cell
}

Expand All @@ -417,6 +423,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
}
return 400.0;
}

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

}
Expand Down
Loading

0 comments on commit a083d77

Please sign in to comment.