Skip to content

Instantly share code, notes, and snippets.

View HazemKhaled's full-sized avatar

Hazem Khaled HazemKhaled

View GitHub Profile
function CustomImageView(args) {
var self = Ti.UI.createImageView(args);
//override any customizations to image, images, repeatCount, or duration
self.image = args.animatedImages[0];
self.repeatCount = null;
self.duration = null;
//instance variables
var animationIndex = 0,
animationCount = 0,
@DianthuDia
DianthuDia / ActionBarView.js
Created November 12, 2012 16:46 — forked from Mode54/ActionBarView.js
Action Bar Module for Titanium Mobile
/*
* Android API Guide
* http://developer.android.com/guide/topics/ui/actionbar.html
* Android Design Guide
* http://developer.android.com/design/patterns/actionbar.html
* Titanium Mobile will support someday
* https://jira.appcelerator.org/browse/TIMOB-2371
*/
var osName = Ti.Platform.osname,
isAndroid = osName==='android',
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
var btn = Ti.UI.createButton({
title: "Schedule local notification!"
});
btn.addEventListener("click", scheduleLocalNotification);
function scheduleLocalNotification() {
@ricardoalcocer
ricardoalcocer / index.js
Last active December 16, 2015 16:29
Quick and dirty Appcelerator Alloy + FireFoxOS hack. This sample App works EXACTLY the same on iOS, Android and FirefoxOS.
function onsuccess(data){
var jdata=JSON.parse(data);
var data=[];
jdata.forEach(function(item){
var payload={
tweet:item.text
};
var row=Alloy.createController('tweet.row',payload).getView();
@pedrofaria
pedrofaria / sqlx.js
Created October 6, 2012 22:08
New adapter for alloy models
/*
* Local SQLite sync adapter which will store all models in
* an on device database
*/
var _ = require('alloy/underscore')._,
db;
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
@falkolab
falkolab / actionBarMenuItem.js
Created November 5, 2015 21:23
Icon font MenuItem in ActionBar menu for Titanium SDK
var args = arguments[0] || {};
if(__parentSymbol) {
// recreate menu item
$.getTopLevelViews().length = 0;
__parentSymbol.removeItem(9999);
$.__views.menuItem = __parentSymbol.add(
_.extend(_.pick(args, Alloy.Android.menuItemCreateArgs), {
actionView: $.actionView
})
@FokkeZB
FokkeZB / DOWNSIZE.md
Last active December 8, 2016 10:39
Automatically generate non-retina and Android images for Alloy projects

UPDATE: With the assets command of the TiCons CLI / Module this can be done even simpeler by calling $ ticons assets or an alloy.ymk using:

task("pre:load", function(event, logger) {
    require('ticons').assets();
});

@grantges
grantges / charts.js
Last active November 13, 2017 18:17
Hyperloop Donut Example using Alloy Custom Tags (charts.js should be put in the app/lib folder of your app)
var Hyperloop = require('hyperloop');
var UIView = require('UIView');
var CGRect = require('CGRect');
var CGPoint = require('CGPoint');
var UIColor = require('UIColor');
var UIBezierPath = require('UIBezierPath');
function DEGREES_TO_RADIANS(angle) { return (Number(angle) / 180.0 * Math.PI) };
@LHIOUI
LHIOUI / tiYoutube.js
Last active April 3, 2018 08:20
Titanium commonJS module to play youtube video on Ti.Media.VideoPlayer many thanks to The Endless Hack https://github.com/endlesshack/youtube-video
//
// tiYoutube.js
//
// Created by Coyote on 2014-10-07.
// Copyright 2014 Coyote. All rights reserved.
//
var YoutubeVideo = function(id, callback) {
var client = Ti.Network.createHTTPClient();
client.onload = function(video_info) {
Ti.API.debug('on load');
@FokkeZB
FokkeZB / Analytics.md
Last active April 3, 2018 08:20
Options for analytics & crash reports for Titanium apps

Analytics & Crash options for Titanium

Service Analytics Performance Errors Titanium SDK Costs
New Relic Limited (users) HTTP HTTP Incomplete (no crashes) Free, $29/mo
Google Analytics Extensive Manual Native (no traces) Abandoned, Out-dated Free
Appcelerator Platform Extensive HTTP Native + JS Up-to-date Not public
Count.ly Extensive N/A N/A gitTio OSS, $125/mo
Flurry Extensive N/A Native gitTio, Marketplace Free
Crit