forked from tidev/titanium-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:appcelerator/titanium_mobile
- Loading branch information
Showing
17 changed files
with
490 additions
and
327 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
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
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
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
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
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
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
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,225 +1,30 @@ | ||
var win = Titanium.UI.currentWindow; | ||
// create slider view data object | ||
var data = [ | ||
{title:'Basic', hasChild:true, test:'../examples/slider_basic.js'}, | ||
{title:'Change Min/Max', hasChild:true, test:'../examples/slider_min_max.js'}, | ||
]; | ||
|
||
// | ||
// BASIC SLIDER | ||
// | ||
var basicSliderLabel = Titanium.UI.createLabel({ | ||
text:'Basic Slider - value = 0' , | ||
color:'#999', | ||
font:{ | ||
fontFamily:'Helvetica Neue', | ||
fontSize:15 | ||
}, | ||
textAlign:'center', | ||
top:10, | ||
width:300, | ||
height:'auto' | ||
}); | ||
|
||
var basicSlider = Titanium.UI.createSlider({ | ||
min:0, | ||
max:10, | ||
value:5, | ||
width:100, | ||
height:'auto', | ||
top:30, | ||
selectedThumbImage:'../images/slider_thumb.png', | ||
highlightedThumbImage:'../images/chat.png' | ||
}); | ||
basicSlider.addEventListener('change',function(e) | ||
{ | ||
basicSliderLabel.text = 'Basic Slider - value = ' + Math.round(e.value) + ' act val ' + Math.round(basicSlider.value); | ||
}); | ||
basicSlider.value = 0; // For regression test purposes | ||
|
||
// | ||
// CUSTOM SLIDER | ||
// | ||
var customSliderLabel = Titanium.UI.createLabel({ | ||
text:'Custom Slider - value = 25' , | ||
color:'#999', | ||
font:{ | ||
fontFamily:'Helvetica Neue', | ||
fontSize:15 | ||
}, | ||
textAlign:'center', | ||
top:70, | ||
width:300, | ||
height:'auto' | ||
}); | ||
|
||
var customSlider = Titanium.UI.createSlider({ | ||
min:0, | ||
max:100, | ||
value:25, | ||
width:268, | ||
height:11, | ||
top:90, | ||
leftTrackImage:'../images/slider_orangebar.png', | ||
rightTrackImage:'../images/slider_lightbar.png', | ||
thumbImage:'../images/slider_thumb.png' | ||
}); | ||
customSlider.addEventListener('change',function(e) | ||
{ | ||
customSliderLabel.text = 'Custom Slider - value = ' + e.value; | ||
}); | ||
|
||
|
||
// | ||
// CHANGE SLIDER | ||
// | ||
var changeButton = Titanium.UI.createButton({ | ||
title:'Change Basic Slider', | ||
height:40, | ||
width:200, | ||
top:120 | ||
}); | ||
changeButton.addEventListener('click', function() | ||
// add iphone specific tests | ||
if (Titanium.Platform.name == 'iPhone OS') | ||
{ | ||
basicSlider.value = 2; | ||
basicSlider.width = 268; | ||
basicSlider.height = 11; | ||
basicSlider.leftTrackImage = '../images/slider_orangebar.png'; | ||
basicSlider.rightTrackImage = '../images/slider_lightbar.png'; | ||
basicSlider.thumbImage = '../images/slider_thumb.png'; | ||
basicSlider.highlightedThumbImage = '../images/slider_thumb.png'; | ||
}); | ||
|
||
// | ||
// TOGGLE SLIDER VISIBILITY | ||
// | ||
var toggleButton = Titanium.UI.createButton({ | ||
title:'Hide/Show Slider', | ||
height:40, | ||
width:200, | ||
top:170 | ||
}); | ||
|
||
var visible = true; | ||
toggleButton.addEventListener('click', function() | ||
{ | ||
if (visible) | ||
{ | ||
basicSlider.hide(); | ||
customSlider.hide(); | ||
visible=false; | ||
} | ||
else | ||
{ | ||
basicSlider.show(); | ||
customSlider.show(); | ||
visible=true; | ||
} | ||
|
||
}); | ||
|
||
|
||
// | ||
// SLIDER NAVBAR | ||
// | ||
var navbarButton = Titanium.UI.createButton({ | ||
title:'Toggle Slider in Navbar', | ||
height:40, | ||
width:200, | ||
top:220 | ||
}); | ||
var inNavbar = false; | ||
navbarButton.addEventListener('click', function() | ||
{ | ||
if (!inNavbar) | ||
{ | ||
var navbarSlider = Titanium.UI.createSlider({ | ||
min:0, | ||
max:10, | ||
value:5, | ||
width:100 | ||
}); | ||
win.setRightNavButton(navbarSlider); | ||
inNavbar = true; | ||
} | ||
else | ||
{ | ||
win.rightNavButton = null; | ||
inNavbar = false; | ||
} | ||
}); | ||
|
||
// | ||
// SLIDER TOOLBAR | ||
// | ||
var toolbarButton = Titanium.UI.createButton({ | ||
title:'Toggle Slider in Toolbar', | ||
height:40, | ||
width:200, | ||
top:270 | ||
|
||
}); | ||
var inToolbar = false; | ||
toolbarButton.addEventListener('click', function() | ||
{ | ||
if (!inToolbar) | ||
{ | ||
var toolbarSlider = Titanium.UI.createSlider({ | ||
min:0, | ||
max:10, | ||
value:5, | ||
width:200 | ||
}); | ||
win.setToolbar([toolbarSlider],{animated:true}); | ||
inToolbar = true; | ||
} | ||
else | ||
{ | ||
win.setToolbar(null,{animated:true}); | ||
inToolbar = false; | ||
} | ||
}); | ||
|
||
// | ||
// SLIDER TO TITLE CONTROL | ||
// | ||
var titleButton = Titanium.UI.createButton({ | ||
title:'Toggle Slider in Title', | ||
height:40, | ||
width:200, | ||
top:320 | ||
} | ||
// create table view | ||
var tableview = Titanium.UI.createTableView({ | ||
data:data | ||
}); | ||
|
||
|
||
var inTitle = false; | ||
titleButton.addEventListener('click', function() | ||
// create table view event listener | ||
tableview.addEventListener('click', function(e) | ||
{ | ||
if (inTitle) | ||
{ | ||
win.titleControl = null; | ||
win.title = 'Slider'; | ||
inTitle=false; | ||
} | ||
else | ||
if (e.rowData.test) | ||
{ | ||
var titleSlider = Titanium.UI.createSlider({ | ||
min:0, | ||
max:10, | ||
value:5, | ||
width:80, | ||
height:'auto' | ||
var win = Titanium.UI.createWindow({ | ||
url:e.rowData.test, | ||
title:e.rowData.title | ||
}); | ||
win.titleControl = titleSlider; | ||
inTitle=true; | ||
Titanium.UI.currentTab.open(win,{animated:true}); | ||
} | ||
}); | ||
|
||
win.add(basicSliderLabel); | ||
win.add(basicSlider); | ||
win.add(toggleButton); | ||
Ti.API.info('platform = ' + Titanium.Platform.osname) | ||
if (Titanium.Platform.osname == 'iphone' || Titanium.Platform.osname == 'ipad') | ||
{ | ||
win.add(navbarButton); | ||
win.add(toolbarButton); | ||
win.add(titleButton); | ||
win.add(customSliderLabel); | ||
win.add(customSlider); | ||
win.add(changeButton); | ||
|
||
} | ||
// add table view to the window | ||
Titanium.UI.currentWindow.add(tableview); |
Oops, something went wrong.