diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index c7adabe..1c8f0f8 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -12,7 +12,6 @@
-
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 39c65f6..d5d35ec 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/app/build.gradle b/app/build.gradle
index 27b27c1..eac470b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,15 +6,15 @@ android {
compileSdkVersion 29
defaultConfig {
applicationId "io.github.chronosx88.yggdrasil"
- minSdkVersion 22
+ minSdkVersion 21
targetSdkVersion 29
- versionCode 1
- versionName "1.0"
+ versionCode 2
+ versionName "1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ project.ext.set("archivesBaseName", project.getParent().name+"-"+versionName)
}
signingConfigs {
release {
-
storeFile file(KEYSTORE_FILE_PATH)
storePassword System.getenv("KEYSTORE_PASSWORD")
keyAlias System.getenv("KEY_ALIAS")
@@ -29,19 +29,41 @@ android {
}
}
ndkVersion "21.2.6472646"
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
}
+task ndkBuild(type: Exec) {
+ def rootDir = project.rootDir
+ workingDir = new File(rootDir,"yggdrasil")
+ commandLine 'make'
+}
+
+gradle.projectsEvaluated {
+ tasks.compileDebugKotlin.dependsOn(ndkBuild)
+}
+
+
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':yggdrasil')
- implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'androidx.appcompat:appcompat:1.0.2'
+
+ implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation "androidx.preference:preference-ktx:1.1.1"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
+ implementation 'com.google.android.material:material:1.3.0-alpha01'
+ implementation 'com.google.code.gson:gson:2.8.6'
+ implementation 'com.hbb20:ccp:2.4.0'
+
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-RC2'
- implementation 'com.google.android.material:material:1.1.0-alpha09'
- implementation 'org.hjson:hjson:3.0.0'
- implementation 'com.google.code.gson:gson:2.8.6'
-}
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1080956..ee57592 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,30 +2,47 @@
-
+
+
+
+
+
+
-
+
-
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/Constants.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/Constants.kt
deleted file mode 100644
index 8374c06..0000000
--- a/app/src/main/java/io/github/chronosx88/yggdrasil/Constants.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package io.github.chronosx88.yggdrasil
-
-const val YGGDRASIL_VERSION = "0.3.8"
\ No newline at end of file
diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/DNSListActivity.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/DNSListActivity.kt
new file mode 100644
index 0000000..0cd86a2
--- /dev/null
+++ b/app/src/main/java/io/github/chronosx88/yggdrasil/DNSListActivity.kt
@@ -0,0 +1,150 @@
+package io.github.chronosx88.yggdrasil
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Build
+import android.os.Bundle
+import android.view.*
+import android.widget.*
+import androidx.appcompat.app.AlertDialog
+import androidx.appcompat.app.AppCompatActivity
+import com.google.android.material.floatingactionbutton.FloatingActionButton
+import io.github.chronosx88.yggdrasil.models.DNSInfo
+import io.github.chronosx88.yggdrasil.models.config.SelectDNSInfoListAdapter
+import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.deserializeStringList2DNSInfoSet
+import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.ping
+import io.github.chronosx88.yggdrasil.models.config.Utils.Companion.serializeDNSInfoSet2StringList
+import kotlinx.coroutines.*
+import java.net.InetAddress
+import kotlin.concurrent.thread
+
+
+class DNSListActivity : AppCompatActivity() {
+
+ companion object {
+ val allDNS = arrayListOf(
+ DNSInfo(
+ InetAddress.getByName("[301:2522::53]"),
+ "CZ",
+ "DNS implementation for Yggdrasil. https://github.com/Revertron/wyrd"),
+ DNSInfo(InetAddress.getByName("[301:2923::53]"),
+ "SK",
+ "DNS implementation for Yggdrasil. https://github.com/Revertron/wyrd"),
+ DNSInfo(InetAddress.getByName("[300:4523::53]"),
+ "DE",
+ "DNS implementation for Yggdrasil. https://github.com/Revertron/wyrd"),
+ DNSInfo(InetAddress.getByName("[303:8b1a::53]"),
+ "RU",
+ "DNS implementation for Yggdrasil. https://github.com/Revertron/wyrd")
+ )
+ }
+
+ var isLoading = true;
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_dns_list)
+ setSupportActionBar(findViewById(R.id.toolbar))
+ findViewById(R.id.fab).setOnClickListener { view ->
+ addNewDNS()
+ }
+ var extras = intent.extras
+ var dnsList = findViewById(R.id.dnsList)
+ var adapter = SelectDNSInfoListAdapter(this, arrayListOf(), mutableSetOf())
+ dnsList.adapter = adapter
+ thread(start = true) {
+ try {
+ var cd = deserializeStringList2DNSInfoSet(
+ extras!!.getStringArrayList(MainActivity.DNS_LIST)!!
+ )
+ for (d in cd) {
+ var ping = ping(d.address, 53)
+ d.ping = ping
+ }
+ for (dns in allDNS) {
+ if (cd.contains(dns)) {
+ continue
+ }
+ var ping = ping(dns.address, 53)
+ dns.ping = ping
+ runOnUiThread(
+ Runnable
+ {
+ adapter.addItem(dns)
+ adapter.sort()
+ isLoading = false
+ }
+ )
+ }
+ } catch (e: Throwable) {
+ e.printStackTrace()
+ }
+ }
+ }
+
+ private fun addNewDNS() {
+ val view: View = LayoutInflater.from(this).inflate(R.layout.new_dns_dialog, null)
+ val countryCode: String = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ this.resources.configuration.locales[0].country
+ } else {
+ this.resources.configuration.locale.country
+ }
+
+ var ccp = view.findViewById(R.id.ccp)
+ ccp.setCountryForNameCode(countryCode)
+ val ab: AlertDialog.Builder = AlertDialog.Builder(this)
+ ab.setCancelable(true).setView(view)
+ var ad = ab.show()
+ var addButton = view.findViewById