Skip to content

Instantly share code, notes, and snippets.

View yagitoshiro's full-sized avatar

yagi_ yagitoshiro

View GitHub Profile
@yagitoshiro
yagitoshiro / gist:7105452
Last active December 26, 2015 06:09
P.O.C: Hide TabBar with Titanium SDK 3.x...
//app.js excerpt
var ApplicationTabGroup;
if(Ti.Platform.osname == 'android'){
ApplicationTabGroup = require('ui/common/AndroidTabGroup'); // <- これを追加
}else{
ApplicationTabGroup = require('ui/common/ApplicationTabGroup');
}
new ApplicationTabGroup(Window).open();
//ui/common/AndroidTabGroup.js
@yagitoshiro
yagitoshiro / gist:6738602
Created September 28, 2013 05:13
ページ遷移しながらデータを次のWindowに引き渡し、ついでに自分を消して戻れなくするパターン。実際には、Question.jsとAnswer.jsがほぼ同じ内容なので、外観に関わる部分を外に出してrequireして、共通化する方がいいと思います。
//試験を開始するWindowにて
var Window, window;
Window = require('ui/handheld/Question');
window = new Window(1);
window.containingTab = self.containingTab;
self.containingTab.open(window);
//ui/handheld/Question.js
function Question(id){
var self, button;
@yagitoshiro
yagitoshiro / tipy
Created August 24, 2013 10:47
/usr/local/bin/tipy 最新版が正義
#!/usr/bin/env ruby
dir = "#{ENV['HOME']}/Library/Application\ Support/Titanium/mobilesdk/osx/*GA"
sdk = "#{Dir.glob(dir).sort.last}/titanium.py"
exec "#{sdk.gsub(/ /, '\ ')} #{ARGV.join(" ")}"
@yagitoshiro
yagitoshiro / tiapp.xml
Last active December 16, 2015 06:49
AppIdが「app.gcmtest.android」だった場合のGCMのtiapp.xmlの設定
<!--前略-->
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>8</tool-api-level>
<manifest android:versionCode="1" android:versionName="1.0" package="com.activate.mohh">
<supports-screens android:anyDensity="true"/>
<uses-sdk android:minSdkVersion="8"/>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
@yagitoshiro
yagitoshiro / gist:5392658
Created April 16, 2013 01:27
キリトリ
button.addEventListener('click', function(e){
Ti.Media.openPhotoGallery({
error: function(){},
cancel: function(){},
success: function(e){
var size = Math.min(e.media.width, e.media.height) / 2;
var image = e.media.imageAsCropped({
x: 0,
y: 0,
width: size,
@yagitoshiro
yagitoshiro / ApplicationWindow.js
Created October 10, 2012 14:22
地名や住所を指定すると現在位置から見た方位角を大雑把に出してその地点まで直線を引いてコンパスを動かすサンプル
function ApplicationWindow(title) {
var self = Ti.UI.createWindow({
title:title,
backgroundColor:'white'
});
var compass = Ti.UI.createImageView({
image:'/images/arrow.gif',
width:Ti.UI.SIZE,
height:Ti.UI.SIZE,
@yagitoshiro
yagitoshiro / RecordingVideo.js
Created September 30, 2012 14:14 — forked from dawsontoth/RecordingVideo.js
How to record video, then share or save it. Using Appcelerator Titanium!
/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
*/
var win = Titanium.UI.createWindow({
@yagitoshiro
yagitoshiro / StupidimagereaderModule.java
Created August 12, 2012 17:12
画像ファイルを読ませると幅と高さを持ったTiBlobを返す
/**
* This file was auto-generated by the Titanium Module SDK helper for Android
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* var mod = require('org.selfkleptomaniac.ti.mod.stupidimagereader');
* var image = "washingmachine.jpg";
*
@yagitoshiro
yagitoshiro / gist:3285771
Created August 7, 2012 14:22
emulate home button on android:back event
win.addEventListener('android:back', ()->
intent = Ti.Android.createIntent
action: Ti.Android.ACTION_MAIN
intent.addCategory Ti.Android.CATEGORY_HOME
Ti.Android.currentActivity.startActivity intent
return
)
@yagitoshiro
yagitoshiro / gist:3039968
Last active October 19, 2015 05:50
Titanium Mobile用のSQLiteを扱うクラス・第二形態 update: 更新も保存もsaveに統一
# モデルがこれだけで作れたら素敵じゃないか
# entry.coffee
Database = require('libs/database')
class Entry extends Database
initialize:()->
@property 'title', 'text'
@property 'body', 'text'
super
module.exports = new Entry('entries')