Skip to content

Commit

Permalink
add initial Beerus java libb
Browse files Browse the repository at this point in the history
  • Loading branch information
trbutler4 committed Sep 7, 2024
1 parent 89a9a58 commit 0284117
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
8 changes: 8 additions & 0 deletions light_client_app/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ android {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
sourceSets {
named("main") {
jniLibs.srcDir("src/main/jni/")
// Configure the JNI libraries directory
// Note: For newer configurations, JNI libraries are often managed differently
// Check your specific plugin version's documentation for precise configuration
}
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
package com.example.beerus_android;

public class Beerus {
public static native Void run(
String eth_execution_rpc,
String starknet_rpc,
String data_dir,
int poll_secs,
int socket_port
);

static {
// here we load the rust library we created
System.loadLibrary("beerus");
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.example.beerus_android

import com.example.beerus_android.Beerus;

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
Expand Down Expand Up @@ -61,7 +63,7 @@ fun Toggle(modifier: Modifier = Modifier) {
var runState by rememberSaveable {
mutableStateOf("Not Running")
}
var checked by rememberSaveable { mutableStateOf(true)}
var checked by rememberSaveable { mutableStateOf(false)}

Column(modifier = Modifier
.fillMaxSize()
Expand Down Expand Up @@ -91,8 +93,8 @@ fun Toggle(modifier: Modifier = Modifier) {
Spacer(modifier=Modifier.height(40.dp))

if(checked){
startBeerus()
runState="Running"

}else{
runState="Not Running"
}
Expand All @@ -115,4 +117,14 @@ fun Toggle(modifier: Modifier = Modifier) {
// BeerusandroidTheme {
// Greeting("Android")
// }
//}
//}

fun startBeerus() {
Beerus.run(
"",
"",
"tmp",
5,
8080
)
}
Binary file not shown.

0 comments on commit 0284117

Please sign in to comment.