/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

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