diff --git a/examples/android-project/.gitignore b/examples/android-project/.gitignore new file mode 100644 index 0000000..701a2ed --- /dev/null +++ b/examples/android-project/.gitignore @@ -0,0 +1,20 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties + + +# For now ( I don't want the libraries to be on GH ) +app/libs +app/src/main/jniLibs \ No newline at end of file diff --git a/examples/android-project/app/.gitignore b/examples/android-project/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/examples/android-project/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/examples/android-project/app/build.gradle b/examples/android-project/app/build.gradle new file mode 100644 index 0000000..201fd2e --- /dev/null +++ b/examples/android-project/app/build.gradle @@ -0,0 +1,60 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "io.livekit.android" + minSdk 26 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + buildFeatures { + viewBinding true + } + + sourceSets { + main { + jniLibs.srcDirs = ['src/main/jniLibs'] + } + } +} + +dependencies { + //implementation(files('libs/webrtc.jar')) + + implementation 'net.java.dev.jna:jna:5.12.1@aar' + + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' + implementation 'androidx.navigation:navigation-ui-ktx:2.3.5' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} diff --git a/examples/android-project/app/proguard-rules.pro b/examples/android-project/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/examples/android-project/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/examples/android-project/app/src/androidTest/java/io/livekit/android/ExampleInstrumentedTest.kt b/examples/android-project/app/src/androidTest/java/io/livekit/android/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..ac8b3bd --- /dev/null +++ b/examples/android-project/app/src/androidTest/java/io/livekit/android/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package io.livekit.android + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("io.livekit.android", appContext.packageName) + } +} diff --git a/examples/android-project/app/src/main/AndroidManifest.xml b/examples/android-project/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d7b173e --- /dev/null +++ b/examples/android-project/app/src/main/AndroidManifest.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + diff --git a/examples/android-project/app/src/main/java/io/livekit/android/MainActivity.kt b/examples/android-project/app/src/main/java/io/livekit/android/MainActivity.kt new file mode 100644 index 0000000..73bdbfb --- /dev/null +++ b/examples/android-project/app/src/main/java/io/livekit/android/MainActivity.kt @@ -0,0 +1,35 @@ +package io.livekit.android + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import com.sun.jna.Library +import com.sun.jna.Native +import org.webrtc.PeerConnectionFactory + +class MainActivity : AppCompatActivity() { + + /*interface LKLib : Library { + companion object { + internal val Instance: LKLib by lazy { + Native.load("livekit_native", LKLib::class.java) + } + } + + fun test_rust() + }*/ + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + println("Started activity") + + val opt = PeerConnectionFactory.InitializationOptions.builder(applicationContext).setNativeLibraryName("livekit_native").createInitializationOptions() + + PeerConnectionFactory.initialize(opt) + val factory = PeerConnectionFactory.builder().createPeerConnectionFactory() + + //LKLib.Instance.test_rust() + + println("Called Rust fnc") + println("Now, start investigating the JNI platform specific stuff !") + } +} diff --git a/examples/android-project/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/examples/android-project/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..9e3ab4f --- /dev/null +++ b/examples/android-project/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/examples/android-project/app/src/main/res/drawable/ic_launcher_background.xml b/examples/android-project/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..86caa75 --- /dev/null +++ b/examples/android-project/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/android-project/app/src/main/res/layout/activity_main.xml b/examples/android-project/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..fc796a8 --- /dev/null +++ b/examples/android-project/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/examples/android-project/app/src/main/res/layout/content_main.xml b/examples/android-project/app/src/main/res/layout/content_main.xml new file mode 100644 index 0000000..183a8f6 --- /dev/null +++ b/examples/android-project/app/src/main/res/layout/content_main.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/examples/android-project/app/src/main/res/menu/menu_main.xml b/examples/android-project/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..4be4421 --- /dev/null +++ b/examples/android-project/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,10 @@ + + + diff --git a/examples/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/examples/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..ea737cd --- /dev/null +++ b/examples/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/examples/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..ea737cd --- /dev/null +++ b/examples/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/examples/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/examples/android-project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/examples/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/examples/android-project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/examples/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/examples/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/examples/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/examples/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/examples/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/examples/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/examples/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/examples/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/examples/android-project/app/src/main/res/navigation/nav_graph.xml b/examples/android-project/app/src/main/res/navigation/nav_graph.xml new file mode 100644 index 0000000..f8a973a --- /dev/null +++ b/examples/android-project/app/src/main/res/navigation/nav_graph.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/examples/android-project/app/src/main/res/values-land/dimens.xml b/examples/android-project/app/src/main/res/values-land/dimens.xml new file mode 100644 index 0000000..4a58c4f --- /dev/null +++ b/examples/android-project/app/src/main/res/values-land/dimens.xml @@ -0,0 +1,3 @@ + + 48dp + diff --git a/examples/android-project/app/src/main/res/values-night/themes.xml b/examples/android-project/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..8c5c07f --- /dev/null +++ b/examples/android-project/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + diff --git a/examples/android-project/app/src/main/res/values-w1240dp/dimens.xml b/examples/android-project/app/src/main/res/values-w1240dp/dimens.xml new file mode 100644 index 0000000..7d44cb6 --- /dev/null +++ b/examples/android-project/app/src/main/res/values-w1240dp/dimens.xml @@ -0,0 +1,3 @@ + + 200dp + diff --git a/examples/android-project/app/src/main/res/values-w600dp/dimens.xml b/examples/android-project/app/src/main/res/values-w600dp/dimens.xml new file mode 100644 index 0000000..4a58c4f --- /dev/null +++ b/examples/android-project/app/src/main/res/values-w600dp/dimens.xml @@ -0,0 +1,3 @@ + + 48dp + diff --git a/examples/android-project/app/src/main/res/values/colors.xml b/examples/android-project/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..758655a --- /dev/null +++ b/examples/android-project/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + diff --git a/examples/android-project/app/src/main/res/values/dimens.xml b/examples/android-project/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..184ee9b --- /dev/null +++ b/examples/android-project/app/src/main/res/values/dimens.xml @@ -0,0 +1,3 @@ + + 16dp + diff --git a/examples/android-project/app/src/main/res/values/strings.xml b/examples/android-project/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..78550ad --- /dev/null +++ b/examples/android-project/app/src/main/res/values/strings.xml @@ -0,0 +1,12 @@ + + LKAndroid + Settings + + First Fragment + Second Fragment + Next + Previous + + Hello first fragment + Hello second fragment. Arg: %1$s + diff --git a/examples/android-project/app/src/main/res/values/themes.xml b/examples/android-project/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..5f99fa7 --- /dev/null +++ b/examples/android-project/app/src/main/res/values/themes.xml @@ -0,0 +1,25 @@ + + + + + + +