Skip to content

Commit f745704

Browse files
author
jyong15
committed
Updates to DialogConfigurations sensor config dialog titles to display the correct values (previously was dependent on index - would display incorrect GUI values)
1 parent 5a2a7b1 commit f745704

File tree

3 files changed

+91
-32
lines changed

3 files changed

+91
-32
lines changed

ShimmerAndroidInstrumentDriver/ShimmerAndroidInstrumentDriver/ShimmerAndroidInstrumentDriver-ShimmerAndroidInstrumentDriver.iml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,31 +65,39 @@
6565
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
6666
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
6767
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
68-
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
69-
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
70-
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
71-
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
72-
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
73-
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
74-
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
7568
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
7669
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
7770
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
7871
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
7972
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
8073
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
8174
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
75+
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
76+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
77+
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
78+
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
79+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
80+
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
81+
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
82+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
8283
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
8384
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
85+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
8486
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
87+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
88+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
8589
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
8690
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
8791
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/multi-dex" />
8892
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
8993
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
9094
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
9195
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
96+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
97+
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
9298
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
99+
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
100+
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
93101
</content>
94102
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
95103
<orderEntry type="sourceFolder" forTests="false" />

ShimmerAndroidInstrumentDriver/ShimmerAndroidInstrumentDriver/src/main/java/com/shimmerresearch/android/guiUtilities/ShimmerDialogConfigurations.java

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,14 @@ public void onClick(DialogInterface dialogInterface, int i) {
301301
public static void buildConfigOptionDetailsSensor(final String key, Map<String, ConfigOptionDetailsSensor> configOptionsMap, final Context context, final ShimmerDevice shimmerDevice, final ShimmerDevice shimmerDeviceClone) {
302302
final ConfigOptionDetailsSensor cods = configOptionsMap.get(key);
303303
final CharSequence[] cs = cods.getGuiValues();
304-
String title = "";
304+
String title = getConfigValueLabelFromConfigLabel(key, shimmerDeviceClone);
305305
if (cods.mGuiComponentType == ConfigOptionDetails.GUI_COMPONENT_TYPE.COMBOBOX) {
306306
Object returnedValue = shimmerDevice.getConfigValueUsingConfigLabel(key);
307307

308308
if(returnedValue != null) {
309-
int configValue = (int) returnedValue;
310-
int itemIndex = Arrays.asList(configOptionsMap.get(key).getConfigValues()).indexOf(configValue);
311-
title = Arrays.asList(configOptionsMap.get(key).getGuiValues()).get(itemIndex);
309+
// int configValue = (int) returnedValue;
310+
// int itemIndex = Arrays.asList(configOptionsMap.get(key).getConfigValues()).indexOf(configValue);
311+
// title = Arrays.asList(configOptionsMap.get(key).getGuiValues()).get(itemIndex);
312312
AlertDialog.Builder builder = new AlertDialog.Builder(context);
313313
shimmerDevice.getConfigValueUsingConfigLabel(key);
314314
builder.setTitle(title);
@@ -387,14 +387,14 @@ public static void buildConfigOptionDetailsSensor(final String key, Map<String,
387387
final ShimmerBluetoothManagerAndroid bluetoothManager) {
388388
final ConfigOptionDetailsSensor cods = configOptionsMap.get(key);
389389
final CharSequence[] cs = cods.getGuiValues();
390-
String title = "";
390+
String title = getConfigValueLabelFromConfigLabel(key, shimmerDeviceClone);
391391
if (cods.mGuiComponentType == ConfigOptionDetails.GUI_COMPONENT_TYPE.COMBOBOX) {
392392
Object returnedValue = shimmerDevice.getConfigValueUsingConfigLabel(key);
393393

394394
if(returnedValue != null) {
395-
int configValue = (int) returnedValue;
396-
int itemIndex = Arrays.asList(configOptionsMap.get(key).getConfigValues()).indexOf(configValue);
397-
title = Arrays.asList(configOptionsMap.get(key).getGuiValues()).get(itemIndex);
395+
// int configValue = (int) returnedValue;
396+
// int itemIndex = Arrays.asList(configOptionsMap.get(key).getConfigValues()).indexOf(configValue);
397+
// title = Arrays.asList(configOptionsMap.get(key).getGuiValues()).get(itemIndex);
398398
AlertDialog.Builder builder = new AlertDialog.Builder(context);
399399
shimmerDevice.getConfigValueUsingConfigLabel(key);
400400
builder.setTitle(title);
@@ -464,14 +464,14 @@ public static void buildConfigOptionDetailsSensor(final String key, Map<String,
464464
final ShimmerDialogConfigurations shimmerDialogConfigurations) {
465465
final ConfigOptionDetailsSensor cods = configOptionsMap.get(key);
466466
final CharSequence[] cs = cods.getGuiValues();
467-
String title = "";
467+
String title = getConfigValueLabelFromConfigLabel(key, shimmerDeviceClone);
468468
if (cods.mGuiComponentType == ConfigOptionDetails.GUI_COMPONENT_TYPE.COMBOBOX) {
469469
Object returnedValue = shimmerDeviceClone.getConfigValueUsingConfigLabel(key);
470470

471471
if(returnedValue != null) {
472-
int configValue = (int) returnedValue;
473-
int itemIndex = Arrays.asList(configOptionsMap.get(key).getConfigValues()).indexOf(configValue);
474-
title = Arrays.asList(configOptionsMap.get(key).getGuiValues()).get(itemIndex);
472+
// int configValue = (int) returnedValue;
473+
// int itemIndex = Arrays.asList(configOptionsMap.get(key).getConfigValues()).indexOf(configValue);
474+
// title = Arrays.asList(configOptionsMap.get(key).getGuiValues()).get(itemIndex);
475475
AlertDialog.Builder builder = new AlertDialog.Builder(context);
476476
shimmerDeviceClone.getConfigValueUsingConfigLabel(key);
477477
builder.setTitle(title);
@@ -536,6 +536,30 @@ public void writeConfigToShimmer(ShimmerDevice clone, ShimmerBluetoothManagerAnd
536536

537537
}
538538

539+
private static String getConfigValueLabelFromConfigLabel(String label, ShimmerDevice cloneDevice){
540+
ConfigOptionDetailsSensor cods = cloneDevice.getConfigOptionsMap().get(label);
541+
int currentConfigInt = (int) cloneDevice.getConfigValueUsingConfigLabel(label);
542+
int index = -1;
543+
Integer[] values = cods.getConfigValues();
544+
String[] valueLabels = cods.getGuiValues();
545+
for (int i=0;i<values.length;i++){
546+
if (currentConfigInt==values[i]){
547+
index=i;
548+
}
549+
}
550+
if (index==-1){
551+
System.out.println();
552+
return "";
553+
}
554+
return valueLabels[index];
555+
}
556+
557+
private static int getConfigValueIntFromConfigGuiIndex(int configGuiIndex, String currentConfigKey, ShimmerDevice cloneDevice) {
558+
ConfigOptionDetailsSensor cods = cloneDevice.getConfigOptionsMap().get(currentConfigKey);
559+
Integer[] values = cods.getConfigValues();
560+
return values[configGuiIndex];
561+
}
562+
539563
//Additional variables for custom signals and filtered signals for the SelectSensorPlot dialog
540564
static protected List<String[]> mAdditionalSignalsList = null;
541565
static protected List<String[]> mFilteredSignalsList = null;

ShimmerAndroidInstrumentDriver/build/intermediates/dex-cache/cache.xml

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,75 @@
33

44
<item
55
is-multidex="true"
6-
jar="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\ShimmerAndroidInstrumentDriver\build\intermediates\bundles\default\libs\androidplot-core-0.5.0-release.jar"
6+
jar="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\incremental-runtime-classes\debug\instant-run.jar"
77
jumboMode="true"
88
optimize="true"
99
revision="25.0.2"
10-
sha1="a08bcc8dba24bfe666c84df486f4bde7afba07d9">
11-
<dex dex="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerLegacyExample\build\intermediates\transforms\dex\debug\folders\1000\8\androidplot-core-0.5.0-release_639519680c0211dfc8a3689ac7d46320995acafa\classes.dex" />
10+
sha1="3be78ebc2706b2e1fe2f12d5726887a92d6c183b">
11+
<dex dex="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\transforms\dex\debug\folders\1000\10000\instant-run_46ad7d1b61a6b40336c92a3b522adb6afdfc2e76\classes.dex" />
1212
</item>
1313
<item
1414
is-multidex="true"
15-
jar="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerLegacyExample\build\intermediates\incremental-runtime-classes\debug\instant-run.jar"
15+
jar="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\incremental-classes\debug\instant-run-bootstrap.jar"
1616
jumboMode="true"
1717
optimize="true"
1818
revision="25.0.2"
19-
sha1="3be78ebc2706b2e1fe2f12d5726887a92d6c183b">
20-
<dex dex="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerLegacyExample\build\intermediates\transforms\dex\debug\folders\1000\10000\instant-run_38be2f14e729bb68eb547194a773a41441b49679\classes.dex" />
19+
sha1="64b048a8d03c009e115e23715e1bf42f342a6a00">
20+
<dex dex="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\transforms\dex\debug\folders\1000\10000\instant-run-bootstrap_e1f3e26ca05936580d656f110b005ba121c211de\classes.dex" />
21+
</item>
22+
<item
23+
is-multidex="true"
24+
jar="C:\Users\Jos\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\20.0\89507701249388e1ed5ddcf8c41f4ce1be7831ef\guava-20.0.jar"
25+
jumboMode="true"
26+
optimize="true"
27+
revision="25.0.2"
28+
sha1="89507701249388e1ed5ddcf8c41f4ce1be7831ef">
29+
<dex dex="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\transforms\dex\debug\folders\1000\10\guava-20.0_728f3dccc8723cc29a0caa1af2b678f819f5540d\classes.dex" />
30+
</item>
31+
<item
32+
is-multidex="true"
33+
jar="C:\Users\Jos\.gradle\caches\modules-2\files-2.1\com.shimmerresearch.managers.bluetoothmanager\ShimmerBluetoothManager\0.9.21beta\802a3c5a3fa30e56e06dd9890130476a7c6ac6b1\ShimmerBluetoothManager-0.9.21beta.jar"
34+
jumboMode="true"
35+
optimize="true"
36+
revision="25.0.2"
37+
sha1="802a3c5a3fa30e56e06dd9890130476a7c6ac6b1">
38+
<dex dex="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\transforms\dex\debug\folders\1000\10\ShimmerBluetoothManager-0.9.21beta_e37afdc2365b17d7f9848d1b61d2c51c5957f517\classes.dex" />
39+
</item>
40+
<item
41+
is-multidex="true"
42+
jar="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\ShimmerAndroidInstrumentDriver\build\intermediates\bundles\default\libs\androidplot-core-0.5.0-release.jar"
43+
jumboMode="true"
44+
optimize="true"
45+
revision="25.0.2"
46+
sha1="a08bcc8dba24bfe666c84df486f4bde7afba07d9">
47+
<dex dex="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\transforms\dex\debug\folders\1000\8\androidplot-core-0.5.0-release_9f0ad4e3caca255ead6fab8acfd7a8b7c19103c0\classes.dex" />
2148
</item>
2249
<item
2350
is-multidex="true"
24-
jar="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\ShimmerAndroidInstrumentDriver\build\intermediates\bundles\default\libs\AndroidBluetoothLibrary.jar"
51+
jar="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\ShimmerAndroidInstrumentDriver\build\intermediates\bundles\default\libs\AndroidBluetoothLibrary.jar"
2552
jumboMode="true"
2653
optimize="true"
2754
revision="25.0.2"
2855
sha1="7f53e8175d44f2c87f4bf757d0e03961af1b038e">
29-
<dex dex="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerLegacyExample\build\intermediates\transforms\dex\debug\folders\1000\8\AndroidBluetoothLibrary_2aaf27bfa574c611082b777bbeaa205e7930a59e\classes.dex" />
56+
<dex dex="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\transforms\dex\debug\folders\1000\8\AndroidBluetoothLibrary_832a3fd79c33027c02e2faf401bf0bbf44922f3e\classes.dex" />
3057
</item>
3158
<item
3259
is-multidex="true"
33-
jar="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerLegacyExample\build\intermediates\incremental-classes\debug\instant-run-bootstrap.jar"
60+
jar="C:\Users\Jos\.gradle\caches\modules-2\files-2.1\com.shimmerresearch.driver\ShimmerDriver\0.9.20beta\7f0df59531a97277da85c997f29396c0b308efbe\ShimmerDriver-0.9.20beta.jar"
3461
jumboMode="true"
3562
optimize="true"
3663
revision="25.0.2"
37-
sha1="d003426e652ea197563731c0e16dd6ed0142c298">
38-
<dex dex="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerLegacyExample\build\intermediates\transforms\dex\debug\folders\1000\10000\instant-run-bootstrap_f1ea9973455390baab4186fe07d8fed9fc2265f0\classes.dex" />
64+
sha1="7f0df59531a97277da85c997f29396c0b308efbe">
65+
<dex dex="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\transforms\dex\debug\folders\1000\10\ShimmerDriver-0.9.20beta_7f75232c952beb66b42060d58e358724aab51c49\classes.dex" />
3966
</item>
4067
<item
4168
is-multidex="true"
42-
jar="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\ShimmerAndroidInstrumentDriver\build\intermediates\bundles\default\libs\ShimmerBiophysicalProcessingLibrary_Rev_0_11.jar"
69+
jar="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\ShimmerAndroidInstrumentDriver\build\intermediates\bundles\default\libs\ShimmerBiophysicalProcessingLibrary_Rev_0_11.jar"
4370
jumboMode="true"
4471
optimize="true"
4572
revision="25.0.2"
4673
sha1="3855121e83b525150312e04d114c382bded92081">
47-
<dex dex="C:\Users\User\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerLegacyExample\build\intermediates\transforms\dex\debug\folders\1000\8\ShimmerBiophysicalProcessingLibrary_Rev_0_11_397b0f393c7ff87c8b4adbedb529a634897e6f60\classes.dex" />
74+
<dex dex="C:\Users\Jos\Documents\GitHub\ShimmerAndroidAPI\ShimmerAndroidInstrumentDriver\shimmerBasicExample\build\intermediates\transforms\dex\debug\folders\1000\8\ShimmerBiophysicalProcessingLibrary_Rev_0_11_6653c5c9189a1d0ac28babe0be66d5ddb7acb08e\classes.dex" />
4875
</item>
4976

5077
</items>

0 commit comments

Comments
 (0)