1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-24 01:54:22 +00:00

Added Android support for screen orientation control

This commit is contained in:
jules 2016-01-13 12:05:29 +00:00
parent 668d9c5f69
commit 99052af8bc
9 changed files with 62 additions and 15 deletions

View file

@ -728,6 +728,38 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
// TODO
}
//==============================================================================
static jint getAndroidOrientationFlag (int orientations) noexcept
{
enum
{
SCREEN_ORIENTATION_LANDSCAPE = 0,
SCREEN_ORIENTATION_PORTRAIT = 1,
SCREEN_ORIENTATION_USER = 2,
SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8,
SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9,
SCREEN_ORIENTATION_USER_LANDSCAPE = 11,
SCREEN_ORIENTATION_USER_PORTRAIT = 12,
};
switch (orientations)
{
case Desktop::upright: return (jint) SCREEN_ORIENTATION_PORTRAIT;
case Desktop::upsideDown: return (jint) SCREEN_ORIENTATION_REVERSE_PORTRAIT;
case Desktop::upright + Desktop::upsideDown: return (jint) SCREEN_ORIENTATION_USER_PORTRAIT;
case Desktop::rotatedAntiClockwise: return (jint) SCREEN_ORIENTATION_LANDSCAPE;
case Desktop::rotatedClockwise: return (jint) SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
case Desktop::rotatedClockwise + Desktop::rotatedAntiClockwise: return (jint) SCREEN_ORIENTATION_USER_LANDSCAPE;
default: return (jint) SCREEN_ORIENTATION_USER;
}
}
void Desktop::allowedOrientationsChanged()
{
android.activity.callVoidMethod (JuceAppActivity.setRequestedOrientation,
getAndroidOrientationFlag (allowedOrientations));
}
//==============================================================================
bool juce_areThereAnyAlwaysOnTopWindows()
{
@ -764,7 +796,7 @@ JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, setScreenSize, void, (JNIEnv
//==============================================================================
Image juce_createIconForFile (const File& file)
{
return Image::null;
return Image();
}
//==============================================================================