Don't allow editing the "no motor" configuration since it cannot be editied.
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Fri, 22 Jun 2012 02:09:38 +0000 (02:09 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Fri, 22 Jun 2012 02:09:38 +0000 (02:09 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@798 180e2498-e6e9-4542-8430-84ac67f01cd8

android/src/net/sf/openrocket/android/rocket/Configurations.java

index 34c536427eb6badd7d125ff8e9ad78178c8a8173..4e86610b61415268ba424ac905ea9ec455a77919 100644 (file)
@@ -112,11 +112,15 @@ public class Configurations extends ExpandableListFragment {
 \r
                ExpandableListAdapter configurationAdapter = new BaseExpandableListAdapter() {\r
 \r
+                       // Note: the magic 1 you see below is so the "no motors" configuration\r
+                       // does not appear in the configuration list.\r
                        List<MotorMount> mmts = rocketDocument.getRocket().getMotorMounts();\r
 \r
                        @Override\r
                        public int getGroupCount() {\r
-                               return rocketDocument.getRocket().getMotorConfigurationIDs().length;\r
+                               // don't show the "no motors" configuration, so we have one less than the\r
+                               // array length.\r
+                               return rocketDocument.getRocket().getMotorConfigurationIDs().length-1;\r
                        }\r
 \r
                        @Override\r
@@ -126,7 +130,8 @@ public class Configurations extends ExpandableListFragment {
 \r
                        @Override\r
                        public Object getGroup(int groupPosition) {\r
-                               String config = rocketDocument.getRocket().getMotorConfigurationIDs()[groupPosition];\r
+                               // Skip over the "no motors" configuration\r
+                               String config = rocketDocument.getRocket().getMotorConfigurationIDs()[groupPosition+1];\r
                                return config;\r
                        }\r
 \r