Don't allow editing the "no motor" configuration since it cannot be editied.

This commit is contained in:
Kevin Ruland 2012-06-22 02:09:38 +00:00
parent 077147d5d1
commit 1b9f514dc7

View File

@ -112,11 +112,15 @@ public class Configurations extends ExpandableListFragment {
ExpandableListAdapter configurationAdapter = new BaseExpandableListAdapter() { 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<MotorMount> mmts = rocketDocument.getRocket().getMotorMounts(); List<MotorMount> mmts = rocketDocument.getRocket().getMotorMounts();
@Override @Override
public int getGroupCount() { 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 @Override
@ -126,7 +130,8 @@ public class Configurations extends ExpandableListFragment {
@Override @Override
public Object getGroup(int groupPosition) { 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; return config;
} }