From: kruland2607 Date: Fri, 22 Jun 2012 02:09:38 +0000 (+0000) Subject: Don't allow editing the "no motor" configuration since it cannot be editied. X-Git-Tag: upstream/12.09^2~161 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=ecba8c094da298732dd24bc2f652d6e293bd3401;p=debian%2Fopenrocket Don't allow editing the "no motor" configuration since it cannot be editied. git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@798 180e2498-e6e9-4542-8430-84ac67f01cd8 --- diff --git a/android/src/net/sf/openrocket/android/rocket/Configurations.java b/android/src/net/sf/openrocket/android/rocket/Configurations.java index 34c53642..4e86610b 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; }