mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2024-11-09 20:11:01 +00:00
1. new peers after notification click update issue
This commit is contained in:
parent
b9529d5d62
commit
e732c1bc2d
@ -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 -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user