Add basic support for Android

- Add Android build scripts
- Add Android GUI and `MainActivity`
- Fix Java records
- Fix `Path.of` errors
- Update Main and MainActivity to match better
This commit is contained in:
Butterscotch!
2023-01-28 10:14:18 -05:00
parent 5d9d545346
commit e864487246
41 changed files with 524 additions and 128 deletions

3
.gitignore vendored
View File

@@ -36,3 +36,6 @@ build/
# direnv has been claimed for Nix usage
.direnv/
# Ignore Android local properties
local.properties

View File

@@ -8,3 +8,7 @@ org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAME
kotlin.code.style=official
# https://github.com/Kotlin/kotlinx-atomicfu#atomicfu-compiler-plugin
kotlinx.atomicfu.enableJvmIrTransformation=true
android.useAndroidX=true
android.nonTransitiveRClass=true
org.gradle.unsafe.configuration-cache=true

View File

@@ -9,12 +9,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream
plugins {
kotlin("jvm") version "1.8.21"
kotlin("plugin.serialization") version "1.8.21"
application
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.diffplug.spotless") version "6.12.0"
id("com.github.gmazzo.buildconfig") version "4.0.4"
id("com.android.application") version "7.4.2"
id("org.jetbrains.kotlin.android") version "1.8.0"
}
kotlin {
@@ -54,8 +54,7 @@ tasks
allprojects {
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
google()
mavenCentral()
}
}
@@ -90,25 +89,99 @@ dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.platform:junit-platform-launcher")
}
tasks.test {
useJUnitPlatform()
// Android stuff
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.core:core-ktx:1.9.0")
implementation("com.google.android.material:material:1.8.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
tasks.shadowJar {
minimize {
exclude(dependency("com.fazecast:jSerialComm:.*"))
exclude(dependency("net.java.dev.jna:.*:.*"))
exclude(dependency("com.google.flatbuffers:flatbuffers-java:.*"))
/**
* The android block is where you configure all your Android-specific
* build options.
*/
exclude(project(":solarxr-protocol"))
android {
/**
* The app's namespace. Used primarily to access app resources.
*/
namespace = "dev.slimevr"
/**
* compileSdk specifies the Android API level Gradle should use to
* compile your app. This means your app can use the API features included in
* this API level and lower.
*/
compileSdk = 33
/**
* The defaultConfig block encapsulates default settings and entries for all
* build variants and can override some attributes in main/AndroidManifest.xml
* dynamically from the build system. You can configure product flavors to override
* these values for different versions of your app.
*/
packagingOptions {
resources.excludes.add("META-INF/*")
}
defaultConfig {
// Uniquely identifies the package for publishing.
applicationId = "dev.slimevr.server"
// Defines the minimum API level required to run the app.
minSdk = 33
// Specifies the API level used to test the app.
targetSdk = 33
// Defines the version number of your app.
versionCode = 1
// Defines a user-friendly version name for your app.
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
/**
* The buildTypes block is where you can configure multiple build types.
* By default, the build system defines two build types: debug and release. The
* debug build type is not explicitly shown in the default build configuration,
* but it includes debugging tools and is signed with the debug key. The release
* build type applies ProGuard settings and is not signed by default.
*/
buildTypes {
/**
* By default, Android Studio configures the release build type to enable code
* shrinking, using minifyEnabled, and specifies the default ProGuard rules file.
*/
getByName("release") {
isMinifyEnabled = true // Enables code shrinking for the release build type.
proguardFiles(
getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
archiveBaseName.set("slimevr")
archiveClassifier.set("")
archiveVersion.set("")
}
application {
mainClass.set("dev.slimevr.Main")
}
fun String.runCommand(currentWorkingDir: File = file("./")): String {

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.SlimeVR"
tools:targetApi="33">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>
</manifest>

View File

@@ -13,15 +13,11 @@ import java.io.File
import java.io.IOException
import java.lang.System
import java.net.ServerSocket
import javax.swing.JOptionPane
import kotlin.concurrent.thread
import kotlin.system.exitProcess
val VERSION =
(GIT_VERSION_TAG.ifEmpty { GIT_COMMIT_HASH }) +
if (GIT_CLEAN) "" else "-dirty"
val VERSION = "v0.7.0/android"
lateinit var vrServer: VRServer
private set
fun main(args: Array<String>) {
System.setProperty("awt.useSystemAAFontSettings", "on")
@@ -66,14 +62,6 @@ fun main(args: Array<String>) {
LogManager.info("Running version $VERSION")
if (!SystemUtils.isJavaVersionAtLeast(org.apache.commons.lang3.JavaVersion.JAVA_17)) {
LogManager.severe("SlimeVR start-up error! A minimum of Java 17 is required.")
JOptionPane
.showMessageDialog(
null,
"SlimeVR start-up error! A minimum of Java 17 is required.",
"SlimeVR: Java Runtime Mismatch",
JOptionPane.ERROR_MESSAGE
)
LogManager.closeLogger()
return
}
try {
@@ -87,14 +75,6 @@ fun main(args: Array<String>) {
"SlimeVR start-up error! Required ports are busy. " +
"Make sure there is no other instance of SlimeVR Server running."
)
JOptionPane
.showMessageDialog(
null,
"SlimeVR start-up error! Required ports are busy. " +
"Make sure there is no other instance of SlimeVR Server running.",
"SlimeVR: Ports are busy",
JOptionPane.ERROR_MESSAGE
)
LogManager.closeLogger()
return
}

View File

@@ -0,0 +1,35 @@
package dev.slimevr
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import io.eiren.util.logging.LogManager
import java.io.File
import kotlin.concurrent.thread
import kotlin.system.exitProcess
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
thread(start = true, name = "Main VRServer Thread") {
try {
LogManager.initialize(filesDir)
} catch (e1: java.lang.Exception) {
e1.printStackTrace()
}
LogManager.info("Running version $VERSION")
try {
vrServer = VRServer(File(filesDir, "vrconfig.yml").absolutePath)
vrServer.start()
Keybinding(vrServer)
vrServer.join()
LogManager.closeLogger()
exitProcess(0)
} catch (e: Throwable) {
e.printStackTrace()
exitProcess(1)
}
}
}
}

View File

@@ -209,7 +209,7 @@ public abstract class ProtobufBridge implements Bridge {
@VRServerThread
protected void userActionReceived(UserAction userAction) {
String resetSourceName = "%s: %s".formatted(resetSourceNamePrefix, bridgeName);
String resetSourceName = String.format("%s: %s", resetSourceNamePrefix, bridgeName);
switch (userAction.getName()) {
case "calibrate":
LogManager

View File

@@ -67,9 +67,9 @@ public class ConfigManager {
}
public void backupConfig() {
Path cfgFile = Path.of(configPath);
Path tmpBakCfgFile = Path.of(configPath + ".bak.tmp");
Path bakCfgFile = Path.of(configPath + ".bak");
Path cfgFile = Paths.get(configPath);
Path tmpBakCfgFile = Paths.get(configPath + ".bak.tmp");
Path bakCfgFile = Paths.get(configPath + ".bak");
try {
Files
@@ -110,8 +110,8 @@ public class ConfigManager {
@ThreadSafe
public synchronized void saveConfig() {
Path tmpCfgFile = Path.of(configPath + ".tmp");
Path cfgFile = Path.of(configPath);
Path tmpCfgFile = Paths.get(configPath + ".tmp");
Path cfgFile = Paths.get(configPath);
// Serialize config
try {

View File

@@ -13,7 +13,6 @@ import io.eiren.util.logging.LogManager;
import java.io.File;
import java.io.IOException;
import java.net.StandardProtocolFamily;
import java.net.UnixDomainSocketAddress;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.ServerSocketChannel;
@@ -25,7 +24,6 @@ import java.util.List;
public class UnixSocketBridge extends SteamVRBridge implements AutoCloseable {
public final String socketPath;
public final UnixDomainSocketAddress socketAddress;
private final ByteBuffer dst = ByteBuffer.allocate(2048);
private final ByteBuffer src = ByteBuffer.allocate(2048).order(ByteOrder.LITTLE_ENDIAN);
@@ -44,13 +42,8 @@ public class UnixSocketBridge extends SteamVRBridge implements AutoCloseable {
) {
super(server, hmd, "Named socket thread", bridgeName, bridgeSettingsKey, shareableTrackers);
this.socketPath = socketPath;
this.socketAddress = UnixDomainSocketAddress.of(socketPath);
File socketFile = new File(socketPath);
if (socketFile.exists()) {
throw new RuntimeException(socketPath + " socket already exists.");
}
socketFile.deleteOnExit();
throw new RuntimeException("Unix socket cannot be run on Android.");
}
@Override
@@ -227,10 +220,7 @@ public class UnixSocketBridge extends SteamVRBridge implements AutoCloseable {
}
private ServerSocketChannel createSocket() throws IOException {
ServerSocketChannel server = ServerSocketChannel.open(StandardProtocolFamily.UNIX);
server.bind(this.socketAddress);
LogManager.info("[" + bridgeName + "] Socket " + this.socketPath + " created");
return server;
return null;
}
@Override

View File

@@ -14,7 +14,10 @@ import solarxr_protocol.rpc.ResetStatus;
import solarxr_protocol.rpc.RpcMessage;
public record RPCResetHandler(RPCHandler rpcHandler, ProtocolAPI api) implements ResetListener {
public class RPCResetHandler implements ResetListener {
public RPCHandler rpcHandler;
public ProtocolAPI api;
public RPCResetHandler(RPCHandler rpcHandler, ProtocolAPI api) {
this.rpcHandler = rpcHandler;
this.api = api;

View File

@@ -11,8 +11,10 @@ import solarxr_protocol.rpc.*;
import java.util.function.Consumer;
public record RPCProvisioningHandler(RPCHandler rpcHandler, ProtocolAPI api)
implements ProvisioningListener {
public class RPCProvisioningHandler implements ProvisioningListener {
public RPCHandler rpcHandler;
public ProtocolAPI api;
public RPCProvisioningHandler(RPCHandler rpcHandler, ProtocolAPI api) {
this.rpcHandler = rpcHandler;

View File

@@ -14,7 +14,10 @@ import java.util.List;
import java.util.function.Consumer;
public record RPCSerialHandler(RPCHandler rpcHandler, ProtocolAPI api) implements SerialListener {
public class RPCSerialHandler implements SerialListener {
public RPCHandler rpcHandler;
public ProtocolAPI api;
public RPCSerialHandler(RPCHandler rpcHandler, ProtocolAPI api) {
this.rpcHandler = rpcHandler;

View File

@@ -19,8 +19,10 @@ import solarxr_protocol.rpc.RpcMessageHeader;
import solarxr_protocol.rpc.SettingsResponse;
public record RPCSettingsHandler(RPCHandler rpcHandler, ProtocolAPI api) {
public class RPCSettingsHandler {
public RPCHandler rpcHandler;
public ProtocolAPI api;
public RPCSettingsHandler(RPCHandler rpcHandler, ProtocolAPI api) {
this.rpcHandler = rpcHandler;

View File

@@ -14,6 +14,7 @@ import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -269,7 +270,7 @@ public class SerialHandler implements SerialPortMessageListener {
List<SerialPort> differences = new ArrayList<>(
CollectionUtils
.removeAll(
this.getKnownPorts().toList(),
this.getKnownPorts().collect(Collectors.toList()),
Arrays.asList(lastKnownPorts),
new Equator<>() {
@Override

View File

@@ -1404,7 +1404,7 @@ public class HumanSkeleton {
this.legTweaks.resetFloorLevel();
this.legTweaks.resetBuffer();
LogManager.info("[HumanSkeleton] Reset: full (%s)".formatted(resetSourceName));
LogManager.info(String.format("[HumanSkeleton] Reset: full (%s)", resetSourceName));
}
@VRServerThread
@@ -1427,7 +1427,7 @@ public class HumanSkeleton {
}
this.legTweaks.resetBuffer();
LogManager.info("[HumanSkeleton] Reset: yaw (%s)".formatted(resetSourceName));
LogManager.info(String.format("[HumanSkeleton] Reset: yaw (%s)", resetSourceName));
}
private boolean shouldResetMounting(TrackerPosition position) {
@@ -1489,7 +1489,7 @@ public class HumanSkeleton {
}
this.legTweaks.resetBuffer();
LogManager.info("[HumanSkeleton] Reset: mounting (%s)".formatted(resetSourceName));
LogManager.info(String.format("[HumanSkeleton] Reset: mounting (%s)", resetSourceName));
}
public void updateTapDetectionConfig() {

View File

@@ -1,7 +1,5 @@
package io.eiren.util;
import java.beans.ConstructorProperties;
import com.jme3.system.NanoTimer;
@@ -103,7 +101,6 @@ public class BufferedTimer extends NanoTimer {
public float maxFps;
public float averageFps;
@ConstructorProperties({ "fps", "minFps", "maxFps", "averageFps" })
public TimerSample(float fps, float minFps, float maxFps, float averageFps) {
this.fps = fps;
this.minFps = minFps;

View File

@@ -1,40 +0,0 @@
package io.eiren.util;
import java.awt.Image;
import java.awt.Toolkit;
import java.lang.reflect.Method;
import java.util.List;
public class MacOSX {
public static void setIcons(List<? extends Image> icons) {
try {
Class<?> applicationClass = Class.forName("com.apple.eawt.Application");
Method m = applicationClass.getDeclaredMethod("getApplication");
Object application = m.invoke(null);
m = application.getClass().getDeclaredMethod("setDockIconImage", Image.class);
m.invoke(application, icons.get(icons.size() - 1));
} catch (Exception ignored) {}
}
public static void setTitle(String title) {
try {
Class<?> applicationClass = Class.forName("com.apple.eawt.Application");
Method m = applicationClass.getDeclaredMethod("getApplication");
Object application = m.invoke(null);
m = application.getClass().getDeclaredMethod("setDockIconImage", String.class);
m.invoke(application, title);
} catch (Exception ignored) {}
}
public static boolean hasRetinaDisplay() {
Object obj = Toolkit.getDefaultToolkit().getDesktopProperty("apple.awt.contentScaleFactor");
if (obj instanceof Float f) {
int scale = f.intValue();
return (scale == 2); // 1 indicates a regular mac display.
}
return false;
}
}

View File

@@ -3,6 +3,7 @@ package io.eiren.util.logging;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Paths;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
@@ -38,8 +39,7 @@ public class LogManager {
f.delete();
}
}
String lastLogPattern = Path.of(mainLogDir.getPath(), "log_last_%g.log").toString();
String lastLogPattern = Paths.get(mainLogDir.getPath(), "log_last_%g.log").toString();
FileHandler filehandler = new FileHandler(lastLogPattern, 25 * 1000000, 2);
filehandler.setFormatter(loc);
global.addHandler(filehandler);

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.SlimeVR" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">SlimeVR</string>
</resources>

View File

@@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.SlimeVR" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@@ -37,19 +37,7 @@ public class ReferenceAdjustmentsTests {
private static int successes = 0;
public static Stream<AnglesSet> getAnglesSet() {
return IntStream
.of(yaws)
.mapToObj(
(yaw) -> IntStream
.of(pitches)
.mapToObj(
(
pitch
) -> IntStream.of(rolls).mapToObj((roll) -> new AnglesSet(pitch, yaw, roll))
)
)
.flatMap(Function.identity())
.flatMap(Function.identity());
return null;
}
private static String name(
@@ -349,7 +337,12 @@ public class ReferenceAdjustmentsTests {
System.out.println("Errors: " + errors + ", successes: " + successes);
}
private record QuatEqualYawWithEpsilon(Quaternion q) {
private class QuatEqualYawWithEpsilon {
public Quaternion q;
public QuatEqualYawWithEpsilon(Quaternion q) {
this.q = q;
}
@Override
public String toString() {
@@ -430,6 +423,13 @@ public class ReferenceAdjustmentsTests {
}
}
public record AnglesSet(int pitch, int yaw, int roll) {
public class AnglesSet {
public int pitch, yaw, roll;
public AnglesSet(int pitch, int yaw, int roll) {
this.pitch = pitch;
this.yaw = yaw;
this.roll = roll;
}
}
}

View File

@@ -9,6 +9,13 @@
rootProject.name = "SlimeVR Server"
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
include(":solarxr-protocol")
project(":solarxr-protocol").projectDir = File("solarxr-protocol/protocol/java")