PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/titanium/mobile/android/Intent.hx

http://github.com/visup/haxe-titanium-api
Haxe | 144 lines | 27 code | 5 blank | 112 comment | 0 complexity | 7cfc7038094a2920414dbcdcd8d41d76 MD5 | raw file
  1package titanium.mobile.android;
  2
  3
  4/**
  5Intent class
  6
  7Documentation available at:
  8http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Android.Intent-object
  9
 10- namespace
 11
 12Titanium.Android.Intent
 13
 14- type
 15
 16proxy
 17
 18- description
 19
 20The Titanium binding of an [Android Intent](http://developer.android.com/reference/android/content/Intent.html)
 21
 22- since
 23
 241.5
 25
 26- platforms
 27
 28android
 29
 30- methods
 31putExtra: Put an extra property on this Intent
 32putExtraUri: Put a URI property on this Intent (useful for `Titanium.Android.EXTRA_STREAM`)
 33hasExtra: Returns whether or not this Intent has a property
 34addCategory: Add a category to this Intent. See the category constants in `Titanium.Android`.
 35getStringExtra: Get a string property from this Intent
 36getBooleanExtra: Get a boolean property from this Intent
 37getIntExtra: Get a int property from this Intent
 38getLongExtra: Get a long property from this Intent
 39getDoubleExtra: Get a double property from this Intent
 40getData: Get the Data URI from this Intent
 41addFlags: augment the existing flags on the Intent.
 42
 43- method : putExtra
 44name[string]: The property name
 45value[object]: The property value
 46
 47- method : putExtraUri
 48name[string]: The property name
 49value[string]: The URI string
 50
 51- method : hasExtra, boolean
 52name[string]: The property name to check for
 53
 54- method : addCategory
 55name[string]: The category name. See the category constants in `Titanium.Android`
 56
 57- method : getStringExtra, string
 58name[string]: The string property to get
 59
 60- method : getBooleanExtra, boolean
 61name[string]: The boolean property to get
 62
 63- method : getIntExtra, int
 64name[string]: The int property to get
 65
 66- method : getLongExtra, int
 67name[string]: The long property to get
 68
 69- method : getDoubleExtra, double
 70name[string]: The double property to get
 71
 72- method : addFlags
 73flags[int]: the flags to add to the existing set.
 74
 75- properties
 76action[string]: An action constant from [[Titanium.Android]]
 77url[string]: The URL to a Titanium Javascript Activity
 78data[string]: The Intent's Data URI. See also Android's [Intent.setData](http://developer.android.com/reference/android/content/Intent.html#setData(android.net.Uri))
 79className[string]: The Java class name of the activity (packageName must also be set)
 80packageName[string]: The fully-qualified Java package name of the activity
 81type[string]: The mime type for this Intent. See also Android's [Intent.setType](http://developer.android.com/reference/android/content/Intent.html#setType(java.lang.String))
 82flags[int]: Intent flags. See the flags constants in `Titanium.Android`.
 83
 84- example : Create an Intent for Launching an Activity
 85~~~
 86var intent = Ti.Android.createIntent({
 87	action: Ti.Android.ACTION_MAIN,
 88	url: 'activity1.js'
 89});
 90intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
 91Ti.Android.currentActivity.startActivity(intent);
 92~~~
 93
 94- example : Create an Intent to get a Contact URI from the user's contacts
 95~~~
 96var intent = Ti.Android.createIntent({
 97	action: Ti.Android.ACTION_GET_CONTENT,
 98	type: "vnd.android.cursor.item/phone"
 99});
100~~~
101
102- example : Pick a Photo from the Photo Gallery
103~~~
104var intent = Ti.Android.createIntent({
105	action: Ti.Android.ACTION_PICK,
106	type: "image/*"
107});
108intent.addCategory(Ti.Android.CATEGORY_DEFAULT);
109~~~
110
111
112**/
113
114#if androidos
115@:native("Titanium.Android.Intent")
116extern class Intent
117{
118	// static constructor
119	public inline static function create():Intent
120		return titanium.mobile.Android.createIntent()
121		
122	// properties
123	public var action:String;
124	public var url:String;
125	public var data:String;
126	public var className:String;
127	public var packageName:String;
128	public var type:String;
129	public var flags:Int;
130
131	// methods
132	public function putExtra(name:String, value:Dynamic):Void;
133	public function putExtraUri(name:String, value:Dynamic):Void;
134	public function hasExtra(name:String):Bool;
135	public function addCategory(name:String):Void;
136	public function getStringExtra(name:String):String;
137	public function getBooleanExtra(name:String):Bool;
138	public function getIntExtra(name:String):Int;
139	public function getLongExtra(name:String):Int;
140	public function getDoubleExtra(name:String):Float;
141	public function getData():Dynamic;
142	public function addFlags(flags:Int):Void;
143}
144#end