Skip to content

Instantly share code, notes, and snippets.

@xtity
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xtity/856d6e2875bfa1c5a031 to your computer and use it in GitHub Desktop.
Save xtity/856d6e2875bfa1c5a031 to your computer and use it in GitHub Desktop.
Titaniumでゆっくりしていってね! ref: http://qiita.com/xtity/items/acb00ec0f2027fbfe9fb
// This is a test harness for your module
// You should do something interesting in this harness
// to test out the module and to provide instructions
// to users on how to use it by example.
// open a single window
var win = Ti.UI.createWindow({
backgroundColor:'white'
});
var TiYukkuri = require('com.xtity.mod.TiYukkuri');
Ti.API.info("module is => " + TiYukkuri);
// Text Field
var tf = Ti.UI.createTextField({
width: 200
,height: 32
,value: 'ゆっくりしていってね'
,returnKeyType: Ti.UI.RETURNKEY_DONE
,borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED
,clearButtonMode: Ti.UI.INPUT_BUTTONMODE_ONFOCUS
,layout: 'vertical'
});
tf.addEventListener('return', function(e){
tf.blur();
});
win.add(tf);
// picker
var voiceKindNames = [
'aq_f1c.phont'
,'aq_f3a.phont'
,'aq_huskey.phont'
,'aq_m4b.phont'
,'aq_mf1.phont'
,'aq_rb2.phont'
,'aq_rb3.phont'
,'aq_rm.phont'
,'aq_robo.phont'
,'aq_yukkuri.phont'
,'ar_f4.phont'
,'ar_m5.phont'
,'ar_mf2.phont'
,'ar_rm3.phont'
];
var picker = Ti.UI.createPicker({
top:50
,useSpinner: true
,layout: 'vertical'
});
picker.selectionIndicator = true;
var column = Ti.UI.createPickerColumn();
for(var i=0, ilen=voiceKindNames.length; i<ilen; i++){
var row = Ti.UI.createPickerRow({
title: voiceKindNames[i]
});
column.addRow(row);
}
picker.add([column]);
win.add(picker);
// button
var button = Titanium.UI.createButton({
title: 'say'
,top: 30
,layout: 'vertical'
});
button.addEventListener('click', function() {
TiYukkuri.say({
word: tf.value
,voiceKindName: picker.getSelectedRow(0).title
});
});
win.add(button);
win.open();
cp aqtk2-ios-eva/phont/* TiYukkuri/assets/phonts/
cp aqtk2-ios-eva/lib/* TiYukkuri/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment