WIP on making fullscreen button work for android client

This commit is contained in:
UnknownShadow200 2020-10-12 17:38:23 +11:00
parent b49a617d58
commit 6817f13235
2 changed files with 37 additions and 3 deletions

View file

@ -465,6 +465,22 @@ public class MainActivity extends Activity implements SurfaceHolder.Callback2 {
// wait for dialog to be closed
// TODO: this fails because multiple dialog boxes show
}
public void enterFullscreen() {
runOnUiThread(new Runnable() {
public void run() {
curView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE);
}
});
}
public void exitFullscreen() {
runOnUiThread(new Runnable() {
public void run() {
curView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
});
}
public String shareScreenshot(String path) {
try {

View file

@ -3804,9 +3804,27 @@ void Clipboard_SetText(const String* value) {
/* Always a fullscreen window */
void Window_Show(void) { }
int Window_GetWindowState(void) { return WINDOW_STATE_FULLSCREEN; }
cc_result Window_EnterFullscreen(void) { return 0; }
cc_result Window_ExitFullscreen(void) { return 0; }
cc_bool fullscreen; /* TODO: NOT TRACK IN OWN CODE */
int Window_GetWindowState(void) { return fullscreen ? WINDOW_STATE_FULLSCREEN : WINDOW_STATE_NORMAL; }
cc_result Window_EnterFullscreen(void) {
JNIEnv* env;
JavaGetCurrentEnv(env);
JavaCallVoid(env, "enterFullscreen", "()V", NULL);
fullscreen = true;
return 0;
}
cc_result Window_ExitFullscreen(void) {
JNIEnv* env;
JavaGetCurrentEnv(env);
JavaCallVoid(env, "exitFullscreen", "()V", NULL);
fullscreen = false;
return 0;
}
void Window_SetSize(int width, int height) { }
void Window_Close(void) {