From ce2793ca2d4afd99548ec9e19c6386e319118f4f Mon Sep 17 00:00:00 2001 From: hogliux Date: Fri, 24 Jul 2015 18:21:52 +0100 Subject: [PATCH] Add option in Introjucer to specify custom Android Activity sub-class --- .../Project Saving/jucer_ProjectExport_Android.h | 15 ++++++++++++++- .../Introjucer/Source/Utility/jucer_PresetIDs.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h index e0afa9c077..522fd747f8 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h @@ -79,6 +79,10 @@ public: props.add (new TextPropertyComponent (getActivityClassPathValue(), "Android Activity class name", 256, false), "The full java class name to use for the app's Activity class."); + props.add (new TextPropertyComponent (getActivitySubClassPathValue(), "Android Activity sub-class name", 256, false), + "If not empty, specifies the Android Activity class name stored in the app's manifest. " + "Use this if you would like to use your own Android Activity sub-class."); + props.add (new TextPropertyComponent (getVersionCodeValue(), "Android Version Code", 32, false), "An integer value that represents the version of the application code, relative to other versions."); @@ -127,6 +131,8 @@ public: Value getActivityClassPathValue() { return getSetting (Ids::androidActivityClass); } String getActivityClassPath() const { return settings [Ids::androidActivityClass]; } + Value getActivitySubClassPathValue() { return getSetting (Ids::androidActivitySubClassName); } + String getActivitySubClassPath() const { return settings [Ids::androidActivitySubClassName]; } Value getVersionCodeValue() { return getSetting (Ids::androidVersionCode); } String getVersionCodeString() const { return settings [Ids::androidVersionCode]; } Value getSDKPathValue() { return getSetting (Ids::androidSDKPath); } @@ -317,7 +323,7 @@ private: app->setAttribute ("android:hardwareAccelerated", "false"); // (using the 2D acceleration slows down openGL) XmlElement* act = app->createNewChildElement ("activity"); - act->setAttribute ("android:name", getActivityName()); + act->setAttribute ("android:name", getActivitySubClassName()); act->setAttribute ("android:label", "@string/app_name"); act->setAttribute ("android:configChanges", "keyboardHidden|orientation"); @@ -360,6 +366,13 @@ private: return getActivityClassPath().fromLastOccurrenceOf (".", false, false); } + String getActivitySubClassName() const + { + String activityPath = getActivitySubClassPath(); + + return (activityPath.isEmpty()) ? getActivityName() : activityPath.fromLastOccurrenceOf (".", false, false); + } + String getActivityClassPackage() const { return getActivityClassPath().upToLastOccurrenceOf (".", false, false); diff --git a/extras/Introjucer/Source/Utility/jucer_PresetIDs.h b/extras/Introjucer/Source/Utility/jucer_PresetIDs.h index 14da5e92fd..c4f29e7452 100644 --- a/extras/Introjucer/Source/Utility/jucer_PresetIDs.h +++ b/extras/Introjucer/Source/Utility/jucer_PresetIDs.h @@ -130,6 +130,7 @@ namespace Ids DECLARE_ID (showAllCode); DECLARE_ID (useLocalCopy); DECLARE_ID (androidActivityClass); + DECLARE_ID (androidActivitySubClassName); DECLARE_ID (androidVersionCode); DECLARE_ID (androidSDKPath); DECLARE_ID (androidNDKPath);