Skip to content

Instantly share code, notes, and snippets.

View csemrm's full-sized avatar

Mostafizur Rahman csemrm

View GitHub Profile
@csemrm
csemrm / app.js
Created December 2, 2013 13:13
TableView inside ScrollView with pinch event
var win = Ti.UI.createWindow();
win.title = "Test";
var table = Ti.UI.createTableView({
top : 30
});
var scrollView = Ti.UI.createScrollView({
backgroundColor : '#fff',
@csemrm
csemrm / app.js
Created December 3, 2013 11:54
Lock window screen in Portrait Android For Android Window screen lock, we need to set orientationModes and orientation property in the window object. we also need to make sure you force a heavyweight window by either setting fullscreen: true or navBarHidden: true.
var win = Titanium.UI.createWindow({
title : 'My app',
backgroundColor : '#fff',
navBarHidden : true,
orientationModes : [Titanium.UI.PORTRAIT]
});
Titanium.UI.orientation = Titanium.UI.PORTRAIT;
var testButton = Ti.UI.createButton({
title : 'Test Button',
@csemrm
csemrm / app.js
Last active May 19, 2016 17:48
File upload to the server using Titanium Test environment: Ti SDK 3.1.3.GA, CLI 3.2.0
(function() {
var form_url = 'http://apps.priyo.com/jonopriyo/image.php';
var win = Ti.UI.createWindow({
layout : 'vertical',
backgroundColor : '#fff'
});
var btnPhoto = Ti.UI.createButton({
title : 'Select Photo'
@csemrm
csemrm / app.js
Created December 14, 2013 04:45
How to write multi-lingual script in Titanium? Step to use: 1. Create a titanium project 2. Update app.js file with my code 3. Create new folder "i18n" in project root directory if not exits 4. Add another folder "like en" your language 5. Add new file string.xml and update my code 6. Now ready to use
var win = Ti.UI.createWindow({
layout : 'vertical',
backgroundColor : '#fff'
});
var aLabel = Ti.UI.createLabel({
text : L('hello'),
});
win.add(aLabel);
@csemrm
csemrm / Mn_LoginOnBoarding1View.js
Created December 14, 2013 13:22
iPhone 5 Assets To use assets specific to the new iPhone 5 screen (1136 x 640 pixels), add the suffix -568h@2x to the asset filename, for example, Resources/iphone/[email protected]. Previously, only the splash screen file, Default.png, supported this suffix.
function LoginOnBoarding1View() {
var iphone5Flag = false;
if (Ti.Platform.displayCaps.platformHeight === 568) {//iphone 5
iphone5Flag = true;
}
//create component instance
var self = Ti.UI.createImageView({
left : 0,
@csemrm
csemrm / app.js
Created December 15, 2013 13:46
Image display form Picasa photo in Titanium
var win = Ti.UI.createWindow({
backgroundColor : '#fff',
layout : 'vertical',
navBarHidden : false,
title : 'Show Photo From Fhoto Galary'
});
var url = "https://picasaweb.google.com/data/feed/base/user/115403892804643478218?alt=rss&kind=album&hl=en_US&imgmax=1600";
var xhr = Ti.Network.createHTTPClient({
onload : function() {
@csemrm
csemrm / app.js
Created December 16, 2013 12:39
How to prevent Auto Lock in you IOS device when apps are running? You can easily manage auto lock status in titanium. Here is my simple code for preventing auto lock option in iOS.
var win = Titanium.UI.createWindow({
backgroundColor : '#ddd',
});
Ti.App.idleTimerDisabled = true;
alert(Ti.App.getIdleTimerDisabled());
win.open();
@csemrm
csemrm / logs
Last active January 1, 2016 02:29
Ti.Media.VideoPlayer stuck in VIDEO_PLAYBACK_STATE_SEEKING_
// Simulator Logs
[INFO] : TC3303/1.0 (3.3.0.v20131220192449.95b274b)
[INFO] : Event PlaybackState Fired: 1
[INFO] : Event PlaybackState Fired: 2
[INFO] : 4
[INFO] : timesSet 1
[INFO] : Event PlaybackState Fired: 1
[INFO] : Event PlaybackState Fired: 4
[INFO] : Event PlaybackState Fired: 1
@csemrm
csemrm / app.js
Created December 28, 2013 18:44
app.js Android: Second time a webview is loaded with a HTML5 video the video does not play
var win2 = Titanium.UI.createWindow({
backgroundColor : 'red',
title : 'Red Window'
});
var win3 = Titanium.UI.createWindow({
backgroundColor : 'blue',
title : 'Blue Window'
});
@csemrm
csemrm / app.js
Created December 29, 2013 14:55
Titanium ACS Create post objects with custom object in Ti ACS
var Cloud = require('ti.cloud');
Cloud.debug = true;
var win = Ti.UI.createWindow({
backgroundColor : 'white',
});
var post_photo = Ti.UI.createButton({
title : 'event query',