| @@ -54,8 +54,8 @@ public class ArcerySetupArrayAdapter extends ArrayAdapter<IArcherySetup> { | |||
| TextView textViewSub = (TextView) item.findViewById(R.id.chooseArcherySetupTxtSub); | |||
| if (getItem(position).getId() != -999) { | |||
| textViewMain.setText(getItem(position).getRiser().getManufacturer() + " / " + getItem(position).getSight().getManufacturer()); | |||
| textViewSub.setText(getItem(position).getRiser().getManufacturer() + " / " + getItem(position).getSight().getManufacturer()); | |||
| textViewMain.setText(getItem(position).getName()); | |||
| textViewSub.setText(getItem(position).getRiser().toString() + " / " + getItem(position).getSight().toString()); | |||
| } else { | |||
| textViewMain.setText("[ ]"); | |||
| textViewSub.setText(getContext().getString(R.string.caption_NoSelection)); | |||
| @@ -144,6 +144,6 @@ public final class RBSDatabaseHelper extends SQLiteOpenHelper { | |||
| } | |||
| private IArcherySetup getArcherySetupMasterData() { | |||
| return new ArcherySetup(0, null, null, 5.8, 3.10, 21d, 64.25, 1.30, 71d, 1.57, 14.8, 0.001, 0.1, 55d, 260d); | |||
| return new ArcherySetup(0, "FITA Indoor FS", null, null, 5.8, 3.10, 21d, 64.25, 1.30, 71d, 1.57, 14.8, 0.001, 0.1, 55d, 260d); | |||
| } | |||
| } | |||
| @@ -37,14 +37,13 @@ public final class ArcherySetupDao extends DAO<IArcherySetup> { | |||
| @Override | |||
| protected IArcherySetup cursorToEntity(final Cursor cursor) { | |||
| ISight sight = SightDao.getInstance().loadById(cursor.getLong(1)); | |||
| IRiser riser = RiserDao.getInstance().loadById(cursor.getLong(2)); | |||
| ISight sight = SightDao.getInstance().loadById(cursor.getLong(2)); | |||
| IRiser riser = RiserDao.getInstance().loadById(cursor.getLong(3)); | |||
| IArcherySetup archerySetup = new ArcherySetup(cursor.getLong(0), sight, riser, cursor.getDouble(3), // | |||
| cursor.getDouble(4), cursor.getDouble(5), cursor.getDouble(6), cursor.getDouble(7), | |||
| cursor.getDouble(8), cursor.getDouble(9), cursor.getDouble(10), cursor.getDouble(11), | |||
| cursor.getDouble(12), cursor.getDouble(13), cursor.getDouble(14)); | |||
| IArcherySetup archerySetup = new ArcherySetup(cursor.getLong(0), cursor.getString(1), sight, riser, cursor.getDouble(4), // | |||
| cursor.getDouble(5), cursor.getDouble(6), cursor.getDouble(7), cursor.getDouble(8), | |||
| cursor.getDouble(9), cursor.getDouble(10), cursor.getDouble(11), cursor.getDouble(12), | |||
| cursor.getDouble(13), cursor.getDouble(14), cursor.getDouble(15)); | |||
| return archerySetup; | |||
| } | |||
| @@ -56,6 +55,7 @@ public final class ArcherySetupDao extends DAO<IArcherySetup> { | |||
| values.put(TblRBSArcherySetup.COL_ID, entity.getId()); | |||
| } | |||
| values.put(TblRBSArcherySetup.COL_NAME, entity.getName() != null ? entity.getName() : ""); | |||
| values.put(TblRBSArcherySetup.COL_SIGHT, entity.getSight() != null ? entity.getSight().getId() : 0); | |||
| values.put(TblRBSArcherySetup.COL_RISER, entity.getRiser() != null ? entity.getRiser().getId() : 0); | |||
| values.put(TblRBSArcherySetup.COL_ARROWDIAMETER, entity.getArrowDiameter() != null ? entity.getArrowDiameter() : 0d); | |||
| @@ -12,6 +12,7 @@ public final class TblRBSArcherySetup { | |||
| public static final String NAME = "RBS_ARCHERYSETUP"; | |||
| public static final String COL_ID = "ARCHERYSETUP_ID"; | |||
| public static final String COL_NAME = "ARCHERYSETUP_NAME"; | |||
| public static final String COL_SIGHT = "ARCHERYSETUP_SIGHT"; | |||
| public static final String COL_RISER = "ARCHERYSETUP_RISER"; | |||
| public static final String COL_ARROWDIAMETER = "ARCHERYSETUP_ARROWDIAMETER"; | |||
| @@ -28,12 +29,12 @@ public final class TblRBSArcherySetup { | |||
| public static final String COL_SIGHTHORSETTING = "ARCHERYSETUP_SIGHTHORSETTING"; | |||
| private TblRBSArcherySetup() { | |||
| } | |||
| private TblRBSArcherySetup() { } | |||
| public static String getCreateStatement() { | |||
| return "create table " + NAME + "(" | |||
| + COL_ID + " Integer primary key autoincrement, " | |||
| + COL_NAME + " Text NOT NULL, " | |||
| + COL_SIGHT + " Integer NOT NULL REFERENCES RBS_SIGHT (" + TblRBSSight.COL_ID + "), " | |||
| + COL_RISER + " Integer NOT NULL REFERENCES RBS_RISER (" + TblRBSRiser.COL_ID + "), " | |||
| + COL_ARROWDIAMETER + " Real NOT NULL, " | |||
| @@ -48,6 +49,7 @@ public final class TblRBSArcherySetup { | |||
| + COL_CALCPRECISION + " Real NOT NULL, " | |||
| + COL_SIGHTVERTSKALAMIDDLE + " Real NOT NULL, " | |||
| + COL_SIGHTHORSETTING + " Real NOT NULL, " | |||
| + "constraint UNIQUE_ARCHERYSETUP_NAME UNIQUE (" + COL_NAME + "), " | |||
| + "constraint UNIQUE_ARCHERYSETUP_SIGHT_RISER UNIQUE (" + COL_SIGHT + "," + COL_RISER + ")" | |||
| + ");"; | |||
| } | |||
| @@ -56,7 +56,7 @@ public class ChooseArcherySetupDlg extends Dialog { | |||
| final ListView listView = (ListView) findViewById(R.id.chooseArcerySetupItemsList); | |||
| List<IArcherySetup> setups = new ArrayList<IArcherySetup>(); | |||
| setups.add(new ArcherySetup(-999, null, null, null, null, null, null, null, null, null, null, null, null, null, null)); | |||
| setups.add(new ArcherySetup(-999, "", null, null, null, null, null, null, null, null, null, null, null, null, null, null)); | |||
| setups.addAll(ArcherySetupDao.getInstance().loadAll()); | |||
| listView.setAdapter(new ArcerySetupArrayAdapter(getContext(), R.layout.rbs_archerysetup_item, setups)); | |||
| @@ -9,6 +9,7 @@ package ch.spherIC.recurvebowsight.model; | |||
| public class ArcherySetup implements IArcherySetup { | |||
| private long id; | |||
| private String name; | |||
| private ISight sight; | |||
| private IRiser riser; | |||
| private Double arrowDiameter; | |||
| @@ -43,7 +44,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| * @param sightVertSkalaMiddle | |||
| * @param sightHorSetting | |||
| */ | |||
| public ArcherySetup(final long id, final ISight sight, final IRiser riser, | |||
| public ArcherySetup(final long id, final String name, final ISight sight, final IRiser riser, | |||
| final Double arrowDiameter, final Double arrowCw, final Double arrowWeight, | |||
| final Double arrowV0, final Double arrowCenterHeight, final Double bowPullout, | |||
| final Double arrowNockHeight, final Double hNA, final Double deltaTime, | |||
| @@ -51,6 +52,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| final Double sightHorSetting) { | |||
| super(); | |||
| this.id = id; | |||
| this.name = name; | |||
| this.sight = sight; | |||
| this.riser = riser; | |||
| this.arrowDiameter = arrowDiameter; | |||
| @@ -83,6 +85,23 @@ public class ArcherySetup implements IArcherySetup { | |||
| this.id = id; | |||
| } | |||
| /** | |||
| * @return the name | |||
| */ | |||
| @Override | |||
| public String getName() { | |||
| return this.name; | |||
| } | |||
| /** | |||
| * @param name the name to set | |||
| */ | |||
| @Override | |||
| public void setName(final String name) { | |||
| this.name = name; | |||
| } | |||
| /** | |||
| * @return the sight | |||
| */ | |||
| @@ -307,4 +326,20 @@ public class ArcherySetup implements IArcherySetup { | |||
| this.sightHorSetting = sightHorSetting; | |||
| } | |||
| /** | |||
| * @return the hNA | |||
| */ | |||
| @Override | |||
| public Double gethNA() { | |||
| return this.hNA; | |||
| } | |||
| /** | |||
| * @param hNA the hNA to set | |||
| */ | |||
| @Override | |||
| public void sethNA(final Double hNA) { | |||
| this.hNA = hNA; | |||
| } | |||
| } | |||
| @@ -64,4 +64,12 @@ public interface IArcherySetup extends IEntity { | |||
| Double getSightHorSetting(); | |||
| void setSightHorSetting(Double middle); | |||
| String getName(); | |||
| void setName(String name); | |||
| Double gethNA(); | |||
| void sethNA(Double hNA); | |||
| } | |||