Skip to content

Commit

Permalink
Added android:launchMode configurability (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxded authored Nov 21, 2020
1 parent b5844d8 commit aff0632
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cargo-apk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

# 0.5.5 (2020-11-21)

- Updated to use [ndk-build 0.1.3](../ndk-build/CHANGELOG.md#012-2020-11-21)

# 0.5.4 (2020-11-01)

- Added support for activity metadata entries.
Expand Down
4 changes: 2 additions & 2 deletions cargo-apk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-apk"
version = "0.5.4"
version = "0.5.5"
authors = ["The Rust Windowing contributors"]
edition = "2018"
description = "Helps cargo build APKs"
Expand All @@ -16,7 +16,7 @@ cargo-subcommand = "0.4.6"
dunce = "1.0"
env_logger = "0.7.1"
log = "0.4.8"
ndk-build = { path = "../ndk-build", version = "0.1.2" }
ndk-build = { path = "../ndk-build", version = "0.1.3" }
serde = "1.0.104"
thiserror = "1.0"
toml = "0.5.6"
5 changes: 5 additions & 0 deletions cargo-apk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ icon = "@mipmap/ic_launcher"
# Defaults to false.
fullscreen = false

# Set the instruction of how the activity should be launched
# See https://developer.android.com/guide/topics/manifest/activity-element#lmode
# Defaults to standard.
launch_mode = "standard"

# Set the minimum required OpenGL ES version.
# Defaults to [3, 1]
opengles_version = [3, 0]
Expand Down
4 changes: 4 additions & 0 deletions ndk-build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

# 0.1.3 (2020-11-21)

- `android:launchMode` is configurable.

# 0.1.2 (2020-09-15)

- `android:label` is configurable.
Expand Down
2 changes: 1 addition & 1 deletion ndk-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ndk-build"
version = "0.1.2"
version = "0.1.3"
authors = ["The Rust Windowing contributors"]
edition = "2018"
description = "Utilities for building Android binaries"
Expand Down
1 change: 1 addition & 0 deletions ndk-build/src/apk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl ApkConfig {
icon: metadata.icon,
fullscreen: metadata.fullscreen.unwrap_or(false),
orientation: metadata.orientation,
launch_mode: metadata.launch_mode,
application_metadatas,
activity_metadatas,
};
Expand Down
1 change: 1 addition & 0 deletions ndk-build/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub struct Metadata {
pub icon: Option<String>,
pub fullscreen: Option<bool>,
pub orientation: Option<String>,
pub launch_mode: Option<String>,
pub opengles_version: Option<(u8, u8)>,
pub feature: Option<Vec<FeatureConfig>>,
pub permission: Option<Vec<PermissionConfig>>,
Expand Down
4 changes: 4 additions & 0 deletions ndk-build/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct Manifest {
pub icon: Option<String>,
pub fullscreen: bool,
pub orientation: Option<String>,
pub launch_mode: Option<String>,
pub debuggable: bool,
pub split: Option<String>,
pub application_metadatas: Vec<ApplicationMetadata>,
Expand Down Expand Up @@ -48,6 +49,7 @@ impl Manifest {
};

let orientation = self.orientation.as_deref().unwrap_or("unspecified");
let launch_mode = self.launch_mode.as_deref().unwrap_or("standard");

let features: Vec<String> = self.features.iter().map(|f| f.to_string()).collect();
let permissions: Vec<String> = self.permissions.iter().map(|p| p.to_string()).collect();
Expand Down Expand Up @@ -88,6 +90,7 @@ impl Manifest {
android:name="android.app.NativeActivity"
android:label="{package_label}"
android:screenOrientation="{orientation}"
android:launchMode="{launch_mode}"
android:configChanges="orientation|keyboardHidden|screenSize">
<meta-data android:name="android.app.lib_name" android:value="{target_name}" />
{activity_metadatas}
Expand All @@ -111,6 +114,7 @@ impl Manifest {
icon = icon,
fullscreen = fullscreen,
orientation = orientation,
launch_mode = launch_mode,
application_metadatas = application_metadatas.join("\n"),
activity_metadatas = activity_metadatas.join("\n"),
debuggable = self.debuggable,
Expand Down

0 comments on commit aff0632

Please sign in to comment.