Skip to content

Commit

Permalink
Fixes #121
Browse files Browse the repository at this point in the history
  • Loading branch information
hallahan committed Jan 10, 2016
1 parent 085a3de commit 6f0ffdb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="disklrucache-2.0.2" level="project" />
<orderEntry type="library" exported="" name="commons-lang3-3.0" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-urlconnection-2.4.0" level="project" />
<orderEntry type="library" exported="" name="guava-18.0" level="project" />
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ repositories {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.google.guava', name: 'guava', version: '18.0'
compile 'org.apache.commons:commons-lang3:3.0'
compile project(':MapboxAndroidSDK')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
import android.widget.EditText;
import android.widget.TextView;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* Structure for ODK OSM Tag elements in XForm.
Expand Down Expand Up @@ -95,32 +99,26 @@ public boolean hasCheckedTagValues() {
}

public String getSemiColonDelimitedTagValues(String customValues) {
String values = null;
boolean firstVal = true;
Set<String> values = new HashSet<>();
for (CheckBox cb : checkBoxes) {
if (cb.isChecked()) {
int id = cb.getId();
ODKTagItem item = buttonIdToODKTagItemHash.get(id);
if (item != null) {
if (firstVal) {
firstVal = false;
values = item.getValue();
} else {
values += ';' + item.getValue();
}
values.add(item.getValue());
}
}
}
if (customValues != null) {
customValues = customValues.trim();
if (customValues.length() > 0) {
if (firstVal) {
values = customValues;
} else {
values += ';' + customValues;
String[] customValuesArr = customValues.split(";");
if (customValuesArr.length > 0) {
for (int i = 0; i < customValuesArr.length; i++) {
String customVal = customValuesArr[i];
values.add(customVal);
}
}
}
return values;
return StringUtils.join(values, ";");
}
}

0 comments on commit 6f0ffdb

Please sign in to comment.