From 1b9f514dc7b418101d3fe6900e762dc4fd7890f2 Mon Sep 17 00:00:00 2001 From: Kevin Ruland Date: Fri, 22 Jun 2012 02:09:38 +0000 Subject: [PATCH] Don't allow editing the "no motor" configuration since it cannot be editied. --- .../net/sf/openrocket/android/rocket/Configurations.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/android/src/net/sf/openrocket/android/rocket/Configurations.java b/android/src/net/sf/openrocket/android/rocket/Configurations.java index 34c536427..4e86610b6 100644 --- a/android/src/net/sf/openrocket/android/rocket/Configurations.java +++ b/android/src/net/sf/openrocket/android/rocket/Configurations.java @@ -112,11 +112,15 @@ public class Configurations extends ExpandableListFragment { ExpandableListAdapter configurationAdapter = new BaseExpandableListAdapter() { + // Note: the magic 1 you see below is so the "no motors" configuration + // does not appear in the configuration list. List mmts = rocketDocument.getRocket().getMotorMounts(); @Override public int getGroupCount() { - return rocketDocument.getRocket().getMotorConfigurationIDs().length; + // don't show the "no motors" configuration, so we have one less than the + // array length. + return rocketDocument.getRocket().getMotorConfigurationIDs().length-1; } @Override @@ -126,7 +130,8 @@ public class Configurations extends ExpandableListFragment { @Override public Object getGroup(int groupPosition) { - String config = rocketDocument.getRocket().getMotorConfigurationIDs()[groupPosition]; + // Skip over the "no motors" configuration + String config = rocketDocument.getRocket().getMotorConfigurationIDs()[groupPosition+1]; return config; }