summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4a1f204)
raw | patch | inline | side by side (parent: 4a1f204)
author | fredboy <fredboy@protonmail.com> | |
Fri, 24 May 2024 09:53:05 +0000 (16:53 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Fri, 24 May 2024 09:53:05 +0000 (16:53 +0700) |
android/src/ru/deadsoftware/cavedroid/AndroidLauncher.java | [deleted file] | patch | blob | history |
android/src/ru/deadsoftware/cavedroid/AndroidLauncher.kt | [new file with mode: 0644] | patch | blob |
diff --git a/android/src/ru/deadsoftware/cavedroid/AndroidLauncher.java b/android/src/ru/deadsoftware/cavedroid/AndroidLauncher.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package ru.deadsoftware.cavedroid;
-
-import android.content.pm.PackageManager;
-import android.os.Bundle;
-import com.badlogic.gdx.backends.android.AndroidApplication;
-import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
-
-public class AndroidLauncher extends AndroidApplication {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
- config.useImmersiveMode = true;
- String gameFolder = "";
- try {
- gameFolder = getPackageManager().getPackageInfo(getPackageName(), 0).applicationInfo.dataDir;
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- exit();
- }
- CaveGame caveGame = new CaveGame(gameFolder, true, BuildConfig.DEBUG,
- new AndroidPreferencesStore(getApplicationContext()));
- initialize(caveGame, config);
- }
-
- @Override
- public void onBackPressed() {
- }
-}
diff --git a/android/src/ru/deadsoftware/cavedroid/AndroidLauncher.kt b/android/src/ru/deadsoftware/cavedroid/AndroidLauncher.kt
--- /dev/null
@@ -0,0 +1,34 @@
+package ru.deadsoftware.cavedroid
+
+import android.os.Bundle
+import com.badlogic.gdx.backends.android.AndroidApplication
+import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration
+
+class AndroidLauncher : AndroidApplication() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ val gameDataDirectoryPath = packageManager.getPackageInfo(packageName, 0)
+ .applicationInfo.dataDir;
+
+ val config = AndroidApplicationConfiguration()
+ config.useImmersiveMode = true
+
+ initialize(
+ /* listener = */ CaveGame(
+ gameDataDirectoryPath = gameDataDirectoryPath,
+ isTouchScreen = true,
+ isDebug = BuildConfig.DEBUG,
+ preferencesStore = AndroidPreferencesStore(applicationContext)
+ ),
+ /* config = */ config
+ )
+ }
+
+ @Suppress("OVERRIDE_DEPRECATION")
+ override fun onBackPressed() {
+ // ignore
+ }
+
+}
\ No newline at end of file