summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java/org
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-06-03 20:41:06 -0400
committerCharles Lombardo <clombardo169@gmail.com>2023-06-05 20:08:54 -0400
commit0915bfbb30124ad1ec2dc58f4a083e31696613fc (patch)
tree1f1b5236ef0f524b7d4bfe5a1c86985f1922ffc7 /Source/Android/app/src/main/java/org
parent90ac08c98d7ccc1207e46a818248b43541bf891b (diff)
Android: Convert Platform to Kotlin
Diffstat (limited to 'Source/Android/app/src/main/java/org')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.java58
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.kt36
2 files changed, 36 insertions, 58 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.java
deleted file mode 100644
index f561feb250..0000000000
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-package org.dolphinemu.dolphinemu.ui.platform;
-
-import org.dolphinemu.dolphinemu.R;
-
-/**
- * Enum to represent platform (eg GameCube, Wii).
- */
-public enum Platform
-{
- GAMECUBE(0, R.string.platform_gamecube, "GameCube Games"),
- WII(1, R.string.platform_wii, "Wii Games"),
- WIIWARE(2, R.string.platform_wiiware, "WiiWare Games");
-
- private final int value;
- private final int headerName;
- private final String idString;
-
- Platform(int value, int headerName, String idString)
- {
- this.value = value;
- this.headerName = headerName;
- this.idString = idString;
- }
-
- public static Platform fromInt(int i)
- {
- return values()[i];
- }
-
- public static Platform fromNativeInt(int i)
- {
- // TODO: Proper support for DOL and ELF files
- boolean in_range = i >= 0 && i < values().length;
- return values()[in_range ? i : WIIWARE.value];
- }
-
- public static Platform fromPosition(int position)
- {
- return values()[position];
- }
-
- public int toInt()
- {
- return value;
- }
-
- public int getHeaderName()
- {
- return headerName;
- }
-
- public String getIdString()
- {
- return idString;
- }
-}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.kt
new file mode 100644
index 0000000000..0bf3e0ea68
--- /dev/null
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/platform/Platform.kt
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+package org.dolphinemu.dolphinemu.ui.platform
+
+import org.dolphinemu.dolphinemu.R
+
+/**
+ * Enum to represent platform (eg GameCube, Wii).
+ */
+enum class Platform(private val value: Int, val headerName: Int, val idString: String) {
+ GAMECUBE(0, R.string.platform_gamecube, "GameCube Games"),
+ WII(1, R.string.platform_wii, "Wii Games"),
+ WIIWARE(2, R.string.platform_wiiware, "WiiWare Games");
+
+ fun toInt(): Int {
+ return value
+ }
+
+ companion object {
+ fun fromInt(i: Int): Platform {
+ return values()[i]
+ }
+
+ @JvmStatic
+ fun fromNativeInt(i: Int): Platform {
+ // TODO: Proper support for DOL and ELF files
+ val inRange = i >= 0 && i < values().size
+ return values()[if (inRange) i else WIIWARE.value]
+ }
+
+ @JvmStatic
+ fun fromPosition(position: Int): Platform {
+ return values()[position]
+ }
+ }
+}