mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
JNI: Tidying
This commit is contained in:
parent
99d8b9b5e1
commit
8ce1f19bf0
9 changed files with 60 additions and 63 deletions
|
|
@ -375,8 +375,8 @@ private:
|
|||
|
||||
const auto context = getAppContext();
|
||||
|
||||
auto* klass = env->FindClass ("com/rmsl/juce/Receiver");
|
||||
const LocalRef<jobject> replyIntent (env->NewObject (AndroidIntent, AndroidIntent.constructorWithContextAndClass, context.get(), klass));
|
||||
LocalRef<jclass> klass { env->FindClass ("com/rmsl/juce/Receiver") };
|
||||
const LocalRef<jobject> replyIntent (env->NewObject (AndroidIntent, AndroidIntent.constructorWithContextAndClass, context.get(), klass.get()));
|
||||
getEnv()->CallObjectMethod (replyIntent, AndroidIntent.putExtraInt, javaString ("com.rmsl.juce.JUCE_REQUEST_CODE").get(), request);
|
||||
|
||||
const auto flags = FLAG_UPDATE_CURRENT | FLAG_IMMUTABLE;
|
||||
|
|
|
|||
|
|
@ -1329,7 +1329,7 @@ public:
|
|||
{
|
||||
// we don't know if the user is holding on to a local ref to this, so
|
||||
// explicitly create a new one
|
||||
auto nativeView = LocalRef<jobject> (env->NewLocalRef (static_cast<jobject> (nativeViewHandle)));
|
||||
LocalRef<jobject> nativeView { env->NewLocalRef (static_cast<jobject> (nativeViewHandle)) };
|
||||
|
||||
if (env->IsInstanceOf (nativeView.get(), AndroidActivity))
|
||||
{
|
||||
|
|
@ -1838,7 +1838,7 @@ public:
|
|||
|
||||
if (! handled)
|
||||
{
|
||||
LocalRef<jobject> activity (getCurrentActivity());
|
||||
auto activity = getCurrentActivity();
|
||||
|
||||
if (activity != nullptr)
|
||||
{
|
||||
|
|
@ -2003,7 +2003,7 @@ public:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
static void handleDoFrameCallback (JNIEnv*, AndroidComponentPeer& t, [[maybe_unused]] int64 frameTimeNanos)
|
||||
static void handleDoFrameCallback (JNIEnv*, AndroidComponentPeer& t, [[maybe_unused]] jlong frameTimeNanos)
|
||||
{
|
||||
const auto timestampSec = (double) frameTimeNanos / (double) 1'000'000'000;
|
||||
t.callVBlankListeners (timestampSec);
|
||||
|
|
@ -2631,13 +2631,13 @@ Desktop::DisplayOrientation Desktop::getCurrentOrientation() const
|
|||
};
|
||||
|
||||
JNIEnv* env = getEnv();
|
||||
LocalRef<jstring> windowServiceString (javaString ("window"));
|
||||
const auto windowServiceString = javaString ("window");
|
||||
|
||||
LocalRef<jobject> windowManager = LocalRef<jobject> (env->CallObjectMethod (getAppContext().get(), AndroidContext.getSystemService, windowServiceString.get()));
|
||||
LocalRef<jobject> windowManager { env->CallObjectMethod (getAppContext().get(), AndroidContext.getSystemService, windowServiceString.get()) };
|
||||
|
||||
if (windowManager.get() != nullptr)
|
||||
{
|
||||
LocalRef<jobject> display = LocalRef<jobject> (env->CallObjectMethod (windowManager, AndroidWindowManager.getDefaultDisplay));
|
||||
LocalRef<jobject> display { env->CallObjectMethod (windowManager, AndroidWindowManager.getDefaultDisplay) };
|
||||
|
||||
if (display.get() != nullptr)
|
||||
{
|
||||
|
|
@ -2688,7 +2688,7 @@ bool KeyPress::isKeyCurrentlyDown (int /*keyCode*/)
|
|||
JUCE_API void JUCE_CALLTYPE Process::hide()
|
||||
{
|
||||
auto* env = getEnv();
|
||||
LocalRef<jobject> currentActivity (getCurrentActivity().get());
|
||||
auto currentActivity = getCurrentActivity();
|
||||
|
||||
if (env->CallBooleanMethod (currentActivity.get(), AndroidActivity.moveTaskToBack, true) == 0)
|
||||
{
|
||||
|
|
@ -2751,7 +2751,7 @@ public:
|
|||
|
||||
if (methodName == "onCancel" || methodName == "onClick")
|
||||
{
|
||||
auto* dialog = env->GetObjectArrayElement (args, 0);
|
||||
LocalRef<jobject> dialog { env->GetObjectArrayElement (args, 0) };
|
||||
env->CallVoidMethod (dialog, AndroidDialogInterface.dismiss);
|
||||
|
||||
NullCheckedInvocation::invoke (callback);
|
||||
|
|
@ -2853,8 +2853,7 @@ void Displays::findDisplays (float masterScale)
|
|||
{
|
||||
auto* env = getEnv();
|
||||
|
||||
LocalRef<jstring> windowServiceString (javaString ("window"));
|
||||
|
||||
const auto windowServiceString = javaString ("window");
|
||||
LocalRef<jobject> windowManager (env->CallObjectMethod (getAppContext(), AndroidContext.getSystemService, windowServiceString.get()));
|
||||
LocalRef<jobject> display (env->CallObjectMethod (windowManager, AndroidWindowManager.getDefaultDisplay));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue