diff --git a/Android/ChorusRFLaptimer/app/build.gradle b/Android/ChorusRFLaptimer/app/build.gradle index b8b805d..bb83bfb 100644 --- a/Android/ChorusRFLaptimer/app/build.gradle +++ b/Android/ChorusRFLaptimer/app/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 25 - buildToolsVersion '26.0.2' + compileSdkVersion 26 + buildToolsVersion '27.0.3' defaultConfig { applicationId "app.andrey_voroshkov.chorus_laptimer" minSdkVersion 16 - targetSdkVersion 25 - versionCode 20 - versionName "0.7.8" + targetSdkVersion 26 + versionCode 21 + versionName "0.7.9" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" archivesBaseName = "ChorusRFLaptimer" } @@ -27,8 +27,8 @@ dependencies { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile 'com.android.support:appcompat-v7:25.1.0' - compile 'com.android.support:design:25.1.0' + compile 'com.android.support:appcompat-v7:26.1.0' + compile 'com.android.support:design:26.1.0' implementation project(':bluetoothSPP') implementation project(':usbSerialForAndroid') testCompile 'junit:junit:4.12' diff --git a/Android/ChorusRFLaptimer/app/src/main/java/app/andrey_voroshkov/chorus_laptimer/PilotsSetupFragment.java b/Android/ChorusRFLaptimer/app/src/main/java/app/andrey_voroshkov/chorus_laptimer/PilotsSetupFragment.java index b047014..60c12e4 100644 --- a/Android/ChorusRFLaptimer/app/src/main/java/app/andrey_voroshkov/chorus_laptimer/PilotsSetupFragment.java +++ b/Android/ChorusRFLaptimer/app/src/main/java/app/andrey_voroshkov/chorus_laptimer/PilotsSetupFragment.java @@ -89,8 +89,18 @@ public void updateResults() { public void updatePilotNames() { ListView mListView = (ListView)mRootView.findViewById(R.id.lvPilots); int count = AppState.getInstance().deviceStates.size(); - for (int i = 0; i < count; i++) { - View convertView = mListView.getChildAt(i); + int firstVisibleItemPos = mListView.getFirstVisiblePosition(); + int lastVisibleItemPos = mListView.getLastVisiblePosition(); + + // detect possible faulty edge cases + if (firstVisibleItemPos > lastVisibleItemPos || + firstVisibleItemPos < 0 || + lastVisibleItemPos > count - 1 ) return; + + // update only visible list items + for (int i = firstVisibleItemPos; i <= lastVisibleItemPos; i++) { + // children enumeration starts with zero + View convertView = mListView.getChildAt(i - firstVisibleItemPos); if (convertView != null) { EditText pilotName = (EditText) convertView.findViewById(R.id.editPilotName); String curPilotName = AppState.getInstance().deviceStates.get(i).pilotName; diff --git a/Android/ChorusRFLaptimer/bluetoothSPP/build.gradle b/Android/ChorusRFLaptimer/bluetoothSPP/build.gradle index ecefe37..1e714c5 100644 --- a/Android/ChorusRFLaptimer/bluetoothSPP/build.gradle +++ b/Android/ChorusRFLaptimer/bluetoothSPP/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 25 - buildToolsVersion '26.0.2' + compileSdkVersion 26 + buildToolsVersion '27.0.3' defaultConfig { versionCode 1 versionName "1.0" minSdkVersion 16 - targetSdkVersion 25 + targetSdkVersion 26 } sourceSets { diff --git a/Android/ChorusRFLaptimer/usbSerialForAndroid/build.gradle b/Android/ChorusRFLaptimer/usbSerialForAndroid/build.gradle index 40d00d2..4a4f70d 100644 --- a/Android/ChorusRFLaptimer/usbSerialForAndroid/build.gradle +++ b/Android/ChorusRFLaptimer/usbSerialForAndroid/build.gradle @@ -3,12 +3,12 @@ apply plugin: 'maven' apply plugin: 'signing' android { - compileSdkVersion 25 - buildToolsVersion '26.0.2' + compileSdkVersion 26 + buildToolsVersion '27.0.3' defaultConfig { minSdkVersion 14 - targetSdkVersion 25 + targetSdkVersion 26 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }