Skip to content

Commit

Permalink
fix a bug of copying one pilot name to other pilots upon reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
voroshkov committed Nov 21, 2018
1 parent f1c7435 commit 7f96d9d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
14 changes: 7 additions & 7 deletions Android/ChorusRFLaptimer/app/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Android/ChorusRFLaptimer/bluetoothSPP/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions Android/ChorusRFLaptimer/usbSerialForAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down

0 comments on commit 7f96d9d

Please sign in to comment.