Skip to content

Commit

Permalink
Merge branch 'master' of github.com:appcelerator/titanium_mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Blain Hamon authored and Blain Hamon committed Sep 2, 2010
2 parents 33fafe5 + 57c5515 commit a8e6923
Show file tree
Hide file tree
Showing 17 changed files with 490 additions and 327 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,12 @@ protected TiOverlayItem createItem(int i) {
item = new TiOverlayItem(location, title, subtitle, p);

//prefer pinImage to pincolor.
if (a.containsKey("pinImage"))
if (a.containsKey("image") || a.containsKey("pinImage"))
{
String imagePath = a.getString("pinImage");
String imagePath = a.getString("image");
if (imagePath == null) {
imagePath = a.getString("pinImage");
}
Drawable marker = makeMarker(imagePath);
boundCenterBottom(marker);
item.setMarker(marker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ public void propertyChanged(String key, Object oldValue, Object newValue, TiProx
pos = TiConvert.toInt(newValue);
seekBar.setProgress(pos + offset);
onProgressChanged(seekBar, pos, true);
} else if (key.equals("min")) {
min = TiConvert.toInt(newValue);
if (pos < min) {
pos = min;
}
updateControl();
onProgressChanged(seekBar, pos, true);
} else if (key.equals("max")) {
max = TiConvert.toInt(newValue);
if (pos > max) {
pos = max;
}
updateControl();
onProgressChanged(seekBar, pos, true);
} else {
super.propertyChanged(key, oldValue, newValue, proxy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ public void handleKeyboardType(int type, boolean autocorrect)
tv.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
break;
}
if (!field) {
tv.setSingleLine(false);
}
}

public void handleReturnKeyType(int type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import java.io.IOException;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.security.DigestInputStream;
import java.security.DigestOutputStream;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -87,4 +90,31 @@ public String sha1(Object obj) {
}
return null;
}

public String transcodeString(String orig, String inEncoding, String outEncoding)
{
try {

Charset charsetOut = Charset.forName(outEncoding);
Charset charsetIn = Charset.forName(inEncoding);

ByteBuffer bufferIn = ByteBuffer.wrap(orig.getBytes(charsetIn.name()) );
CharBuffer dataIn = charsetIn.decode(bufferIn);
bufferIn.clear();
bufferIn = null;

ByteBuffer bufferOut = charsetOut.encode(dataIn);
dataIn.clear();
dataIn = null;
byte[] dataOut = bufferOut.array();
bufferOut.clear();
bufferOut = null;

return new String(dataOut, charsetOut.name());

} catch (UnsupportedEncodingException e) {
Log.e(LCAT, "Unsupported encoding: " + e.getMessage(), e);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ public Object get(String name, Scriptable start)
put(name, this, o);
((TiModule) p).postCreate();
}
} else {
}

if (o.equals(NOT_FOUND)) {
if (DBG) {
Log.d(LCAT, "Start: " + start.getClassName() + " looking for method:" + name);
}
Expand Down
5 changes: 5 additions & 0 deletions apidoc/Titanium/XML/XML.tdoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ android, iphone, ipad
- methods

parseString: parse an XML string into a DOMDocument
serializeToString: serialize a DOMDocument or DOMNode and its descendants into an XML string

- method : parseString, object

xml[string]: the XML content as a string

- method : serializeToString, string

node[DOMNode]: the XML DOMNode or DOMDocument to serialize

4 changes: 3 additions & 1 deletion demos/KitchenSink/Resources/examples/contacts_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ showDisplay.addEventListener('click', function() {
var image = e.person.image;
if (image == null) {
infoLabel.text = 'No image';
imageDisplay.image = null;
if (imageDisplay != null) {
imageDisplay.image = null;
}
}
else {
infoLabel.text = 'Image for '+e.person.fullName;
Expand Down
235 changes: 20 additions & 215 deletions demos/KitchenSink/Resources/examples/slider.js
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);
Loading

0 comments on commit a8e6923

Please sign in to comment.