Skip to content

Instantly share code, notes, and snippets.

View marchbold's full-sized avatar
🚲
making stuff...

Michael marchbold

🚲
making stuff...
View GitHub Profile
@marchbold
marchbold / distriqt.extension.camerarollextended.manifestAdditions.xml
Last active March 8, 2016 12:41
Manifest Additions for the CameraRollExtended ANE
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application>
<activity android:name="com.distriqt.extension.camerarollextended.activities.BrowseForAssetActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="orientation|screenSize" />
<activity android:name="com.distriqt.extension.camerarollextended.activities.MultiImagePickerActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="orientation|screenSize" />
<activity android:name="com.distriqt.extension.camerarollextended.activities.SelectorActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="orientation|screenSize" />
@marchbold
marchbold / distriqt.extension.contacts.manifestAdditions.xml
Last active June 4, 2016 12:57
Android Manifest Additions for the Contacts ANE
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<!-- Optional: Needed if you are planning to save contact images -->
@marchbold
marchbold / distriqt.extension.contacts.requestAccess.as
Last active June 4, 2016 13:01
Requesting access to the user's contact list using the Contacts ANE
Contacts.init( APPLICATION_KEY );
Contacts.service.addEventListener( AuthorisationEvent.CHANGED, contacts_authorisationChangedHandler );
switch (Contacts.service.authorisationStatus())
{
case AuthorisationStatus.SHOULD_EXPLAIN:
case AuthorisationStatus.NOT_DETERMINED:
// REQUEST ACCESS: This will display the permission dialog
Contacts.service.requestAccess();
return;
@marchbold
marchbold / distriqt.extension.contacts.getContacts.as
Created December 29, 2015 01:41
Retrieving the Contact List
// Before here we have already requested access and performed initialisation
Contacts.service.addEventListener( ContactsEvent.GET_CONTACTS, contacts_getContactsHandler );
Contacts.service.addEventListener( ContactsEvent.GET_CONTACTS_ERROR, contacts_getContactsErrorHandler );
Contacts.service.getContactListAsync();
...
private function contacts_getContactsHandler( event:ContactsEvent ):void
@marchbold
marchbold / distriqt.extension.contacts.showContactPicker.as
Created December 29, 2015 01:45
Display the native contact picker
// Before here we have already requested access and performed initialisation
Contacts.service.addEventListener( ContactsEvent.CONTACT_SELECTED, contact_selectedHandler );
Contacts.service.addEventListener( ContactsEvent.CONTACTPICKER_CANCEL, contacts_contactPickerCancelHandler );
if (!Contacts.service.showContactPicker())
{
trace( "Access to contacts list denied by user" );
}
@marchbold
marchbold / distriqt.extension.dialog.toast.as
Created January 16, 2016 04:45
Displaying a toast message using the Dialog ANE
Dialog.service.toast( "An amazing toast" );
// com.distriqt.Dialog
@marchbold
marchbold / distriqt.extension.share.applications.launch.as
Created January 26, 2016 23:06
Launching an application with an explicit Intent to a specific Instagram user using the Share ANE
var app:Application = new Application( "com.instagram.android", "instagram://" );
var options:ApplicationOptions = new ApplicationOptions();
options.action = ApplicationOptions.ACTION_VIEW;
options.data = "http://instagram.com/_u/distriqt";
options.parameters = "user?username=distriqt";
if (Share.service.applications.isInstalled( app ))
{
Share.service.applications.launch( app, options );
@marchbold
marchbold / distriqt.extension.share.applications.launchSimple.as
Created January 26, 2016 23:32
The simplest example of launching another application if installed using the Share ANE
var app:Application = new Application( "com.instagram.android", "instagram://" );
if (Share.service.applications.isInstalled( app ))
{
Share.service.applications.launch( app );
}
// com.distriqt.Share
@marchbold
marchbold / distriqt.extension.application.setStatusBarColour.as
Last active January 28, 2016 04:41
Set the colour of the status bar on Android API v21+ using the Application ANE
Application.init( APPLICATION_KEY );
if (Application.isSupported)
{
Application.service.setStatusBarColour( 0xFF0000 );
}
// com.distriqt.Application
@marchbold
marchbold / distriqt.extension.dialog.simpleAlert.as
Created January 29, 2016 22:27
Show a simple Alert Dialog using the Dialog ANE
var alert:DialogView = Dialog.service.create(
new AlertBuilder()
.setTitle( "Alert" )
.setMessage( "Test Message" )
.addOption( "OK", DialogAction.STYLE_POSITIVE, 0 )
.build()
);
alert.addEventListener( DialogViewEvent.CLOSED, alert_closedHandler );
alert.show();