package com.khronos.vulkan_samples; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.pm.ApplicationInfo; import android.os.Bundle; import android.view.View; import com.google.androidgamesdk.GameActivity; import com.khronos.vulkan_samples.common.Notifications; import java.util.concurrent.Semaphore; public class NativeMyActivity extends GameActivity { private Context context; private final Semaphore semaphore = new Semaphore(0, true); @Override protected void onCreate(Bundle instance) { super.onCreate(instance); Notifications.initNotificationChannel(this); context = this; String[] argArray = new String[2]; argArray[0] = "sample"; argArray[1] = "hello_triangle"; sendArgumentsToPlatform(argArray); } @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN); } } /*** * Handle the application when an error is thrown and display a message */ public void fatalError(String message) { final NativeMyActivity activity = this; ApplicationInfo applicationInfo = activity.getApplicationInfo(); this.runOnUiThread(new Runnable() { public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle("Vulkan Samples"); builder.setMessage(message); builder.setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { semaphore.release(); } }); builder.setCancelable(false); AlertDialog dialog = builder.create(); dialog.show(); } }); try { semaphore.acquire(); } catch (InterruptedException e) { } activity.finish(); } private native void sendArgumentsToPlatform(String[] args); }