mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2024-11-09 12:01:01 +00:00
1. #32. limited peer list by 10 lines
This commit is contained in:
parent
664c39d315
commit
e60238271c
@ -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)
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user