AndroidSalInstance *AndroidSalInstance::getInstance()
{ if (!ImplGetSVData()) return NULL; returnstatic_cast<AndroidSalInstance *>(GetSalInstance());
}
AndroidSalInstance::AndroidSalInstance( std::unique_ptr<SalYieldMutex> pMutex )
: SvpSalInstance( std::move(pMutex) )
{ // FIXME: remove when uniPoll & runLoop is the only Android entry point. int res = (lo_get_javavm())->AttachCurrentThread(&m_pJNIEnv, NULL);
LOGI("AttachCurrentThread res=%d env=%p", res, m_pJNIEnv);
}
// This is never called on Android until app exit.
AndroidSalInstance::~AndroidSalInstance()
{ int res = (lo_get_javavm())->DetachCurrentThread();
LOGI("DetachCurrentThread res=%d", res);
LOGI("destroyed Android Sal Instance");
}
// Unfortunately there is no way to check for a specific type of // input being queued. That information is too hidden, sigh. return SvpSalInstance::s_pDefaultInstance->HasUserEvents();
}
void AndroidSalInstance::updateMainThread()
{ int res = (lo_get_javavm())->AttachCurrentThread(&m_pJNIEnv, NULL);
LOGI("updateMainThread AttachCurrentThread res=%d env=%p", res, m_pJNIEnv);
SvpSalInstance::updateMainThread();
}
void AndroidSalInstance::releaseMainThread()
{ int res = (lo_get_javavm())->DetachCurrentThread();
LOGI("releaseMainThread DetachCurrentThread res=%d", res);
// This is our main entry point: extern"C" SalInstance *create_SalInstance()
{
LOGI("Android: create_SalInstance!");
AndroidSalInstance* pInstance = new AndroidSalInstance( std::make_unique<SvpSalYieldMutex>() ); new SvpSalData(); return pInstance;
}
if (AndroidSalInstance::getInstance() != NULL)
{ // Does Android have a native dialog ? if not,. we have to do this ...
// Of course it has. android.app.AlertDialog seems like a good // choice, it even has one, two or three buttons. Naturally, // it intended to be used from Java, so some verbose JNI // horror would be needed to use it directly here. Probably we // want some easier to use magic wrapper, hmm.
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
VclMessageType::Warning, VclButtonsType::Ok,
rMessage));
xBox->set_title(rTitle);
xBox->run();
} else
LOGE("VCL not initialized"); return0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.