mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2025-01-22 16:06:30 +00:00
Merge pull request #16 from vikulin/master
DNS only number in IP fix, #12 task
This commit is contained in:
commit
d7b6a66f5a
@ -8,8 +8,8 @@ android {
|
|||||||
applicationId "io.github.chronosx88.yggdrasil"
|
applicationId "io.github.chronosx88.yggdrasil"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 2
|
versionCode 3
|
||||||
versionName "1.2"
|
versionName "1.3"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
project.ext.set("archivesBaseName", project.getParent().name+"-"+versionName)
|
project.ext.set("archivesBaseName", project.getParent().name+"-"+versionName)
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,13 @@
|
|||||||
tools:ignore="GoogleAppIndexingWarning">
|
tools:ignore="GoogleAppIndexingWarning">
|
||||||
<activity
|
<activity
|
||||||
android:name=".PeerListActivity"
|
android:name=".PeerListActivity"
|
||||||
|
android:parentActivityName=".MainActivity"
|
||||||
android:label="@string/title_activity_peer_list"
|
android:label="@string/title_activity_peer_list"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".DNSListActivity"
|
android:name=".DNSListActivity"
|
||||||
|
android:parentActivityName=".MainActivity"
|
||||||
android:label="@string/title_activity_dns_list"
|
android:label="@string/title_activity_dns_list"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait"/>
|
||||||
|
@ -100,7 +100,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
currentPeers = deserializeStringSet2PeerInfoSet(preferences.getStringSet(CURRENT_PEERS, HashSet())!!)
|
currentPeers = deserializeStringSet2PeerInfoSet(preferences.getStringSet(CURRENT_PEERS, HashSet())!!)
|
||||||
val adapter = PeerInfoListAdapter(this, currentPeers.sortedWith(compareBy { it.ping }))
|
val adapter = PeerInfoListAdapter(this, currentPeers.sortedWith(compareBy { it.ping }))
|
||||||
peersListView.adapter = adapter
|
peersListView.adapter = adapter
|
||||||
|
if(isStarted && this.currentPeers.isEmpty()) {
|
||||||
|
updatePeers()
|
||||||
|
}
|
||||||
val copyAddressButton = findViewById<Button>(R.id.copyIp)
|
val copyAddressButton = findViewById<Button>(R.id.copyIp)
|
||||||
copyAddressButton.setOnClickListener {
|
copyAddressButton.setOnClickListener {
|
||||||
val ip = findViewById<TextView>(R.id.ip)
|
val ip = findViewById<TextView>(R.id.ip)
|
||||||
@ -185,6 +187,18 @@ class MainActivity : AppCompatActivity() {
|
|||||||
startService(intent)
|
startService(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkPeers(){
|
||||||
|
//this is Mesh mode, send Peers update every 5 sec
|
||||||
|
thread(start = true) {
|
||||||
|
while(true) {
|
||||||
|
Thread.sleep(5000)
|
||||||
|
if(isStarted && this.currentPeers.isEmpty()) {
|
||||||
|
updatePeers()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
|
||||||
@ -251,15 +265,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
STATUS_START -> {
|
STATUS_START -> {
|
||||||
print("service started")
|
print("service started")
|
||||||
if(this.currentPeers.isEmpty()){
|
if(this.currentPeers.isEmpty()){
|
||||||
//this is Mesh mode, send Peers update every 5 sec
|
checkPeers()
|
||||||
thread(start = true) {
|
|
||||||
while(true) {
|
|
||||||
Thread.sleep(5000)
|
|
||||||
if(isStarted && this.currentPeers.isEmpty()) {
|
|
||||||
updatePeers()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
STATUS_FINISH -> {
|
STATUS_FINISH -> {
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package io.github.chronosx88.yggdrasil
|
package io.github.chronosx88.yggdrasil
|
||||||
|
|
||||||
import android.app.Notification
|
import android.app.*
|
||||||
import android.app.NotificationChannel
|
|
||||||
import android.app.NotificationManager
|
|
||||||
import android.app.PendingIntent
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
@ -292,8 +289,13 @@ class YggdrasilTunService : VpnService() {
|
|||||||
// https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#NotificationCompat.Builder(android.content.Context)
|
// https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#NotificationCompat.Builder(android.content.Context)
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
var intent = Intent(this, MainActivity::class.java)
|
||||||
|
var stackBuilder = TaskStackBuilder.create(this)
|
||||||
|
stackBuilder.addNextIntentWithParentStack(intent)
|
||||||
|
var pi = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
val b = NotificationCompat.Builder(this, channelId)
|
val b = NotificationCompat.Builder(this, channelId)
|
||||||
b.setOngoing(true)
|
b.setOngoing(true)
|
||||||
|
.setContentIntent(pi)
|
||||||
.setContentTitle(getString(R.string.app_name))
|
.setContentTitle(getString(R.string.app_name))
|
||||||
.setContentText(text)
|
.setContentText(text)
|
||||||
.setSmallIcon(R.mipmap.ic_launcher)
|
.setSmallIcon(R.mipmap.ic_launcher)
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
android:id="@+id/ipInput"
|
android:id="@+id/ipInput"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:digits="0,1,2,3,4,5,6,7,8,9,:"
|
android:digits="0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,:"
|
||||||
android:hint="IPv6"
|
android:hint="IPv6"
|
||||||
android:inputType="textNoSuggestions"
|
android:inputType="textNoSuggestions"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user