Skip to content

Instantly share code, notes, and snippets.

View ardiwine's full-sized avatar

Edwin Ardiwinata ardiwine

View GitHub Profile
@ardiwine
ardiwine / gist:3e0d4458a1396989fe1b
Created June 4, 2015 17:58
Android share intent on Appcelerator
var shareIntent = Ti.Android.createIntent({
action : Ti.Android.ACTION_SEND,
type : 'text/plain',
url : 'your URL here'
});
shareIntent.putExtra(Ti.Android.EXTRA_TEXT, args.news.link);
shareIntent.addCategory(Ti.Android.CATEGORY_DEFAULT);
actionBar.addShareAction({
@ardiwine
ardiwine / image.js
Created May 6, 2015 13:57
Image container to fit in the view port appropriately
var imageContainer = Ti.UI.createView({
left: 0,
right: 0,
height: 155, // define the height of each image "row"
clipMode: OS_IOS ? Ti.UI.iOS.CLIP_MODE_ENABLED : null, // iOS specific clipMode property that needs to be enabled
backgroundColor: '#FFFFFF'
});
imageContainer.add(Ti.UI.createImageView({
image: utilities.getFirstImage(args.news.description),
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?w=files&flid=15801)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
Google Apps for Android 4.2 (https://www.androidfilehost.com/?fid=23060877490000128 - gapps-jb-20130812-signed.zip)
Google Apps for Android 4.1 (https://www.androidfilehost.com/?fid=22979706399755082 - gapps-jb-20121011-signed.zip)
@ardiwine
ardiwine / webview.js
Last active September 8, 2017 18:42
Appcelerator Titanium: Open external link from a webview on a native browser
var webview = Ti.UI.createWebview({
html: '[ PUT YOUR HTML HERE ]'
})
webview.addEventListener('beforeload', function(e) {
if (e.url.toString().indexOf('http') != -1 || e.url.toString().indexOf('www') != -1) {
// you can also check for mailto://
webview.stopLoading(true);
Ti.Platform.openURL(e.url);
};
@ardiwine
ardiwine / app.js
Last active August 29, 2015 14:01
Appcelerator Titanium: Simple HelloWorld app
var window = Ti.UI.createWindow({
backgroundColor: 'black'
});
var label = Ti.UI.createLabel({
text: 'Hello World!',
color: '#ffffff'
});
window.add(label);