Skip to content

Instantly share code, notes, and snippets.

View brgmrtn-codedepot's full-sized avatar

brgmrtn-codedepot

View GitHub Profile
@brgmrtn-codedepot
brgmrtn-codedepot / background_demo.js
Created March 11, 2012 12:35 — forked from kosso/background_demo.js
Ti: Background Service notification
/* Kosso : March 12th 2011
This the only way I managed to do this without the app crashing on resume.
Done slightly differently to the KS example, since they unregister the service and
do not use a setInterval timer.
*/
//############ in app.js :
// test for iOS 4+
@brgmrtn-codedepot
brgmrtn-codedepot / (last)win.js
Created March 11, 2012 12:17
Ti: Close all windows in tabgroup
var win = Ti.UI.currentWindow;
win.title='win6';
var oldWindow = win.oldWindow;
oldWindow.push(win);
var button1 = Ti.UI.createButton({
title:'go to root without animation',
height:50,
width:250,
// Titanium Mobile code for slider control functionality
//----------------------------------------
// @CJ_Reed 23rd Dec 2010
var sliderView = Titanium.UI.createView({top:100,height:50,left: 40,width:240,backgroundColor:'#000'});
var sliderButton = Titanium.UI.createView({width:96,borderRadius:5,backgroundColor:'#bbb',height:sliderView.height,left:sliderView.left,top:sliderView.top});
Titanium.UI.currentWindow.add(sliderView);
Titanium.UI.currentWindow.add(sliderButton);
function unlock (){
@brgmrtn-codedepot
brgmrtn-codedepot / customRowEdit.js
Created March 11, 2012 12:14 — forked from pec1985/customRowEdit.js
Ti: Custom swipe actions on rows
var win = Titanium.UI.createWindow({
title:'table',
});
var table = Ti.UI.createTableView({});
win.add(table);
var oldRow = {};
function swipe(a,b,c){
// a = view
@brgmrtn-codedepot
brgmrtn-codedepot / app.js
Created March 11, 2012 11:34 — forked from pec1985/app.js
Ti: Cache Remote Images
var Utils = {
RemoteImage: function(a){
a = a || {};
var md5;
var needsToSave = false;
var savedFile;
if(a.image){
md5 = Ti.Utils.md5HexDigest(a.image)+'.jpg';
savedFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,md5);
if(savedFile.exists()){
@brgmrtn-codedepot
brgmrtn-codedepot / app.js
Created March 11, 2012 11:34 — forked from pec1985/app.js
Ti: Scroll to position - iOS - Appcelerator
var win = Ti.UI.createWindow({
title:'Row #50'
});
var buttonBar = Ti.UI.createButtonBar({
labels:['top','middle','bottom']
});
win.rightNavButton = buttonBar;
@brgmrtn-codedepot
brgmrtn-codedepot / app.js
Created March 11, 2012 11:33 — forked from pec1985/app.js
Ti: FaceBook slide in views
// Create a new project and copy this code into app.js
// if you use this code, please give me credit :)
function JustAView(text){
var view = Ti.UI.createView({
backgroundColor:"#"+((1<<24)*Math.random()|0).toString(16),
width:200,
height:100
});
var label = Ti.UI.createLabel({