mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Android: Persistent notification while ingame (#13125)
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> Co-authored-by: grorp <grorp@posteo.de>
This commit is contained in:
parent
409543566a
commit
3e5d9782cc
7 changed files with 111 additions and 8 deletions
|
@ -1021,6 +1021,10 @@ void Game::run()
|
|||
const bool initial_window_maximized = !g_settings->getBool("fullscreen") &&
|
||||
g_settings->getBool("window_maximized");
|
||||
|
||||
#ifdef __ANDROID__
|
||||
porting::setPlayingNowNotification(true);
|
||||
#endif
|
||||
|
||||
auto framemarker = FrameMarker("Game::run()-frame").started();
|
||||
|
||||
while (m_rendering_engine->run()
|
||||
|
@ -1103,6 +1107,10 @@ void Game::run()
|
|||
|
||||
framemarker.end();
|
||||
|
||||
#ifdef __ANDROID__
|
||||
porting::setPlayingNowNotification(false);
|
||||
#endif
|
||||
|
||||
RenderingEngine::autosaveScreensizeAndCo(initial_screen_size, initial_window_maximized);
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,18 @@ void shareFileAndroid(const std::string &path)
|
|||
jnienv->CallVoidMethod(activity, url_open, jurl);
|
||||
}
|
||||
|
||||
void setPlayingNowNotification(bool show)
|
||||
{
|
||||
jmethodID play_notification = jnienv->GetMethodID(activityClass,
|
||||
"setPlayingNowNotification", "(Z)V");
|
||||
|
||||
FATAL_ERROR_IF(play_notification == nullptr,
|
||||
"porting::setPlayingNowNotification unable to find Java setPlayingNowNotification method");
|
||||
|
||||
jboolean jshow = show;
|
||||
jnienv->CallVoidMethod(activity, play_notification, jshow);
|
||||
}
|
||||
|
||||
AndroidDialogType getLastInputDialogType()
|
||||
{
|
||||
jmethodID lastdialogtype = jnienv->GetMethodID(activityClass,
|
||||
|
|
|
@ -36,6 +36,13 @@ void showComboBoxDialog(const std::string *optionList, s32 listSize, s32 selecte
|
|||
*/
|
||||
void shareFileAndroid(const std::string &path);
|
||||
|
||||
/**
|
||||
* Shows/hides notification that the game is running
|
||||
*
|
||||
* @param show whether to show/hide the notification
|
||||
*/
|
||||
void setPlayingNowNotification(bool show);
|
||||
|
||||
/*
|
||||
* Types of Android input dialog:
|
||||
* 1. Text input (single/multi-line text and password field)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue