1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-08 04:20:09 +00:00

Add option in Introjucer to specify custom Android Activity sub-class

This commit is contained in:
hogliux 2015-07-24 18:21:52 +01:00
parent 03dc6479e3
commit ce2793ca2d
2 changed files with 15 additions and 1 deletions

View file

@ -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);

View file

@ -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);