diff --git a/app/build.gradle b/app/build.gradle index 5b8ee3c..afce1b2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,7 +8,7 @@ android { applicationId "io.github.chronosx88.yggdrasil" minSdkVersion 15 targetSdkVersion 30 - versionCode 15 + versionCode 16 versionName "1.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" setProperty("archivesBaseName", project.getParent().name+"-"+versionName) diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt index 25327fd..ef59fe1 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/MainActivity.kt @@ -107,6 +107,17 @@ class MainActivity : AppCompatActivity() { ) val adapter = PeerInfoListAdapter(this, currentPeers.sortedWith(compareBy { it.ping })) peersListView.adapter = adapter + + if (adapter.count > 10) { + val item = adapter.getView(0, null, peersListView) + item.measure(0, 0) + val params = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + (10 * item.measuredHeight).toInt() + ) + peersListView.layoutParams = params + } + if(isStarted && this.currentPeers.isEmpty()) { updatePeers() }