From e3ba0e44173bd373d1111fc6d87fc4e61faebf9f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 9 Feb 2020 22:30:54 +0200 Subject: [PATCH] Add support for the orientation tag in Android manifest --- source/androidapplicationcomponent.cpp | 2 ++ source/androidapplicationcomponent.h | 1 + source/androidmanifestfile.cpp | 5 +++++ source/androidmanifestfile.h | 3 +++ source/androidmanifestgenerator.cpp | 6 +++++- 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/source/androidapplicationcomponent.cpp b/source/androidapplicationcomponent.cpp index 85873d4..99f1440 100644 --- a/source/androidapplicationcomponent.cpp +++ b/source/androidapplicationcomponent.cpp @@ -29,6 +29,7 @@ void AndroidApplicationComponent::create_targets() const contents.push_back(inst->get_real_target()); AndroidManifestFile *manifest = new AndroidManifestFile(builder, *this); + manifest->set_orientation(orientation); for(set::const_iterator i=permissions.begin(); i!=permissions.end(); ++i) manifest->add_permission(*i); @@ -84,6 +85,7 @@ void AndroidApplicationComponent::create_targets() const AndroidApplicationComponent::Loader::Loader(AndroidApplicationComponent &c): DataFile::DerivedObjectLoader(c) { + add("orientation", &AndroidApplicationComponent::orientation); add("permission", &Loader::permission); } diff --git a/source/androidapplicationcomponent.h b/source/androidapplicationcomponent.h index 35984ea..af465e5 100644 --- a/source/androidapplicationcomponent.h +++ b/source/androidapplicationcomponent.h @@ -17,6 +17,7 @@ public: }; private: + std::string orientation; std::set permissions; public: diff --git a/source/androidmanifestfile.cpp b/source/androidmanifestfile.cpp index 1653e0a..d20be98 100644 --- a/source/androidmanifestfile.cpp +++ b/source/androidmanifestfile.cpp @@ -20,6 +20,11 @@ void AndroidManifestFile::set_native_library(SharedLibrary *lib) native_lib = lib; } +void AndroidManifestFile::set_orientation(const string &ori) +{ + orientation = ori; +} + void AndroidManifestFile::add_permission(const string &perm) { permissions.insert(perm); diff --git a/source/androidmanifestfile.h b/source/androidmanifestfile.h index 0dc7792..8bd5fe3 100644 --- a/source/androidmanifestfile.h +++ b/source/androidmanifestfile.h @@ -15,6 +15,7 @@ class AndroidManifestFile: public FileTarget private: SharedLibrary *native_lib; std::set permissions; + std::string orientation; public: AndroidManifestFile(Builder &, const AndroidApplicationComponent &); @@ -25,7 +26,9 @@ public: SharedLibrary *get_native_library() const { return native_lib; } void add_permission(const std::string &); + void set_orientation(const std::string &); const std::set &get_permissions() const { return permissions; } + const std::string &get_orientation() const { return orientation; } }; #endif diff --git a/source/androidmanifestgenerator.cpp b/source/androidmanifestgenerator.cpp index 156dfb3..a7cda04 100644 --- a/source/androidmanifestgenerator.cpp +++ b/source/androidmanifestgenerator.cpp @@ -47,7 +47,11 @@ void AndroidManifestGenerator::Worker::main() IO::print(out, "\t\n", pkg.get_label(), debuggable); if(SharedLibrary *native_lib = manifest.get_native_library()) { - out.write("\t\t\n"); + out.write("\t\t\n"); IO::print(out, "\t\t\t\n", native_lib->get_libname()); out.write("\t\t\t\n"); out.write("\t\t\t\t\n"); -- 2.45.2