Skip to content

Instantly share code, notes, and snippets.

View manumaticx's full-sized avatar
👌
i'm okay

Manuel Lehner manumaticx

👌
i'm okay
View GitHub Profile
function TestView() {
var self = Ti.UI.createWindow({
backgroundColor:'white',
title: 'Test'
});
var cards = [];
for( var i=0; i<=10; i++){
// ALPHABYTES
// Facebook like menu window
var leftMenu = Ti.UI.createWindow({
backgroundColor: 'red',
top: 0,
left: 0,
width: 150,
zIndex: 1
});
@manumaticx
manumaticx / optionsMenu.js
Last active December 18, 2015 16:59
tab-dependend OptionsMenu
// create a tab-dependend OptionsMenu
function createOptionsMenu(e){
var menu = e.menu;
menu.clear();
// tab-dependend part
switch(self.activeTab){
case tab1:
// all menuItems for Tab 1
var menuItem_settings = menu.add({
@manumaticx
manumaticx / audio_stream.js
Last active March 15, 2017 18:43
modified sample code from http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Media.AudioPlayer related to this question: http://developer.appcelerator.com/question/154232/how-to-check-if-audio-is-playing Also added an intent filter to launch Activity from an url while the stream is playing in background. See this question: http://devel…
var win = Titanium.UI.createWindow({
title:'Audio Test',
backgroundColor:'#fff',
layout: 'vertical'
});
var startStopButton = Titanium.UI.createButton({
title:'Start/Stop Streaming',
top:'10dp',
width:'200dp',
@manumaticx
manumaticx / BackgroundNotification.js
Last active March 16, 2017 14:47
Android background service called from bencoding.AlarmManager BackgroundNotification.js is located under Resources/android/ or app/assets/android (in Alloy) Stackoverflow question: http://stackoverflow.com/questions/18234250/titanium-appcelerator-android-daily-notification-at-some-specified-time
/* locate this file under:
* - Resources/android/
* or
* - app/assets/android/ (when working with Alloy)
*/
var service = Ti.Android.currentService;
var serviceIntent = service.getIntent();
setNotification();
@manumaticx
manumaticx / toasty.js
Last active December 29, 2015 15:59
Toasty Sample
toasty.show({
title: 'Confirm',
message: 'This is a confirmation.',
type: 'confirm'
});
@manumaticx
manumaticx / app.js
Created December 13, 2013 10:59
Basic Loading Indicator that I used in Titanium Classic Apps
var loading = require('loading');
loading.start();
setTimeout( function(){ loading.stop(); }, 2000 );
@manumaticx
manumaticx / physical_size.js
Created December 17, 2013 12:57
Function to calculate display size as inches on android for Appcelerator Titanium with the help of https://github.com/dbankier/HasMenu
/**
* Calculates the physical display size for android devices
* e.g 4,95 for Nexus 5 or 7,02 for Nexus 7
*
* IMPORTANT: this requires https://github.com/dbankier/HasMenu
*
* @return {Number} size as inches
*/
function getPhysicalSize(){
// some infos we need
// Forked from https://gist.github.com/2417902 to fix a small bug
// -----
function PagingControl(scrollableView){
var pages = [];
var page;
var numberOfPages = scrollableView.getViews().length;
// Configuration
var pageColor = "#c99ed5";
var container = Titanium.UI.createView({
@manumaticx
manumaticx / index.js
Last active March 15, 2017 18:41
CommonJS location helper for Titanium
var location = require('location');
if (location.enabled){
if (location.hasAuth){
location.currentLocation(function(e){
alert(e.latitude + '; ' + e.longitude);
});
}else{
alert('need permission to access location service');
}