android_manifest/action.rs
1use serde::{Deserialize, Serialize};
2
3/// Adds an action to an intent filter.
4///
5/// An [`<intent-filter>`] element must contain one or more `<action>` elements. If there
6/// are no `<action>` elements in an intent filter, the filter doesn't accept any
7/// [`Intent`] objects. See [`Intents and Intent Filters`] for details on intent filters
8/// and the role of action specifications within a filter.
9///
10/// ## XML Syntax
11/// ```xml
12/// <action android:name="string" />
13/// ```
14///
15/// ## Contained in
16/// * [`<intent-filter>`]
17///
18/// ## Introduced in
19/// API Level 1
20///
21/// [`<intent-filter>`]: crate::IntentFilter
22/// [`Intent`]: https://developer.android.com/reference/android/content/Intent
23/// [`Intents and Intent Filters`]: https://developer.android.com/guide/components/intents-filters
24#[derive(
25 Debug, Deserialize, Serialize, YaSerialize, YaDeserialize, PartialEq, Eq, Default, Clone,
26)]
27pub struct Action {
28 /// The name of the action. Some standard actions are defined in the [`Intent`] class
29 /// as `ACTION_string` constants. To assign one of these actions to this
30 /// attribute, prepend `"android.intent.action."` o the `string` that follows
31 /// `ACTION_`. For example, for `ACTION_MAIN`, use "`android.intent.action.MAIN`"
32 /// and for `ACTION_WEB_SEARCH`, use "`android.intent.action.WEB_SEARCH`".
33 ///
34 /// For actions you define, it's best to use your app's package name as a prefix to
35 /// ensure uniqueness.
36 ///
37 /// ## XML Examples
38 /// A `TRANSMOGRIFY` action might be specified as follows:
39 /// ```xml
40 /// <action android:name="com.example.project.TRANSMOGRIFY" />
41 /// ```
42 ///
43 /// [`Intent`]: https://developer.android.com/reference/android/content/Intent
44 #[yaserde(attribute, prefix = "android")]
45 pub name: Option<String>,
46}