summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-06-10 05:06:17 -0400
committerCharles Lombardo <clombardo169@gmail.com>2023-08-25 14:20:31 -0400
commit82298dc408b315467ac3e035e158895e64465fa1 (patch)
treed4e39fea8305768846eba4ce9904b98703fd3c4b /Source/Android/app/src/main/java
parent3011c0dc64d3de8bc56b8bb73fb2addae2e6c484 (diff)
Android: Convert CoreDevice to Kotlin
Diffstat (limited to 'Source/Android/app/src/main/java')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/CoreDevice.java48
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/CoreDevice.kt28
2 files changed, 28 insertions, 48 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/CoreDevice.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/CoreDevice.java
deleted file mode 100644
index b69e9a0236..0000000000
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/CoreDevice.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-package org.dolphinemu.dolphinemu.features.input.model;
-
-import androidx.annotation.Keep;
-
-/**
- * Represents a C++ ciface::Core::Device.
- */
-public final class CoreDevice
-{
- /**
- * Represents a C++ ciface::Core::Device::Control.
- *
- * This class is non-static to ensure that the CoreDevice parent does not get garbage collected
- * while a Control is still accessible. (CoreDevice's finalizer may delete the native controls.)
- */
- @SuppressWarnings("InnerClassMayBeStatic")
- public final class Control
- {
- @Keep
- private final long mPointer;
-
- @Keep
- private Control(long pointer)
- {
- mPointer = pointer;
- }
-
- public native String getName();
- }
-
- @Keep
- private final long mPointer;
-
- @Keep
- private CoreDevice(long pointer)
- {
- mPointer = pointer;
- }
-
- @Override
- protected native void finalize();
-
- public native Control[] getInputs();
-
- public native Control[] getOutputs();
-}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/CoreDevice.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/CoreDevice.kt
new file mode 100644
index 0000000000..1483422c50
--- /dev/null
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/CoreDevice.kt
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+package org.dolphinemu.dolphinemu.features.input.model
+
+import androidx.annotation.Keep
+
+/**
+ * Represents a C++ ciface::Core::Device.
+ */
+@Keep
+class CoreDevice private constructor(private val pointer: Long) {
+ /**
+ * Represents a C++ ciface::Core::Device::Control.
+ *
+ * This class is marked inner to ensure that the CoreDevice parent does not get garbage collected
+ * while a Control is still accessible. (CoreDevice's finalizer may delete the native controls.)
+ */
+ @Keep
+ inner class Control private constructor(private val pointer: Long) {
+ external fun getName(): String
+ }
+
+ protected external fun finalize()
+
+ external fun getInputs(): Array<Control>
+
+ external fun getOutputs(): Array<Control>
+}