@@ -691,7 +691,7 @@ public class JuceAppActivity extends Activity | |||||
int format, int width, int height); | int format, int width, int height); | ||||
} | } | ||||
public NativeSurfaceView createNativeSurfaceView(long nativeSurfacePtr) | |||||
public NativeSurfaceView createNativeSurfaceView (long nativeSurfacePtr) | |||||
{ | { | ||||
return new NativeSurfaceView (this, nativeSurfacePtr); | return new NativeSurfaceView (this, nativeSurfacePtr); | ||||
} | } | ||||
@@ -1041,23 +1041,24 @@ public class JuceAppActivity extends Activity | |||||
return null; | return null; | ||||
java.lang.reflect.Method method; | java.lang.reflect.Method method; | ||||
try { | |||||
try | |||||
{ | |||||
method = obj.getClass().getMethod ("getProperty", String.class); | method = obj.getClass().getMethod ("getProperty", String.class); | ||||
} catch (SecurityException e) { | |||||
return null; | |||||
} catch (NoSuchMethodException e) { | |||||
return null; | |||||
} | } | ||||
catch (SecurityException e) { return null; } | |||||
catch (NoSuchMethodException e) { return null; } | |||||
if (method == null) | if (method == null) | ||||
return null; | return null; | ||||
try { | |||||
try | |||||
{ | |||||
return (String) method.invoke (obj, property); | return (String) method.invoke (obj, property); | ||||
} catch (java.lang.IllegalArgumentException e) { | |||||
} catch (java.lang.IllegalAccessException e) { | |||||
} catch (java.lang.reflect.InvocationTargetException e) { | |||||
} | } | ||||
catch (java.lang.IllegalArgumentException e) {} | |||||
catch (java.lang.IllegalAccessException e) {} | |||||
catch (java.lang.reflect.InvocationTargetException e) {} | |||||
return null; | return null; | ||||
} | } | ||||
@@ -1093,5 +1094,4 @@ public class JuceAppActivity extends Activity | |||||
{ | { | ||||
return new JuceThread(host); | return new JuceThread(host); | ||||
} | } | ||||
} | } |
@@ -266,6 +266,7 @@ extern AndroidSystem android; | |||||
METHOD (createNativeSurfaceView, "createNativeSurfaceView", "(J)L" JUCE_ANDROID_ACTIVITY_CLASSPATH "$NativeSurfaceView;") \ | METHOD (createNativeSurfaceView, "createNativeSurfaceView", "(J)L" JUCE_ANDROID_ACTIVITY_CLASSPATH "$NativeSurfaceView;") \ | ||||
METHOD (postMessage, "postMessage", "(J)V") \ | METHOD (postMessage, "postMessage", "(J)V") \ | ||||
METHOD (finish, "finish", "()V") \ | METHOD (finish, "finish", "()V") \ | ||||
METHOD (setRequestedOrientation,"setRequestedOrientation", "(I)V") \ | |||||
METHOD (getClipboardContent, "getClipboardContent", "()Ljava/lang/String;") \ | METHOD (getClipboardContent, "getClipboardContent", "()Ljava/lang/String;") \ | ||||
METHOD (setClipboardContent, "setClipboardContent", "(Ljava/lang/String;)V") \ | METHOD (setClipboardContent, "setClipboardContent", "(Ljava/lang/String;)V") \ | ||||
METHOD (excludeClipRegion, "excludeClipRegion", "(Landroid/graphics/Canvas;FFFF)V") \ | METHOD (excludeClipRegion, "excludeClipRegion", "(Landroid/graphics/Canvas;FFFF)V") \ | ||||
@@ -386,10 +386,14 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow | |||||
//============================================================================== | //============================================================================== | ||||
void Desktop::setOrientationsEnabled (const int newOrientations) | void Desktop::setOrientationsEnabled (const int newOrientations) | ||||
{ | { | ||||
// Dodgy set of flags being passed here! Make sure you specify at least one permitted orientation. | |||||
jassert (newOrientations != 0 && (newOrientations & ~allOrientations) == 0); | |||||
if (allowedOrientations != newOrientations) | |||||
{ | |||||
// Dodgy set of flags being passed here! Make sure you specify at least one permitted orientation. | |||||
jassert (newOrientations != 0 && (newOrientations & ~allOrientations) == 0); | |||||
allowedOrientations = newOrientations; | |||||
allowedOrientations = newOrientations; | |||||
allowedOrientationsChanged(); | |||||
} | |||||
} | } | ||||
bool Desktop::isOrientationEnabled (const DisplayOrientation orientation) const noexcept | bool Desktop::isOrientationEnabled (const DisplayOrientation orientation) const noexcept | ||||
@@ -429,6 +429,8 @@ private: | |||||
bool kioskModeReentrant; | bool kioskModeReentrant; | ||||
int allowedOrientations; | int allowedOrientations; | ||||
void allowedOrientationsChanged(); | |||||
float masterScaleFactor; | float masterScaleFactor; | ||||
ComponentAnimator animator; | ComponentAnimator animator; | ||||
@@ -728,6 +728,38 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis | |||||
// TODO | // 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() | bool juce_areThereAnyAlwaysOnTopWindows() | ||||
{ | { | ||||
@@ -764,7 +796,7 @@ JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, setScreenSize, void, (JNIEnv | |||||
//============================================================================== | //============================================================================== | ||||
Image juce_createIconForFile (const File& file) | Image juce_createIconForFile (const File& file) | ||||
{ | { | ||||
return Image::null; | |||||
return Image(); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -1023,6 +1023,8 @@ void Desktop::setKioskComponent (Component* kioskModeComp, bool enableOrDisable, | |||||
} | } | ||||
} | } | ||||
void Desktop::allowedOrientationsChanged() {} | |||||
//============================================================================== | //============================================================================== | ||||
void UIViewComponentPeer::repaint (const Rectangle<int>& area) | void UIViewComponentPeer::repaint (const Rectangle<int>& area) | ||||
{ | { | ||||
@@ -3746,6 +3746,8 @@ void Desktop::setKioskComponent (Component* comp, bool enableOrDisable, bool /* | |||||
comp->setBounds (getDisplays().getMainDisplay().totalArea); | comp->setBounds (getDisplays().getMainDisplay().totalArea); | ||||
} | } | ||||
void Desktop::allowedOrientationsChanged() {} | |||||
//============================================================================== | //============================================================================== | ||||
ComponentPeer* Component::createNewPeer (int styleFlags, void* nativeWindowToAttachTo) | ComponentPeer* Component::createNewPeer (int styleFlags, void* nativeWindowToAttachTo) | ||||
{ | { | ||||
@@ -2006,6 +2006,8 @@ void Desktop::setKioskComponent (Component* kioskComp, bool shouldBeEnabled, boo | |||||
#endif | #endif | ||||
} | } | ||||
void Desktop::allowedOrientationsChanged() {} | |||||
//============================================================================== | //============================================================================== | ||||
ComponentPeer* Component::createNewPeer (int styleFlags, void* windowToAttachTo) | ComponentPeer* Component::createNewPeer (int styleFlags, void* windowToAttachTo) | ||||
{ | { | ||||
@@ -3311,6 +3311,8 @@ void Desktop::setKioskComponent (Component* kioskModeComp, bool enableOrDisable, | |||||
kioskModeComp->setBounds (getDisplays().getMainDisplay().totalArea); | kioskModeComp->setBounds (getDisplays().getMainDisplay().totalArea); | ||||
} | } | ||||
void Desktop::allowedOrientationsChanged() {} | |||||
//============================================================================== | //============================================================================== | ||||
struct MonitorInfo | struct MonitorInfo | ||||
{ | { | ||||