Browse Source

Introjucer: added Android screen orientation setting.

tags/2021-05-28
Timur Doumler 9 years ago
parent
commit
29a6451c19
2 changed files with 36 additions and 0 deletions
  1. +35
    -0
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h
  2. +1
    -0
      extras/Introjucer/Source/Utility/jucer_PresetIDs.h

+ 35
- 0
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h View File

@@ -50,6 +50,9 @@ public:
if (getCPP11EnabledValue().getValue().isVoid()) getCPP11EnabledValue() = true; if (getCPP11EnabledValue().getValue().isVoid()) getCPP11EnabledValue() = true;
initialiseDependencyPathValues(); initialiseDependencyPathValues();
if (getScreenOrientationValue().toString().isEmpty())
getScreenOrientationValue() = "unspecified";
} }
bool canLaunchProject() override { return false; } bool canLaunchProject() override { return false; }
@@ -69,6 +72,8 @@ public:
void createExporterProperties (PropertyListBuilder& props) override void createExporterProperties (PropertyListBuilder& props) override
{ {
addScreenOrientationProperty (props);
props.add (new TextPropertyComponent (getActivityClassPathValue(), "Android Activity class name", 256, false), props.add (new TextPropertyComponent (getActivityClassPathValue(), "Android Activity class name", 256, false),
"The full java class name to use for the app's Activity class."); "The full java class name to use for the app's Activity class.");
@@ -125,6 +130,32 @@ public:
"The key.alias password, used when signing the package."); "The key.alias password, used when signing the package.");
} }
enum ScreenOrientation
{
unspecified = 1,
portrait = 2,
landscape = 3
};
void addScreenOrientationProperty (PropertyListBuilder& props)
{
static const char* orientations[] = { "Unspecified",
"Portrait",
"Landscape",
nullptr };
static const char* orientationValues[] = { "unspecified",
"portrait",
"landscape",
0 };
props.add (new ChoicePropertyComponent (getScreenOrientationValue(),
"Screen orientation",
StringArray (orientations),
Array<var> (orientationValues)),
"The screen orientation that this app should use");
}
Value getActivityClassPathValue() { return getSetting (Ids::androidActivityClass); } Value getActivityClassPathValue() { return getSetting (Ids::androidActivityClass); }
String getActivityClassPath() const { return settings [Ids::androidActivityClass]; } String getActivityClassPath() const { return settings [Ids::androidActivityClass]; }
Value getActivitySubClassPathValue() { return getSetting (Ids::androidActivitySubClassName); } Value getActivitySubClassPathValue() { return getSetting (Ids::androidActivitySubClassName); }
@@ -170,6 +201,9 @@ public:
Value getCPP11EnabledValue() { return getSetting (Ids::androidCpp11); } Value getCPP11EnabledValue() { return getSetting (Ids::androidCpp11); }
bool isCPP11Enabled() const { return settings [Ids::androidCpp11]; } bool isCPP11Enabled() const { return settings [Ids::androidCpp11]; }
Value getScreenOrientationValue() { return getSetting (Ids::androidScreenOrientation); }
String getScreenOrientationString() const { return settings [Ids::androidScreenOrientation]; }
//============================================================================== //==============================================================================
String createDefaultClassName() const String createDefaultClassName() const
{ {
@@ -461,6 +495,7 @@ public:
act->setAttribute ("android:name", getActivitySubClassName()); act->setAttribute ("android:name", getActivitySubClassName());
act->setAttribute ("android:label", "@string/app_name"); act->setAttribute ("android:label", "@string/app_name");
act->setAttribute ("android:configChanges", "keyboardHidden|orientation"); act->setAttribute ("android:configChanges", "keyboardHidden|orientation");
act->setAttribute ("android:screenOrientation", getScreenOrientationString());
XmlElement* intent = act->createNewChildElement ("intent-filter"); XmlElement* intent = act->createNewChildElement ("intent-filter");
intent->createNewChildElement ("action")->setAttribute ("android:name", "android.intent.action.MAIN"); intent->createNewChildElement ("action")->setAttribute ("android:name", "android.intent.action.MAIN");


+ 1
- 0
extras/Introjucer/Source/Utility/jucer_PresetIDs.h View File

@@ -156,6 +156,7 @@ namespace Ids
DECLARE_ID (androidStaticLibraries); DECLARE_ID (androidStaticLibraries);
DECLARE_ID (androidSharedLibraries); DECLARE_ID (androidSharedLibraries);
DECLARE_ID (androidNdkPlatformVersion); DECLARE_ID (androidNdkPlatformVersion);
DECLARE_ID (androidScreenOrientation);
DECLARE_ID (buildToolsVersion); DECLARE_ID (buildToolsVersion);
DECLARE_ID (font); DECLARE_ID (font);
DECLARE_ID (colour); DECLARE_ID (colour);


Loading…
Cancel
Save