android :: Intent :: add_category
Add category to the intentandroid :: Intent :: add_extra_array_list_of_int
Adds extra data corresponding toArrayList<Integer>
java type
android :: Intent :: add_extra_array_list_of_string
Adds extra data corresponding toArrayList<String>
java type
android :: Intent :: add_extra_array_of_bool
Adds extra data corresponding toboolean[]
java type
android :: Intent :: add_extra_array_of_byte
Adds extra data corresponding tobyte[]
java type
android :: Intent :: add_extra_array_of_char
Adds extra data corresponding tochar[]
java type
android :: Intent :: add_extra_array_of_char_sequence
Adds extra data corresponding toCharSequence[]
java type
android :: Intent :: add_extra_array_of_double
Adds extra data corresponding todouble[]
java type
android :: Intent :: add_extra_array_of_float
Adds extra data corresponding tofloat[]
java type
android :: Intent :: add_extra_array_of_int
Adds extra data corresponding toint[]
java type
android :: Intent :: add_extra_array_of_long
Adds extra data corresponding tolong[]
java type
android :: Intent :: add_extra_array_of_short
Adds extra data corresponding toshort[]
java type
android :: Intent :: add_extra_array_of_string
Adds extra data corresponding toString[]
java type
android :: Intent :: add_extra_bool
Adds extra data corresponding toboolean
java type
android :: Intent :: add_extra_bundle
Adds extra data corresponding tobundle
java type
android :: Intent :: add_extra_byte
Adds extra data corresponding tobyte
java type
android :: Intent :: add_extra_char
Adds extra data corresponding tochar
java type
android :: Intent :: add_extra_char_sequence
Adds extra data corresponding toCharSequence
java type
android :: Intent :: add_extra_double
Adds extra data corresponding todouble
java type
android :: Intent :: add_extra_float
Adds extra data corresponding tofloat
java type
android :: Intent :: add_extra_int
Adds extra data corresponding toint
java type
android :: Intent :: add_extra_long
Adds extra data corresponding tolong
java type
android :: Intent :: add_extra_short
Adds extra data corresponding toshort
java type
android :: Intent :: add_extra_string
Adds extra data corresponding toString
java type
android :: Intent :: categories
Returns all the intent categories ornull
if none
android :: Intent :: defaultinit
android :: Intent :: extra_bool
Retrieves theBool
extra stored with the corresponding name
android :: Intent :: extra_bool_array
Retrieves theArray[Bool]
extra stored as Java boolean[]
with the
android :: Intent :: extra_byte
Retrieves theInt
extra stored as Java byte
with the corresponding name
android :: Intent :: extra_byte_array
Retrieves theArray[Int]
extra stored as Java byte[]
with the
android :: Intent :: extra_char
Retrieves theChar
extra stored as Java char
with the
android :: Intent :: extra_char_array
Retrieves theArray[Char]
extra stored as Java char[]
with the
android :: Intent :: extra_char_sequence
Retrieves theString
extra stored as Java CharSequence
with the
android :: Intent :: extra_char_sequence_array
Retrieves theArray[String]
extra stored as Java CharSequence[]
android :: Intent :: extra_char_sequence_array_list_extra
Retrieves theArray[String]
extra stored as Java ArrayList<CharSequence>
android :: Intent :: extra_double
Retrieves theFloat
extra stored as Java double
with the corresponding
android :: Intent :: extra_double_array
Retrieves theArray[Float]
extra stored as Java double[]
with the
android :: Intent :: extra_float
Retrieves theFloat
extra stored as Java float
with the corresponding
android :: Intent :: extra_float_array
Retrieves theArray[Float]
extra stored as Java float[]
with the
android :: Intent :: extra_int_array
Retrieves theArray[Int]
extra stored as Java int[]
with the
android :: Intent :: extra_long
Retrieves theInt
extra stored as Java long
with the corresponding
android :: Intent :: extra_long_array
Retrieves theArray[Int]
extra stored as Java long[]
with the
android :: Intent :: extra_short
Retrieves theInt
extra stored as Java short
with the corresponding
android :: Intent :: extra_short_array
Retrieves theArray[Int]
extra stored as Java short[]
with the
android :: Intent :: extra_string
Retrieves theString
extra stored as Java String
with the corresponding
android :: Intent :: extra_string_array
Retrieves theArray[String]
extra stored as Java String[]
with the
android :: Intent :: extra_string_array_list
Retrieves theArray[String]
extra stored as Java ArrayList<String>
android :: Intent :: has_category
Returnstrue
if the intent contains the given category
android :: Intent :: mime_type=
Sets an explicit MIME data type to be handled by the intent, for exampleandroid :: Intent :: package_name
Returns the package name the intent resolution is limited toandroid :: Intent :: remove_category
Removes the given categoryandroid :: Intent :: set_class_name
Specify the class to be launched by the intentandroid :: Intent :: add_category
Add category to the intentandroid :: Intent :: add_extra_array_list_of_int
Adds extra data corresponding toArrayList<Integer>
java type
android :: Intent :: add_extra_array_list_of_string
Adds extra data corresponding toArrayList<String>
java type
android :: Intent :: add_extra_array_of_bool
Adds extra data corresponding toboolean[]
java type
android :: Intent :: add_extra_array_of_byte
Adds extra data corresponding tobyte[]
java type
android :: Intent :: add_extra_array_of_char
Adds extra data corresponding tochar[]
java type
android :: Intent :: add_extra_array_of_char_sequence
Adds extra data corresponding toCharSequence[]
java type
android :: Intent :: add_extra_array_of_double
Adds extra data corresponding todouble[]
java type
android :: Intent :: add_extra_array_of_float
Adds extra data corresponding tofloat[]
java type
android :: Intent :: add_extra_array_of_int
Adds extra data corresponding toint[]
java type
android :: Intent :: add_extra_array_of_long
Adds extra data corresponding tolong[]
java type
android :: Intent :: add_extra_array_of_short
Adds extra data corresponding toshort[]
java type
android :: Intent :: add_extra_array_of_string
Adds extra data corresponding toString[]
java type
android :: Intent :: add_extra_bool
Adds extra data corresponding toboolean
java type
android :: Intent :: add_extra_bundle
Adds extra data corresponding tobundle
java type
android :: Intent :: add_extra_byte
Adds extra data corresponding tobyte
java type
android :: Intent :: add_extra_char
Adds extra data corresponding tochar
java type
android :: Intent :: add_extra_char_sequence
Adds extra data corresponding toCharSequence
java type
android :: Intent :: add_extra_double
Adds extra data corresponding todouble
java type
android :: Intent :: add_extra_float
Adds extra data corresponding tofloat
java type
android :: Intent :: add_extra_int
Adds extra data corresponding toint
java type
android :: Intent :: add_extra_long
Adds extra data corresponding tolong
java type
android :: Intent :: add_extra_short
Adds extra data corresponding toshort
java type
android :: Intent :: add_extra_string
Adds extra data corresponding toString
java type
android :: Intent :: categories
Returns all the intent categories ornull
if none
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
android :: Intent :: defaultinit
android :: Intent :: extra_bool
Retrieves theBool
extra stored with the corresponding name
android :: Intent :: extra_bool_array
Retrieves theArray[Bool]
extra stored as Java boolean[]
with the
android :: Intent :: extra_byte
Retrieves theInt
extra stored as Java byte
with the corresponding name
android :: Intent :: extra_byte_array
Retrieves theArray[Int]
extra stored as Java byte[]
with the
android :: Intent :: extra_char
Retrieves theChar
extra stored as Java char
with the
android :: Intent :: extra_char_array
Retrieves theArray[Char]
extra stored as Java char[]
with the
android :: Intent :: extra_char_sequence
Retrieves theString
extra stored as Java CharSequence
with the
android :: Intent :: extra_char_sequence_array
Retrieves theArray[String]
extra stored as Java CharSequence[]
android :: Intent :: extra_char_sequence_array_list_extra
Retrieves theArray[String]
extra stored as Java ArrayList<CharSequence>
android :: Intent :: extra_double
Retrieves theFloat
extra stored as Java double
with the corresponding
android :: Intent :: extra_double_array
Retrieves theArray[Float]
extra stored as Java double[]
with the
android :: Intent :: extra_float
Retrieves theFloat
extra stored as Java float
with the corresponding
android :: Intent :: extra_float_array
Retrieves theArray[Float]
extra stored as Java float[]
with the
android :: Intent :: extra_int_array
Retrieves theArray[Int]
extra stored as Java int[]
with the
android :: Intent :: extra_long
Retrieves theInt
extra stored as Java long
with the corresponding
android :: Intent :: extra_long_array
Retrieves theArray[Int]
extra stored as Java long[]
with the
android :: Intent :: extra_short
Retrieves theInt
extra stored as Java short
with the corresponding
android :: Intent :: extra_short_array
Retrieves theArray[Int]
extra stored as Java short[]
with the
android :: Intent :: extra_string
Retrieves theString
extra stored as Java String
with the corresponding
android :: Intent :: extra_string_array
Retrieves theArray[String]
extra stored as Java String[]
with the
android :: Intent :: extra_string_array_list
Retrieves theArray[String]
extra stored as Java ArrayList<String>
android :: Intent :: has_category
Returnstrue
if the intent contains the given category
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
android :: Intent :: mime_type=
Sets an explicit MIME data type to be handled by the intent, for examplecore :: Object :: output_class_name
Display class name on stdout (debug only).android :: Intent :: package_name
Returns the package name the intent resolution is limited toandroid :: Intent :: remove_category
Removes the given categoryandroid :: Intent :: set_class_name
Specify the class to be launched by the intent
# Services allowing to launch an activity and start/stop services
class Intent
protected var intent: NativeIntent = (new NativeIntent).new_global_ref is lazy
# The general action to be performed
#
# ~~~nitish
# # TODO better example
# intent.action = intent_action.view.to_s
# ~~~
fun action=(action: String)
do
sys.jni_env.push_local_frame(1)
intent.action = action.to_java_string
sys.jni_env.pop_local_frame
end
# Returns the action to be performed or `null` if none
fun action: nullable String do
var result = intent.action.to_s
if result == "" then return null
return result
end
# Add category to the intent
# Only activities providing all of the requested categories will be used
#
# ~~~nitish
# # TODO better example
# intent.add_category(intent_category.home.to_s)
# ~~~
# Returns `self` allowing fluent programming
fun add_category(category: String): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_category(category.to_java_string)
sys.jni_env.pop_local_frame
return self
end
# Returns all the intent categories or `null` if none
fun categories: nullable HashSet[String]
do
var string_set = intent.categories
if string_set.is_empty then return null
return string_set
end
# Sets the data uri the intent is working on
# Automatically clears the type field set using `mime_type=` method as it
# uses the data uri to determine the MIME type
# Note: The Uri string has to comply with RFC 2396
fun data=(data_uri: String)
do
sys.jni_env.push_local_frame(1)
intent.data = data_uri.to_java_string
sys.jni_env.pop_local_frame
end
# Returns the data Uri the data is operating on or `null` if none
fun data: nullable String
do
var result = intent.data.to_s
if result == "" then return null
return result
end
# Sets an explicit MIME data type to be handled by the intent, for example
# the return data type
# Automatically clears the data type field set using `data=` method
fun mime_type=(mime_type: String)
do
sys.jni_env.push_local_frame(1)
intent.mime_type = mime_type.to_java_string
sys.jni_env.pop_local_frame
end
# Add a flag to be used by the intent
#
# ~~~nitish
# # TODO better example
# intent.add_flags(intent_flag.activity_new_task)
# ~~~
# Returns `self` allowing fluent programming
fun add_flags(flags: Int): Intent
do
intent.add_flags(flags)
return self
end
# Returns an `Int` representing all the intent flags
fun flags: Int do return intent.flags
# Returns the package name the intent resolution is limited to
# Returns `null` if not defined
fun package_name: nullable String do
var result = intent.get_package.to_s
if result == "" then return null
return result
end
# Returns the set MIME and `null` if none
fun type_name: nullable String do
var result = intent.get_type.to_s
if result == "" then return null
return result
end
# Returns `true` if the intent contains the given category
fun has_category(category: String): Bool
do
sys.jni_env.push_local_frame(1)
var return_value = intent.has_category(category.to_java_string)
sys.jni_env.pop_local_frame
return return_value
end
# Returns `true` if the intent contains the given extra
fun has_extra(extra: String): Bool
do
sys.jni_env.push_local_frame(1)
var return_value = intent.has_extra(extra.to_java_string)
sys.jni_env.pop_local_frame
return return_value
end
# Removes the given category
# Returns `self` allowing fluent programming
fun remove_category(category: String): Intent
do
sys.jni_env.push_local_frame(1)
intent.remove_category(category.to_java_string)
sys.jni_env.pop_local_frame
return self
end
# Removes the given extra
# Returns `self` allowing fluent programming
fun remove_extra(name: String): Intent
do
sys.jni_env.push_local_frame(1)
intent.remove_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return self
end
# Retrieves the `Array[Bool]` extra stored as Java `boolean[]` with the
# corresponding name
fun extra_bool_array(name: String): Array[Bool]
do
sys.jni_env.push_local_frame(1)
var nit_array = intent.boolean_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return nit_array
end
# Retrieves the `Bool` extra stored with the corresponding name
fun extra_bool(name: String, def_value: Bool): Bool
do
sys.jni_env.push_local_frame(1)
var nit_bool = intent.boolean_extra(name.to_java_string, def_value)
sys.jni_env.pop_local_frame
return nit_bool
end
# Retrieves the `Array[Int]` extra stored as Java `byte[]` with the
# corresponding name
fun extra_byte_array(name: String): Array[Int]
do
sys.jni_env.push_local_frame(1)
var nit_array = intent.byte_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return nit_array
end
# Retrieves the `Int` extra stored as Java `byte` with the corresponding name
fun extra_byte(name: String, def_value: Int): Int
do
sys.jni_env.push_local_frame(1)
var nit_int = intent.byte_extra(name.to_java_string, def_value)
sys.jni_env.pop_local_frame
return nit_int
end
# Retrieves the `Array[Char]` extra stored as Java `char[]` with the
# corresponding name
# FIXME: Java's `char` are encoded on 16-bits whereas Nit's are on 8-bits.
fun extra_char_array(name: String): Array[Char]
do
sys.jni_env.push_local_frame(1)
var nit_array = intent.char_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return nit_array
end
# Retrieves the `Char` extra stored as Java `char` with the
# corresponding name
# FIXME: Java's `char` are encoded on 16-bits whereas Nit's are on 8-bits.
fun extra_char(name: String, def_value: Char): Char
do
sys.jni_env.push_local_frame(1)
var nit_char = intent.char_extra(name.to_java_string, def_value)
sys.jni_env.pop_local_frame
return nit_char
end
# Retrieves the `String` extra stored as Java `CharSequence` with the
# corresponding name
fun extra_char_sequence(name: String, def_value: String ): String
do
sys.jni_env.push_local_frame(1)
var nit_charseq =
intent.char_sequence_extra(name.to_java_string).to_s
sys.jni_env.pop_local_frame
return nit_charseq
end
# Retrieves the `Array[String]` extra stored as Java `ArrayList<CharSequence>`
# with the corresponding name
fun extra_char_sequence_array_list_extra(name: String): Array[String]
do
sys.jni_env.push_local_frame(1)
var string_array = intent.char_sequence_array_list_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return string_array
end
# Retrieves the `Array[String]` extra stored as Java `CharSequence[]`
# with the corresponding name
fun extra_char_sequence_array(name: String): Array[String]
do
sys.jni_env.push_local_frame(1)
var string_array = intent.char_sequence_array_list_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return string_array
end
# Retrieves the `Array[Float]` extra stored as Java `double[]` with the
# corresponding name
fun extra_double_array(name: String): Array[Float]
do
sys.jni_env.push_local_frame(1)
var nit_array = intent.double_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return nit_array
end
# Retrieves the `Float` extra stored as Java `double` with the corresponding
# name
fun extra_double(name: String, def_value: Float): Float
do
sys.jni_env.push_local_frame(1)
var nit_float = intent.double_extra(name.to_java_string, def_value)
sys.jni_env.pop_local_frame
return nit_float
end
# Retrieves the `Array[Float]` extra stored as Java `float[]` with the
# corresponding name
fun extra_float_array(name: String): Array[Float]
do
sys.jni_env.push_local_frame(1)
var nit_array = intent.float_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return nit_array
end
# Retrieves the `Float` extra stored as Java `float` with the corresponding
# name
fun extra_float(name: String, def_value: Float): Float
do
sys.jni_env.push_local_frame(1)
var nit_float = intent.float_extra(name.to_java_string, def_value)
sys.jni_env.pop_local_frame
return nit_float
end
# Retrieves the `Array[Int]` extra stored as Java `int[]` with the
# corresponding name
fun extra_int_array(name: String): Array[Int]
do
sys.jni_env.push_local_frame(1)
var nit_array = intent.int_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return nit_array
end
# Retrieves the `Int` extra stored as Java `int` with the corresponding
# name
fun extra_int(name: String, def_value: Int): Int
do
sys.jni_env.push_local_frame(1)
var nit_int = intent.int_extra(name.to_java_string, def_value)
sys.jni_env.pop_local_frame
return nit_int
end
# Retrieves the `Array[Int]` extra stored as Java `long[]` with the
# corresponding name
fun extra_long_array(name: String): Array[Int]
do
sys.jni_env.push_local_frame(1)
var nit_array = intent.long_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return nit_array
end
# Retrieves the `Int` extra stored as Java `long` with the corresponding
# name
fun extra_long(name: String, def_value: Int): Int
do
sys.jni_env.push_local_frame(1)
var nit_int = intent.long_extra(name.to_java_string, def_value)
sys.jni_env.pop_local_frame
return nit_int
end
# Retrieves the `Array[Int]` extra stored as Java `short[]` with the
# corresponding name
fun extra_short_array(name: String): Array[Int]
do
sys.jni_env.push_local_frame(1)
var nit_array = intent.short_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return nit_array
end
# Retrieves the `Int` extra stored as Java `short` with the corresponding
# name
fun extra_short(name: String, def_value: Int): Int
do
sys.jni_env.push_local_frame(1)
var nit_int = intent.short_extra(name.to_java_string, def_value)
sys.jni_env.pop_local_frame
return nit_int
end
# Retrieves the `Array[String]` extra stored as Java `String[]` with the
# corresponding name
fun extra_string_array(name: String): Array[String]
do
sys.jni_env.push_local_frame(1)
var string_array = intent.string_array_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return string_array
end
# Retrieves the `Array[String]` extra stored as Java `ArrayList<String>`
# with the corresponding name
fun extra_string_array_list(name: String): Array[String]
do
sys.jni_env.push_local_frame(1)
var string_array = intent.string_array_list_extra(name.to_java_string)
sys.jni_env.pop_local_frame
return string_array
end
# Retrieves the `String` extra stored as Java `String` with the corresponding
# name
fun extra_string(name: String): String
do
sys.jni_env.push_local_frame(1)
var nit_java_string = intent.string_extra(name.to_java_string).to_s
sys.jni_env.pop_local_frame
return nit_java_string
end
# Adds extra data corresponding to `double` java type
# Returns `self` allowing fluent programming
fun add_extra_double(name: String, value: Float): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_double(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `double[]` java type
# Returns `self` allowing fluent programming
fun add_extra_array_of_double(name: String, value: Array[Float]): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_of_double(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `char` java type
# Returns `self` allowing fluent programming
# FIXME: Java's `char` are encoded on 16-bits whereas Nit's are on 8-bits.
fun add_extra_char(name: String, value: Char): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_char(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `char[]` java type
# Returns `self` allowing fluent programming
# FIXME: Java's `char` are encoded on 16-bits whereas Nit's are on 8-bits.
fun add_extra_array_of_char(name: String, value: Array[Char]): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_of_char(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `CharSequence` java type
# Returns `self` allowing fluent programming
fun add_extra_char_sequence(name: String, value: String): Intent
do
sys.jni_env.push_local_frame(2)
intent.add_extra_char_sequence(name.to_java_string, value.to_java_string)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `CharSequence[]` java type
# Returns `self` allowing fluent programming
fun add_extra_array_of_char_sequence(name: String, value: Array[String]): Intent
do
sys.jni_env.push_local_frame(value.length + 1)
var java_string_array = new Array[JavaString]
for element in value do
java_string_array.push(element.to_java_string)
end
intent.add_extra_array_of_char_sequence(name.to_java_string, java_string_array)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `bundle` java type
# Returns `self` allowing fluent programming
fun add_extra_bundle(name: String, value: NativeBundle): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_bundle(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `int` java type
# Returns `self` allowing fluent programming
# *Be aware of possible integer overflow as Nit `Int` corresponds to*
# *java `long` and the expected value is a java `int`*
# Consider using add_extra_long instead
fun add_extra_int(name: String, value: Int): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_int(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `int[]` java type
# Returns `self` allowing fluent programming
# *Be aware of possible integer overflow as Nit `Int` corresponds to*
# *java `long` and the expected value is a java `int[]`*
# Consider using add_extra_array_of_long instead
fun add_extra_array_of_int(name: String, value: Array[Int]): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_of_int(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `ArrayList<Integer>` java type
# Returns `self` allowing fluent programming
# *Be aware of possible integer overflow as Nit `Int` corresponds to*
# *java `long` and the expected value is a java `ArrayList<Integer>`*
# Consider using add_extra_array_of_long instead
fun add_extra_array_list_of_int(name: String, value: Array[Int]): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_list_of_int(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `byte` java type
# Returns `self` allowing fluent programming
# *Be aware of possible integer overflow as Nit `Int` corresponds to*
# *java `long` and the expected value is a java `byte`*
# Consider using add_extra_array_of_long instead
fun add_extra_byte(name: String, value: Int): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_byte(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `byte[]` java type
# Returns `self` allowing fluent programming
# *Be aware of possible integer overflow as Nit `Int` corresponds to*
# *java `long` and the expected value is a java `byte[]`*
# Consider using add_extra_array_of_long instead
fun add_extra_array_of_byte(name: String, value: Int): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_of_byte(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `long` java type
# Returns `self` allowing fluent programming
fun add_extra_long(name: String, value: Int): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_long(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `long[]` java type
# Returns `self` allowing fluent programming
fun add_extra_array_of_long(name: String, value: Array[Int]): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_of_long(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `float` java type
# Returns `self` allowing fluent programming
# *Be aware of possible loss of precision as Nit `Float` corresponds to*
# *java `double` and the expected value is a java `float`*
# Consider using add_extra_double
fun add_extra_float(name: String, value: Float): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_float(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `float[]` java type
# Returns `self` allowing fluent programming
# *Be aware of possible loss of precision as Nit `Float` corresponds to*
# *java `double` and the expected value is a java `float[]`*
# Consider using add_extra_array_of_double
fun add_extra_array_of_float(name: String, value: Array[Float]): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_of_float(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `String` java type
# Returns `self` allowing fluent programming
fun add_extra_string(name: String, value: String): Intent
do
sys.jni_env.push_local_frame(2)
intent.add_extra_string(name.to_java_string, value.to_java_string)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `String[]` java type
# Returns `self` allowing fluent programming
fun add_extra_array_of_string(name: String, value: Array[String]): Intent
do
sys.jni_env.push_local_frame(value.length + 1)
var java_string_array = new Array[JavaString]
for element in value do
java_string_array.push(element.to_java_string)
end
intent.add_extra_array_of_string(name.to_java_string, java_string_array)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `ArrayList<String>` java type
# Returns `self` allowing fluent programming
fun add_extra_array_list_of_string(name: String, value: Array[String]): Intent
do
sys.jni_env.push_local_frame(value.length + 1)
var java_string_array = new Array[JavaString]
for element in value do
java_string_array.push(element.to_java_string)
end
intent.add_extra_array_list_of_string(name.to_java_string, java_string_array)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `boolean` java type
# Returns `self` allowing fluent programming
fun add_extra_bool(name: String, value: Bool): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_bool(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `boolean[]` java type
# Returns `self` allowing fluent programming
fun add_extra_array_of_bool(name: String, value: Array[Bool]): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_of_bool(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `short` java type
# Returns `self` allowing fluent programming
# *Be aware of possible integer overflow as Nit `Int` corresponds to*
# *java `long` and the expected value is a java `short`*
# Consider using add_extra_long instead
fun add_extra_short(name: String, value: Int): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_short(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Adds extra data corresponding to `short[]` java type
# Returns `self` allowing fluent programming
# *Be aware of possible integer overflow as Nit `Int` corresponds to*
# *java `long` and the expected value is a java `short[]`*
# Consider using add_extra_array_of_long instead
fun add_extra_array_of_short(name: String, value: Array[Int]): Intent
do
sys.jni_env.push_local_frame(1)
intent.add_extra_array_of_short(name.to_java_string, value)
sys.jni_env.pop_local_frame
return self
end
# Store `value` as a serialized Json string
# java method according to value type
# Returns `self` allowing fluent programming
fun []=(name: String, value: nullable Serializable): Intent
do
var serialized_string = new StringWriter
var serializer = new JsonSerializer(serialized_string)
serializer.serialize(value)
add_extra_string(name, serialized_string.to_s)
return self
end
# Retrieve an `Object` stored via `[]=` function
fun [](name: String): nullable Object
do
var serialized_string = self.extra_string(name)
if serialized_string == "" then return null
var deserializer = new JsonDeserializer(serialized_string)
return deserializer.deserialize
end
# Specify the class to be launched by the intent
fun set_class_name(package_name: String, class_name: String): Intent
do
sys.jni_env.push_local_frame(2)
intent.set_class_name(package_name.to_java_string, class_name.to_java_string)
sys.jni_env.pop_local_frame
return self
end
# Deletes intent global reference
fun destroy do self.intent.delete_global_ref
# Returns a human readable representation of the intent
redef fun to_s do return intent.to_native_s.to_s
end
lib/android/intent/intent_api10.nit:630,1--1307,3
redef class Intent
fun set_data_and_normalize(data_uri: String): Intent
do
sys.jni_env.push_local_frame(1)
intent.set_data_and_normalize(data_uri.to_java_string)
sys.jni_env.pop_local_frame
return self
end
fun set_data_and_type_and_normalize(data_uri: String, type_name: String): Intent
do
sys.jni_env.push_local_frame(2)
intent.set_data_and_type_and_normalize(data_uri.to_java_string, type_name.to_java_string)
sys.jni_env.pop_local_frame
return self
end
fun set_mime_type_and_normalize(mime_type: String): Intent
do
sys.jni_env.push_local_frame(1)
intent.set_mime_type_and_normalize(mime_type.to_java_string)
sys.jni_env.pop_local_frame
return self
end
end
lib/android/intent/intent_api16.nit:41,1--65,3