mirror of
https://github.com/tribufu/tribufu-java
synced 2026-05-06 06:47:27 +00:00
Add Android Project
This commit is contained in:
parent
83feb942ab
commit
0b027bebb4
22 changed files with 271 additions and 97 deletions
21
.gitignore
vendored
21
.gitignore
vendored
|
|
@ -18,25 +18,10 @@ Release/
|
||||||
|
|
||||||
build/
|
build/
|
||||||
|
|
||||||
# Visual Studio Project Files
|
libs/
|
||||||
|
jniLibs/
|
||||||
|
|
||||||
.vs/
|
local.properties
|
||||||
|
|
||||||
*.sln
|
|
||||||
*.vcxproj
|
|
||||||
*.csproj
|
|
||||||
*.filters
|
|
||||||
*.user
|
|
||||||
|
|
||||||
# CMake Project Files
|
|
||||||
|
|
||||||
Makefile
|
|
||||||
*.make
|
|
||||||
|
|
||||||
# Xcode Project Files
|
|
||||||
|
|
||||||
*.xcodeproj
|
|
||||||
*.xcworkspace
|
|
||||||
|
|
||||||
# Mac OSX
|
# Mac OSX
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ crate-type = ["cdylib", "rlib"]
|
||||||
path = "Source/lib.rs"
|
path = "Source/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
TribuFu = { path = "../DevKit" }
|
#TribuFu = { path = "../DevKit" }
|
||||||
jni = "0.19.0"
|
jni = "0.19.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -6,22 +6,35 @@ cargo build --release
|
||||||
|
|
||||||
echo "Building JVM Library"
|
echo "Building JVM Library"
|
||||||
|
|
||||||
./gradlew build
|
./gradlew :library:build
|
||||||
./gradlew jar
|
./gradlew :library:jar
|
||||||
|
|
||||||
New-Item -Path "./Release" -ItemType Directory -Force
|
New-Item -Path "./Release" -ItemType Directory -Force
|
||||||
|
|
||||||
New-Item -Path "./Release/Windows" -ItemType Directory -Force
|
New-Item -Path "./Release/Windows" -ItemType Directory -Force
|
||||||
New-Item -Path "./Release/Mac" -ItemType Directory -Force
|
New-Item -Path "./Release/Mac" -ItemType Directory -Force
|
||||||
New-Item -Path "./Release/Linux" -ItemType Directory -Force
|
New-Item -Path "./Release/Linux" -ItemType Directory -Force
|
||||||
New-Item -Path "./Release/Android" -ItemType Directory -Force
|
|
||||||
|
|
||||||
New-Item -Path "./Release/Android/arm64-v8a" -ItemType Directory -Force
|
Copy-Item -Path "./library/build/libs/library-0.0.1.jar" -Destination "./Release/TribuFu.jar" -Recurse -Force
|
||||||
New-Item -Path "./Release/Android/armeabi-v7a" -ItemType Directory -Force
|
|
||||||
New-Item -Path "./Release/Android/x86" -ItemType Directory -Force
|
|
||||||
New-Item -Path "./Release/Android/x86_64" -ItemType Directory -Force
|
|
||||||
|
|
||||||
echo "Copying Artifacts"
|
|
||||||
|
|
||||||
Copy-Item -Path "./lib/build/libs/lib-0.0.1.jar" -Destination "./Release/TribuFu.jar" -Recurse -Force
|
|
||||||
Copy-Item -Path "./Binaries/release/TribuFu_jvm.dll" -Destination "./Release/Windows/TribuFu_jvm.dll" -Recurse -Force
|
Copy-Item -Path "./Binaries/release/TribuFu_jvm.dll" -Destination "./Release/Windows/TribuFu_jvm.dll" -Recurse -Force
|
||||||
|
|
||||||
|
echo "Building Android Library"
|
||||||
|
|
||||||
|
cargo ndk -t armeabi-v7a -t arm64-v8a -t x86 -t x86_64 build --release
|
||||||
|
|
||||||
|
New-Item -Path "./android/src/main/jniLibs" -ItemType Directory -Force
|
||||||
|
New-Item -Path "./android/src/main/jniLibs/arm64-v8a" -ItemType Directory -Force
|
||||||
|
New-Item -Path "./android/src/main/jniLibs/armeabi-v7a" -ItemType Directory -Force
|
||||||
|
New-Item -Path "./android/src/main/jniLibs/x86_64" -ItemType Directory -Force
|
||||||
|
New-Item -Path "./android/src/main/jniLibs/x86" -ItemType Directory -Force
|
||||||
|
|
||||||
|
Copy-Item -Path "./Binaries/aarch64-linux-android/release/libTribuFu_jvm.so" -Destination "./android/src/main/jniLibs/arm64-v8a/libTribuFu_jvm.so" -Recurse -Force
|
||||||
|
Copy-Item -Path "./Binaries/armv7-linux-androideabi/release/libTribuFu_jvm.so" -Destination "./android/src/main/jniLibs/armeabi-v7a/libTribuFu_jvm.so" -Recurse -Force
|
||||||
|
Copy-Item -Path "./Binaries/x86_64-linux-android/release/libTribuFu_jvm.so" -Destination "./android/src/main/jniLibs/x86_64/libTribuFu_jvm.so" -Recurse -Force
|
||||||
|
Copy-Item -Path "./Binaries/i686-linux-android/release/libTribuFu_jvm.so" -Destination "./android/src/main/jniLibs/x86/libTribuFu_jvm.so" -Recurse -Force
|
||||||
|
|
||||||
|
New-Item -Path "./android/libs" -ItemType Directory -Force
|
||||||
|
Copy-Item -Path "./Release/TribuFu.jar" -Destination "./android/libs/TribuFu.jar" -Recurse -Force
|
||||||
|
|
||||||
|
./gradlew :android:build
|
||||||
|
|
||||||
|
Copy-Item -Path "./android/build/outputs/aar/android-release.aar" -Destination "./Release/TribuFu.aar" -Recurse -Force
|
||||||
|
|
|
||||||
47
android/build.gradle
Normal file
47
android/build.gradle
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
id 'kotlin-android'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 30
|
||||||
|
buildToolsVersion "30.0.3"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 26
|
||||||
|
targetSdkVersion 30
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
}
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation files('libs/TribuFu.jar')
|
||||||
|
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
implementation 'androidx.core:core-ktx:1.3.2'
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
|
implementation 'com.google.android.material:material:1.3.0'
|
||||||
|
testImplementation 'junit:junit:4.+'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
}
|
||||||
0
android/consumer-rules.pro
Normal file
0
android/consumer-rules.pro
Normal file
21
android/proguard-rules.pro
vendored
Normal file
21
android/proguard-rules.pro
vendored
Normal file
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) TribuFu. All Rights Reserved
|
||||||
|
|
||||||
|
package com.tribufu.sdk.android
|
||||||
|
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import org.junit.Assert.*
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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("com.tribufu.sdk.android.test", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
||||||
2
android/src/main/AndroidManifest.xml
Normal file
2
android/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.tribufu.sdk.android"></manifest>
|
||||||
5
android/src/main/java/com/tribufu/sdk/android/TribuFu.kt
Normal file
5
android/src/main/java/com/tribufu/sdk/android/TribuFu.kt
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
// Copyright (c) TribuFu. All Rights Reserved
|
||||||
|
|
||||||
|
package com.tribufu.sdk.android
|
||||||
|
|
||||||
|
class TribuFu {}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright (c) TribuFu. All Rights Reserved
|
||||||
|
|
||||||
|
package com.tribufu.sdk.android
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
fun addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
28
build.gradle
Normal file
28
build.gradle
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
buildscript {
|
||||||
|
ext.kotlin_version = "1.3.72"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath "com.android.tools.build:gradle:4.1.2"
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
||||||
|
|
@ -1 +1,21 @@
|
||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app"s APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
|
android.enableJetifier=true
|
||||||
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
// Copyright (c) TribuFu. All Rights Reserved
|
|
||||||
|
|
||||||
package com.tribufu.sdk.models
|
|
||||||
|
|
||||||
class Email {
|
|
||||||
val address = ""
|
|
||||||
val user_id = "1"
|
|
||||||
val confirmed = false
|
|
||||||
val primary = true
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
// Copyright (c) TribuFu. All Rights Reserved
|
|
||||||
|
|
||||||
package com.tribufu.sdk.models
|
|
||||||
|
|
||||||
class User {
|
|
||||||
val id = ""
|
|
||||||
val name = ""
|
|
||||||
val display_name = ""
|
|
||||||
val password_hash = ""
|
|
||||||
val role = Role.User
|
|
||||||
val confirmed = false
|
|
||||||
val two_factor_enabled = false
|
|
||||||
val first_name = ""
|
|
||||||
val last_name = ""
|
|
||||||
val verified = false
|
|
||||||
val parental_control = false
|
|
||||||
val profile_url = ""
|
|
||||||
val public_birthday = false
|
|
||||||
val Birthday = ""
|
|
||||||
val location = ""
|
|
||||||
val timezone = ""
|
|
||||||
val language = ""
|
|
||||||
val currency = ""
|
|
||||||
val theme = Theme.Light
|
|
||||||
val ip_address = ""
|
|
||||||
val registration_ip_address = ""
|
|
||||||
val Joined = ""
|
|
||||||
val Updated = ""
|
|
||||||
val failed_logins = 0
|
|
||||||
val about = ""
|
|
||||||
val profile_views = 0
|
|
||||||
val content = 0
|
|
||||||
val avatar_url = ""
|
|
||||||
val background_url = ""
|
|
||||||
val status = Status.Offline
|
|
||||||
val LastOnline = ""
|
|
||||||
val LastActivity = ""
|
|
||||||
val LastPost = ""
|
|
||||||
val warnings = 0
|
|
||||||
val LastWarn = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
object Role extends Enumeration {
|
|
||||||
val User, Bot, Helper, Tester, Developer, Moderator, Admin, Root = Value
|
|
||||||
}
|
|
||||||
|
|
||||||
object Theme extends Enumeration {
|
|
||||||
val Light, Dark = Value
|
|
||||||
}
|
|
||||||
|
|
||||||
object Status extends Enumeration {
|
|
||||||
val Offline, Away, Disturb, Online, Playing = Value
|
|
||||||
}
|
|
||||||
5
library/src/main/scala/Handler.scala
Normal file
5
library/src/main/scala/Handler.scala
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
// Copyright (c) TribuFu. All Rights Reserved
|
||||||
|
|
||||||
|
package com.tribufu.sdk
|
||||||
|
|
||||||
|
class Handler {}
|
||||||
5
library/src/main/scala/System.scala
Normal file
5
library/src/main/scala/System.scala
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
// Copyright (c) TribuFu. All Rights Reserved
|
||||||
|
|
||||||
|
package com.tribufu.sdk
|
||||||
|
|
||||||
|
class System {}
|
||||||
11
library/src/main/scala/models/Email.scala
Normal file
11
library/src/main/scala/models/Email.scala
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Copyright (c) TribuFu. All Rights Reserved
|
||||||
|
|
||||||
|
package com.tribufu.sdk.models
|
||||||
|
|
||||||
|
class Email() {
|
||||||
|
val address = ""
|
||||||
|
val added = ""
|
||||||
|
var updated = ""
|
||||||
|
var confirmed = false
|
||||||
|
var primary = true
|
||||||
|
}
|
||||||
52
library/src/main/scala/models/User.scala
Normal file
52
library/src/main/scala/models/User.scala
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
// Copyright (c) TribuFu. All Rights Reserved
|
||||||
|
|
||||||
|
package com.tribufu.sdk.models
|
||||||
|
|
||||||
|
class User {
|
||||||
|
val id = ""
|
||||||
|
val name = ""
|
||||||
|
var display_name = ""
|
||||||
|
var role = Role.User
|
||||||
|
var confirmed = false
|
||||||
|
var two_factor_enabled = false
|
||||||
|
var first_name = ""
|
||||||
|
var last_name = ""
|
||||||
|
var verified = false
|
||||||
|
var parental_control = false
|
||||||
|
var profile_url = ""
|
||||||
|
var public_birthday = false
|
||||||
|
var birthday = ""
|
||||||
|
var location = ""
|
||||||
|
var timezone = ""
|
||||||
|
var language = ""
|
||||||
|
var currency = ""
|
||||||
|
var theme = Theme.Light
|
||||||
|
var ip_address = ""
|
||||||
|
val registration_ip_address = ""
|
||||||
|
val Joined = ""
|
||||||
|
var Updated = ""
|
||||||
|
var failed_logins = 0
|
||||||
|
var about = ""
|
||||||
|
var profile_views = 0
|
||||||
|
var content = 0
|
||||||
|
var avatar_url = ""
|
||||||
|
var background_url = ""
|
||||||
|
var status = Status.Offline
|
||||||
|
var last_online = ""
|
||||||
|
var last_activity = ""
|
||||||
|
var last_post = ""
|
||||||
|
var warnings = 0
|
||||||
|
var last_warn = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
object Role extends Enumeration {
|
||||||
|
val User, Bot, Helper, Tester, Developer, Moderator, Admin, Root = Value
|
||||||
|
}
|
||||||
|
|
||||||
|
object Theme extends Enumeration {
|
||||||
|
val Light, Dark = Value
|
||||||
|
}
|
||||||
|
|
||||||
|
object Status extends Enumeration {
|
||||||
|
val Offline, Away, Disturb, Online, Playing = Value
|
||||||
|
}
|
||||||
|
|
@ -9,8 +9,8 @@ import org.scalatestplus.junit.JUnitRunner
|
||||||
@RunWith(classOf[JUnitRunner])
|
@RunWith(classOf[JUnitRunner])
|
||||||
class TribuFuSuite extends AnyFunSuite {
|
class TribuFuSuite extends AnyFunSuite {
|
||||||
test("Hello is always true") {
|
test("Hello is always true") {
|
||||||
def library = new TribuFu()
|
//def library = new TribuFu()
|
||||||
assert(library.Hello("Scala") == "Scala")
|
//assert(library.Hello("Scala") == "Scala")
|
||||||
assert(true)
|
assert(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
include("lib")
|
include("library")
|
||||||
|
include("android")
|
||||||
rootProject.name = "TribuFu"
|
rootProject.name = "TribuFu"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue