Skip to content

Instantly share code, notes, and snippets.

View artanisdesign's full-sized avatar

Gergely Cziva artanisdesign

View GitHub Profile
@artanisdesign
artanisdesign / app.js
Created June 4, 2012 13:04 — forked from iskugor/app.js
How to append a row to particular section in Titanium
(function() {
var win = Ti.UI.createWindow();
var section1 = Ti.UI.createTableViewSection({
headerTitle:'Header 1'
});
for (var i=0; i < 4; i++) {
section1.add(Ti.UI.createTableViewRow({
title:'Row '+i
}));
}
@artanisdesign
artanisdesign / zscroll.html
Created June 5, 2012 07:02 — forked from cers/zscroll.html
Scrolling along the Z-Axis
<html>
<head>
<title>Scrolling along the Z-Axis</title>
<!--
Example from http://eng.wealtfront.com
Assumes browser window is sized at a height of 400px (the size of the black box).
-->
<style>
body{height:600px;}
#viewport {
@artanisdesign
artanisdesign / app.js
Created June 25, 2012 19:21 — forked from pec1985/app.js
Cool background color for iPhone
var win = Ti.UI.createWindow({
backgroundColor:'stripped'
});
win.open();
@artanisdesign
artanisdesign / app.js
Created June 25, 2012 19:22 — forked from pec1985/app.js
Pull to Refresh in android, plus a demo
/*
Copyright 2011 Pedro Enrique
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@artanisdesign
artanisdesign / gist:4071742
Created November 14, 2012 11:59
save image, and hires image to filesystem
api.cachedImageView = function(imageDirectoryName, url, imageViewObject, hires) {
var filename = url.split('/');
var hiresfilename;
filename = filename[filename.length - 1];
hiresfilename = filename.split('.');
hiresfilename = hiresfilename[hiresfilename.length - 2] + '@2x' + hiresfilename[hiresfilename.length - 1];
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, imageDirectoryName, filename);
var hiresfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, imageDirectoryName, hiresfilename);
if(file.exists()) {
imageViewObject.image = file.nativePath;
@artanisdesign
artanisdesign / loader
Created November 17, 2012 11:28
circleloader
var CircleLoaderView = require("CircleLoaderView");
var myloader = new CircleLoaderView({
width : 200,
centerWidth : 100,
backgroundColor : "#fff",
tintColor : "blue",
textColor : "red",
labelFontSize : 28
Titanium.App.addEventListener("playvideo", function (e) {
win11 = Titanium.UI.createWindow({
orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT],
title: "Video",
zIndex: 222222
});
var activeMovie = Titanium.Media.createVideoPlayer({
fullscreen: !0,
autoplay: !0,
@artanisdesign
artanisdesign / gist:4485678
Last active December 10, 2015 20:08
Small hack for Titanium AudioPlayer to handle stream errors!
//..
//AudioStreamer/AudioStreamerCUR.m
//
// failWithErrorCode:
//
// Sets the playback state to failed and logs the error.
//
// Parameters:
// anErrorCode - the error condition
//
@artanisdesign
artanisdesign / gist:5029161
Created February 25, 2013 11:08
TiModalWindow Anim
//Application Window Component Constructor
function ApplicationWindow() {
//load component dependencies
var FirstView = require('ui/common/FirstView');
//create component instance
var self = Ti.UI.createWindow({
backgroundColor : '#ffffff',
borderRadius : 6
});
@artanisdesign
artanisdesign / TiUIButton.m
Last active December 19, 2015 22:29
showsTouchWhenHighlighted on Titanium button
-(UIButton*)button
{
if (button==nil)
{
BOOL hasImage = [self.proxy valueForKey:@"backgroundImage"]!=nil;
UIButtonType defaultType = (hasImage==YES) ? UIButtonTypeCustom : UIButtonTypeRoundedRect;
style = [TiUtils intValue:[self.proxy valueForKey:@"style"] def:defaultType];
UIView *btn = [TiButtonUtil buttonWithType:style];