-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nikhil
committed
Sep 2, 2012
1 parent
2316d59
commit 25e091a
Showing
3 changed files
with
184 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
eclipse.preferences.version=1 | ||
provisioning_profiles/development/5EC3E575-FDE7-4F33-86B6-6D5E38614D58/appid=com.dezinezync.zypher | ||
provisioning_profiles/development/5EC3E575-FDE7-4F33-86B6-6D5E38614D58/filepath=/Users/dezinezync/Library/MobileDevice/Provisioning Profiles/5EC3E575-FDE7-4F33-86B6-6D5E38614D58.mobileprovision | ||
provisioning_profiles/development/5EC3E575-FDE7-4F33-86B6-6D5E38614D58/name=Global | ||
provisioning_profiles/development/5EC3E575-FDE7-4F33-86B6-6D5E38614D58/uuid=5EC3E575-FDE7-4F33-86B6-6D5E38614D58 | ||
provisioning_profiles/development/6D8381E9-E4B7-4C8D-B255-6B361101E2C8/appid=* | ||
provisioning_profiles/development/6D8381E9-E4B7-4C8D-B255-6B361101E2C8/filepath=/Users/dezinezync/Library/MobileDevice/Provisioning Profiles/6D8381E9-E4B7-4C8D-B255-6B361101E2C8.mobileprovision | ||
provisioning_profiles/development/6D8381E9-E4B7-4C8D-B255-6B361101E2C8/name=iOS Team Provisioning Profile\: * | ||
provisioning_profiles/development/6D8381E9-E4B7-4C8D-B255-6B361101E2C8/uuid=6D8381E9-E4B7-4C8D-B255-6B361101E2C8 | ||
provisioning_profiles/development/9AC1FF14-3AD5-4FF8-B5D7-85AC42B28EB3/appid=com.studiomarch.sockets | ||
provisioning_profiles/development/9AC1FF14-3AD5-4FF8-B5D7-85AC42B28EB3/filepath=/Users/dezinezync/Library/MobileDevice/Provisioning Profiles/9AC1FF14-3AD5-4FF8-B5D7-85AC42B28EB3.mobileprovision | ||
provisioning_profiles/development/9AC1FF14-3AD5-4FF8-B5D7-85AC42B28EB3/name=sockets | ||
provisioning_profiles/development/9AC1FF14-3AD5-4FF8-B5D7-85AC42B28EB3/uuid=9AC1FF14-3AD5-4FF8-B5D7-85AC42B28EB3 | ||
provisioning_profiles/development/B8406B1A-BF9F-44D9-B431-9D15EE9A1FCA/appid=com.dezinezync.darkroom | ||
provisioning_profiles/development/B8406B1A-BF9F-44D9-B431-9D15EE9A1FCA/filepath=/Users/dezinezync/Library/MobileDevice/Provisioning Profiles/B8406B1A-BF9F-44D9-B431-9D15EE9A1FCA.mobileprovision | ||
provisioning_profiles/development/B8406B1A-BF9F-44D9-B431-9D15EE9A1FCA/name=Darkroom | ||
provisioning_profiles/development/B8406B1A-BF9F-44D9-B431-9D15EE9A1FCA/uuid=B8406B1A-BF9F-44D9-B431-9D15EE9A1FCA | ||
provisioning_profiles/development/D3B28809-06F0-4DDB-83D1-219135983EC8/appid=com.pollen.timesense | ||
provisioning_profiles/development/D3B28809-06F0-4DDB-83D1-219135983EC8/filepath=/Users/dezinezync/Library/MobileDevice/Provisioning Profiles/D3B28809-06F0-4DDB-83D1-219135983EC8.mobileprovision | ||
provisioning_profiles/development/D3B28809-06F0-4DDB-83D1-219135983EC8/name=Timesense | ||
provisioning_profiles/development/D3B28809-06F0-4DDB-83D1-219135983EC8/uuid=D3B28809-06F0-4DDB-83D1-219135983EC8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,166 @@ | ||
var win = Ti.UI.createWindow({ | ||
width: 300, | ||
height: 400, | ||
shadow: { | ||
shadowOffset: {x: 0, y: 0}, | ||
require('ti.viewshadow'); | ||
|
||
//SETUP | ||
var slideLimit = 260; | ||
var catchMove = 50; //Limit after which action should be triggered on touchEnd | ||
|
||
// Our Identity Matrix for all animations using transform | ||
var t = Ti.UI.create2DMatrix(); | ||
|
||
var navWin = Ti.UI.createWindow({ | ||
width: 320, | ||
height: Ti.UI.FILL, | ||
left: 0, | ||
top: 0, | ||
backgroundColor: '#454545' | ||
}); | ||
|
||
navWin.add(Ti.UI.createTableView({ | ||
width: Ti.UI.FILL, | ||
height: Ti.UI.FILL, | ||
backgroundColor: 'transparent', | ||
separatorColor: '#555555', | ||
data: [{title: 'Window 1'}, {title: 'Window 2'}] | ||
})); | ||
|
||
navWin.children[0].addEventListener('click', switchWindow); | ||
|
||
/* | ||
* The reason for not doing something like var tableView = Ti..... | ||
* and then navWin.add(tableView) is to avoid polluting | ||
* the global namespace with unnecessary variables | ||
*/ | ||
|
||
var tabGroup = Ti.UI.createTabGroup({ | ||
width: Ti.UI.FILL, | ||
height: Ti.UI.FILL, | ||
sliding: false, | ||
shadow:{ | ||
shadowRadius: 5, | ||
shadowOpacity: 1, | ||
shadowRadius: 8 | ||
shadowOffset: {x: 0, y: 0} | ||
} | ||
}); | ||
|
||
//fLeft is a custom prop we set to know the current position of the tabGroup in the globalViewPointSystem | ||
|
||
// Sliding is a custom prop we set to know if the tabGroup is sliding or not. | ||
|
||
//Button | ||
var slideButton = Ti.UI.createButton({ | ||
title: '|||', | ||
style: Ti.UI.iPhone.SystemButtonStyle.BORDERED | ||
}); | ||
|
||
slideButton.addEventListener('click', slideButtonClick); | ||
|
||
//Windows | ||
|
||
var win1 = drawWindow('Window 1'); | ||
var win2 = drawWindow('Window 2'); | ||
|
||
var tab1 = Ti.UI.createTab({ | ||
window: win1, | ||
title: 'Window 1' | ||
}); | ||
|
||
var tab2 = Ti.UI.createTab({ | ||
window: win2, | ||
title: 'Window 2' | ||
}); | ||
|
||
tabGroup.addTab(tab1); | ||
tabGroup.addTab(tab2); | ||
|
||
win1.addEventListener('touchstart', tabGroupTouchStart); | ||
win1.addEventListener('touchmove', tabGroupTouchMove); | ||
win1.addEventListener('touchend', tabGroupTouchEnd); | ||
|
||
win2.addEventListener('touchstart', tabGroupTouchStart); | ||
win2.addEventListener('touchmove', tabGroupTouchMove); | ||
win2.addEventListener('touchend', tabGroupTouchEnd); | ||
|
||
navWin.open(); | ||
tabGroup.open(); | ||
|
||
// Listener Functions | ||
function slideButtonClick() { | ||
if(tabGroup.sliding) { | ||
slideIn(); | ||
} | ||
else { | ||
slideOut(); | ||
} | ||
} | ||
|
||
/*Moving tabGroup variants. Do not edit*/ | ||
var startPoint = 0; | ||
|
||
function tabGroupTouchStart(e) { | ||
startPoint = e.globalPoint.x; | ||
} | ||
|
||
function tabGroupTouchMove(e) { | ||
var diff = e.globalPoint.x - startPoint; | ||
|
||
//If the user is sliding the tabGroup away from the right edge, deny that. | ||
if(diff < 0) return false; | ||
|
||
tabGroup.animate({ | ||
transform: t.translate(diff, 0), | ||
duration: 0 | ||
}); | ||
tabGroup.sliding = true; | ||
diff = null; | ||
} | ||
|
||
function tabGroupTouchEnd(e) { | ||
var diff = e.globalPoint.x - startPoint; | ||
|
||
//Very small move? Let's take it back to where it began | ||
if(diff < catchMove) { | ||
slideIn(); | ||
} | ||
|
||
if(diff >= catchMove) { | ||
slideOut(); | ||
} | ||
else if((startPoint - e.globalPoint.x) > catchMove) { | ||
slideIn(); | ||
} | ||
|
||
diff = null; | ||
} | ||
|
||
function switchWindow(e) { | ||
tabGroup.setActiveTab(e.index); | ||
slideIn(); | ||
} | ||
|
||
//Private functions. Well, sorta. | ||
function slideOut() { | ||
tabGroup.animate({ | ||
transform: t.translate(slideLimit, 0), | ||
duration: 500, | ||
curve: Ti.UI.ANIMATION_CURVE_EASE_IN_OUT | ||
}); | ||
tabGroup.sliding = true; | ||
} | ||
|
||
function slideIn() { | ||
tabGroup.animate({ | ||
transform: t, | ||
duration: 400, | ||
curve: Ti.UI.ANIMATION_CURVE_EASE_IN_OUT | ||
}); | ||
tabGroup.sliding = false; | ||
} | ||
|
||
function drawWindow(t) { | ||
return Ti.UI.createWindow({ | ||
title: t, | ||
leftNavButton: slideButton, | ||
tabBarHidden: true, | ||
backgroundColor: 'white' | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters