| @@ -320,7 +320,7 @@ | |||
| <PersistentState> | |||
| <option name="values"> | |||
| <map> | |||
| <entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialiconsround/settings/round_settings_24.xml" /> | |||
| <entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialicons/arrow_right_alt/baseline_arrow_right_alt_24.xml" /> | |||
| </map> | |||
| </option> | |||
| </PersistentState> | |||
| @@ -330,7 +330,7 @@ | |||
| </option> | |||
| <option name="values"> | |||
| <map> | |||
| <entry key="outputName" value="ic_settings" /> | |||
| <entry key="outputName" value="ic_arrow" /> | |||
| <entry key="sourceFile" value="Z:\Work\Java Projects\Android\RecurveBowSight\FITA_Target_logo_round.svg" /> | |||
| </map> | |||
| </option> | |||
| @@ -10,6 +10,7 @@ | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/evs_background.xml" value="0.279" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/evs_nok_background.xml" value="0.279" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/evs_ok_background.xml" value="0.279" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_arrow.xml" value="0.346" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_baseline_swipe_right_24.xml" value="0.264" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_calcsight_parameter.xml" value="0.264" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_calcsight_trajectory.xml" value="0.264" /> | |||
| @@ -32,12 +33,14 @@ | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_menu_userguide.xml" value="0.248" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_outline_handshake_24.xml" value="0.2675" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_outline_thumb_up_24.xml" value="0.2675" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_settings.xml" value="0.346" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_spheric_logo.xml" value="0.2825" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/imageview_background.xml" value="0.2455" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/rbs_anim_splash_logo.xml" value="0.25" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/side_nav_bar.xml" value="0.285" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_arrow_configuration.xml" value="0.15" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_default_settings.xml" value="0.25" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_equipment_configuration.xml" value="0.1994535519125683" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_equipment_configuration.xml" value="0.2" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_main.xml" value="0.22" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_riser_configuration.xml" value="0.2" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_sight_configuration.xml" value="0.1994535519125683" /> | |||
| @@ -78,6 +81,25 @@ | |||
| <component name="ProjectType"> | |||
| <option name="id" value="Android" /> | |||
| </component> | |||
| <component name="SvnBranchConfigurationManager"> | |||
| <option name="myConfigurationMap"> | |||
| <map> | |||
| <entry key="$PROJECT_DIR$"> | |||
| <value> | |||
| <SvnBranchConfiguration> | |||
| <option name="branchUrls"> | |||
| <list> | |||
| <option value="http://hp-omen-30l-fs/svn/RecurveBowSight_V2/branches" /> | |||
| <option value="http://hp-omen-30l-fs/svn/RecurveBowSight_V2/tags" /> | |||
| </list> | |||
| </option> | |||
| <option name="trunkUrl" value="http://hp-omen-30l-fs/svn/RecurveBowSight_V2/trunk" /> | |||
| </SvnBranchConfiguration> | |||
| </value> | |||
| </entry> | |||
| </map> | |||
| </option> | |||
| </component> | |||
| <component name="VisualizationToolProject"> | |||
| <option name="state"> | |||
| <ProjectState> | |||
| @@ -27,23 +27,30 @@ | |||
| <change beforePath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.lock" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/resourceHashesCache.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/resourceHashesCache.bin" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/ArcherySetupDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/ArcherySetupDao.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/DAO.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/DAO.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/RiserDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/RiserDao.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/SightDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/SightDao.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/scheme/data/TblRBSArcherySetup.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/scheme/data/TblRBSArcherySetup.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/ArcherySetup.java" beforeDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/IArcherySetup.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/IArcherySetup.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/Riser.java" beforeDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/Sight.java" beforeDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationViewModel.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationViewModel.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/RiserConfigurationActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/RiserConfigurationActivity.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/SightConfigurationActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/SightConfigurationActivity.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/drawable/side_nav_bar.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/drawable/side_nav_bar.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/AddEquipmentFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/AddEquipmentFragment.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/ChooseEquipmentFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/ChooseEquipmentFragment.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/activity_equipment_configuration.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/activity_equipment_configuration.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/activity_riser_configuration.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/activity_riser_configuration.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/activity_sight_configuration.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/activity_sight_configuration.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/content_main.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/content_main.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_parameters.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_parameters.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_sightsetting.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_sightsetting.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_equipment_choose.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_equipment_choose.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_userguide.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_userguide.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/values/colors.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/colors.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/values/themes.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/themes.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_equipment_add_list.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_equipment_add_list.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/values-de/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-de/strings.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" /> | |||
| </list> | |||
| <option name="SHOW_DIALOG" value="false" /> | |||
| <option name="HIGHLIGHT_CONFLICTS" value="true" /> | |||
| @@ -135,9 +142,9 @@ | |||
| <property name="code.cleanup.on.save" value="true" /> | |||
| <property name="format.on.save" value="true" /> | |||
| <property name="last_directory_selection" value="$PROJECT_DIR$/app/src/main/res/drawable" /> | |||
| <property name="last_opened_file_path" value="$PROJECT_DIR$/app/src/main/res/drawable-v24" /> | |||
| <property name="last_opened_file_path" value="$USER_HOME$/AppData/Local/Google/AndroidStudio2021.2/device-explorer/pixel_2_q_10_0_-_api_29 [emulator-5554]/data/data/ch.spherIC.recurvebowsight/databases/RecurveBowSight.db" /> | |||
| <property name="optimize.imports.on.save" value="true" /> | |||
| <property name="settings.editor.selected.configurable" value="preferences.sourceCode.Java" /> | |||
| <property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.General" /> | |||
| </component> | |||
| <component name="RecentsManager"> | |||
| <key name="android.template.-1377507120"> | |||
| @@ -179,8 +186,13 @@ | |||
| </key> | |||
| <key name="CopyClassDialog.RECENTS_KEY"> | |||
| <recent name="ch.spherIC.recurvebowsight.ui.configuration" /> | |||
| <recent name="ch.spherIC.recurvebowsight.database.scheme.masterdata" /> | |||
| <recent name="ch.spherIC.recurvebowsight.model" /> | |||
| <recent name="ch.spherIC.recurvebowsight.database.dao" /> | |||
| <recent name="ch.spherIC.recurvebowsight.ui.calcsight" /> | |||
| <recent name="ch.spherIC.recurvebowsight.ui.equipment" /> | |||
| </key> | |||
| <key name="android.template.1317499478"> | |||
| <recent name="ch.spherIC.recurvebowsight" /> | |||
| </key> | |||
| </component> | |||
| <component name="RunManager"> | |||
| @@ -356,12 +368,42 @@ | |||
| <line>26</line> | |||
| <option name="timeStamp" value="137" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java</url> | |||
| <line>97</line> | |||
| <option name="timeStamp" value="138" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java</url> | |||
| <line>148</line> | |||
| <option name="timeStamp" value="139" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java</url> | |||
| <line>107</line> | |||
| <option name="timeStamp" value="140" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java</url> | |||
| <line>87</line> | |||
| <option name="timeStamp" value="143" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java</url> | |||
| <line>162</line> | |||
| <option name="timeStamp" value="145" /> | |||
| </line-breakpoint> | |||
| </breakpoints> | |||
| </breakpoint-manager> | |||
| <watches-manager> | |||
| <configuration name="app"> | |||
| <watch expression="this" /> | |||
| <watch expression="menu.findItem(R.id.action_help)" language="JAVA" custom="ch.spherIC.recurvebowsight.R" /> | |||
| <watch expression="ArrowDao.getInstance()" language="JAVA" /> | |||
| <watch expression="getIdColumn()" language="JAVA" /> | |||
| <watch expression="getTableName()" language="JAVA" /> | |||
| <watch expression="this.db.get()" language="JAVA" /> | |||
| <watch expression="cursor.getCount()" language="JAVA" /> | |||
| <watch expression="cursor.getColumnCount()" language="JAVA" /> | |||
| </configuration> | |||
| </watches-manager> | |||
| </component> | |||
| @@ -28,6 +28,9 @@ | |||
| <activity | |||
| android:name=".ui.configuration.ArcherySetupConfigurationActivity" | |||
| android:exported="false" /> | |||
| <activity | |||
| android:name=".ui.configuration.ArrowConfigurationActivity" | |||
| android:exported="false" /> | |||
| <activity | |||
| android:name=".ui.configuration.SightConfigurationActivity" | |||
| android:exported="false" /> | |||
| @@ -41,6 +44,7 @@ | |||
| android:theme="@style/Theme.RecurveBowSight.Starting"> | |||
| <intent-filter> | |||
| <action android:name="android.intent.action.MAIN" /> | |||
| <category android:name="android.intent.category.LAUNCHER" /> | |||
| </intent-filter> | |||
| </activity> | |||
| @@ -5,24 +5,32 @@ package ch.spherIC.recurvebowsight.database; | |||
| import android.annotation.SuppressLint; | |||
| import android.content.Context; | |||
| import android.database.Cursor; | |||
| import android.database.sqlite.SQLiteDatabase; | |||
| import android.database.sqlite.SQLiteOpenHelper; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.UUID; | |||
| import ch.spherIC.recurvebowsight.database.dao.ArcherySetupDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.ArrowDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.RiserDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.SightDao; | |||
| import ch.spherIC.recurvebowsight.database.scheme.data.TblRBSArcherySetup; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSArrow; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSRiser; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSSight; | |||
| import ch.spherIC.recurvebowsight.model.ArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| import ch.spherIC.recurvebowsight.model.Riser; | |||
| import ch.spherIC.recurvebowsight.model.Sight; | |||
| import ch.spherIC.recurvebowsight.model.impl.ArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.impl.Arrow; | |||
| import ch.spherIC.recurvebowsight.model.impl.Riser; | |||
| import ch.spherIC.recurvebowsight.model.impl.Sight; | |||
| /** | |||
| @@ -33,7 +41,7 @@ import ch.spherIC.recurvebowsight.model.Sight; | |||
| public final class RBSDatabaseHelper extends SQLiteOpenHelper { | |||
| public static final String DB_NAME = "RecurveBowSight.db"; | |||
| public static final int DB_VERSION = 2; | |||
| public static final int DB_VERSION = 3; | |||
| @SuppressLint("StaticFieldLeak") | |||
| private static RBSDatabaseHelper instance; | |||
| @@ -99,6 +107,7 @@ public final class RBSDatabaseHelper extends SQLiteOpenHelper { | |||
| // Create Tables | |||
| db.execSQL(TblRBSRiser.getCreateStatement()); | |||
| db.execSQL(TblRBSSight.getCreateStatement()); | |||
| db.execSQL(TblRBSArrow.getCreateStatement()); | |||
| db.execSQL(TblRBSArcherySetup.getCreateStatement()); | |||
| this.databaseCreated = true; | |||
| @@ -111,6 +120,7 @@ public final class RBSDatabaseHelper extends SQLiteOpenHelper { | |||
| IRiser riserFS; | |||
| ISight sightFS; | |||
| IArrow arrowFS; | |||
| IArcherySetup archerySetup = getArcherySetupMasterData(); | |||
| for (IRiser riser : getRiserMasterData()) { | |||
| @@ -121,43 +131,108 @@ public final class RBSDatabaseHelper extends SQLiteOpenHelper { | |||
| SightDao.getInstance().insert(sight); | |||
| } | |||
| for (IArrow arrow : getArrowMasterData()) { | |||
| ArrowDao.getInstance().insert(arrow); | |||
| } | |||
| riserFS = RiserDao.getInstance().loadById(1); | |||
| sightFS = SightDao.getInstance().loadById(1); | |||
| arrowFS = ArrowDao.getInstance().loadById(1); | |||
| archerySetup.setRiser(riserFS); | |||
| archerySetup.setSight(sightFS); | |||
| archerySetup.setArrow(arrowFS); | |||
| ArcherySetupDao.getInstance().insert(archerySetup); | |||
| } | |||
| @Override | |||
| public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) { | |||
| if (oldVersion == 1 && newVersion == 2) { | |||
| String sql = "Alter table " + TblRBSSight.NAME + " add column " + TblRBSSight.COL_POINTER_OFFSET + " Real NOT NULL DEFAULT 0"; | |||
| db.execSQL(sql); | |||
| switch (oldVersion) { | |||
| case 1: | |||
| upgradeFromV1ToV2(db); | |||
| case 2: | |||
| upgradeFromV2ToV3(db); | |||
| } | |||
| } | |||
| private void upgradeFromV1ToV2(SQLiteDatabase db) { | |||
| String sql = "Alter table " + TblRBSSight.NAME + " add column " + TblRBSSight.COL_POINTER_OFFSET + " Real NOT NULL DEFAULT 0"; | |||
| db.execSQL(sql); | |||
| } | |||
| private List<IRiser> getRiserMasterData() { | |||
| private void upgradeFromV2ToV3(SQLiteDatabase db) { | |||
| RiserDao.getInstance(db); | |||
| SightDao.getInstance(db); | |||
| ArrowDao.getInstance(db); | |||
| ArcherySetupDao.getInstance(db); | |||
| Map<Long, IArrow> arrowForAS = new HashMap<>(); | |||
| List<IRiser> risers = new ArrayList<>(); | |||
| // Create new Table RBS_ARROW | |||
| db.execSQL(TblRBSArrow.getCreateStatement()); | |||
| risers.add(new Riser(0, "Hoyt", "HPX", 27d, 0d, 61d)); | |||
| // Insert dummy and default master data in new Table RBS_ARROW | |||
| IArrow arrowDummy = ArrowDao.getInstance(db).insert(getArrowDummy()); | |||
| for (IArrow arrow : getArrowMasterData()) { | |||
| ArrowDao.getInstance(db).insert(arrow); | |||
| } | |||
| // Insert existing arrow data from Archery setups in new Table RBS_ARROW | |||
| Cursor cursor = db.query(TblRBSArcherySetup.NAME, null, null, null, null, null, null); | |||
| cursor.moveToFirst(); | |||
| while (!cursor.isAfterLast()) { | |||
| long asId = cursor.getLong(0); | |||
| double diameter = cursor.getDouble(4); | |||
| double cw = cursor.getDouble(5); | |||
| double weight = cursor.getDouble(6); | |||
| double v0 = cursor.getDouble(7); | |||
| IArrow arrow = new Arrow(0, "Mfct_" + UUID.randomUUID().toString(), "Mdl_" + UUID.randomUUID().toString(), | |||
| diameter, weight, cw, v0, "1xweiss/2xrot"); | |||
| arrow = ArrowDao.getInstance(db).insert(arrow); | |||
| if (arrow != null) { | |||
| arrowForAS.put(asId, arrow); | |||
| } | |||
| cursor.moveToNext(); | |||
| } | |||
| // Upgrade ArcherySetup Table | |||
| db.execSQL(TblRBSArcherySetup.getCreateTempTableStatement_Upd2V3()); | |||
| db.execSQL(TblRBSArcherySetup.getInsertIntoTempTable_Upd2V3()); | |||
| db.execSQL("Drop Table " + TblRBSArcherySetup.NAME); | |||
| db.execSQL(TblRBSArcherySetup.getCreateStatement()); | |||
| db.execSQL(TblRBSArcherySetup.getInsertIntoTable_Upd2V3()); | |||
| db.execSQL("Drop Table " + TblRBSArcherySetup.BACKUP_NAME); | |||
| ArrowDao.getInstance(db).delete(arrowDummy); | |||
| // Insert arrow id's in archery setups | |||
| for (Map.Entry<Long, IArrow> entry : arrowForAS.entrySet()) { | |||
| IArcherySetup archerySetup = ArcherySetupDao.getInstance(db).loadById(entry.getKey()); | |||
| archerySetup.setArrow(entry.getValue()); | |||
| ArcherySetupDao.getInstance(db).update(archerySetup); | |||
| } | |||
| } | |||
| private List<IRiser> getRiserMasterData() { | |||
| List<IRiser> risers = new ArrayList<>(); | |||
| risers.add(new Riser(0, "Hoyt", "HPX", 27d, 0d, 61d)); | |||
| return risers; | |||
| } | |||
| private List<ISight> getSightMasterData() { | |||
| List<ISight> sights = new ArrayList<>(); | |||
| sights.add(new Sight(0, "Avalon", "Tec One", 17.5, -12d, "260,250,240,230,220,210,200,190,180,170,160", 5d, 105d, 0d)); | |||
| return sights; | |||
| } | |||
| private List<IArrow> getArrowMasterData() { | |||
| List<IArrow> arrows = new ArrayList<>(); | |||
| arrows.add(new Arrow(0, "Easton", "Carbon One 600", 5.8, 21.0, 3.1, 57.6, "1xWeiss,2xBlau")); | |||
| return arrows; | |||
| } | |||
| private IArrow getArrowDummy() { | |||
| return new Arrow(-999, "Dummy", "Dummy", 1.0, 1.0, 0.0, 0., "dummycol"); | |||
| } | |||
| private IArcherySetup getArcherySetupMasterData() { | |||
| return new ArcherySetup(0, "FITA Indoor FS", null, null, 5.8, 3.10, 21d, 57.60, 1.30, 71d, 1.57, 135d, 0.001, 0.1, 55d, 260d, 11d, 195d); | |||
| return new ArcherySetup(0, "FITA Indoor FS", null, null, null, 1.30, 71d, 1.57, 135d, 0.001, 0.1, 55d, 260d, 11d, 195d); | |||
| } | |||
| } | |||
| @@ -5,12 +5,14 @@ package ch.spherIC.recurvebowsight.database.dao; | |||
| import android.content.ContentValues; | |||
| import android.database.Cursor; | |||
| import android.database.sqlite.SQLiteDatabase; | |||
| import ch.spherIC.recurvebowsight.database.scheme.data.TblRBSArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.ArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| import ch.spherIC.recurvebowsight.model.impl.ArcherySetup; | |||
| /** | |||
| @@ -18,13 +20,16 @@ import ch.spherIC.recurvebowsight.model.ISight; | |||
| */ | |||
| public final class ArcherySetupDao extends DAO<IArcherySetup> { | |||
| private static ArcherySetupDao instance; | |||
| private ArcherySetupDao() { | |||
| super(); | |||
| } | |||
| private ArcherySetupDao(SQLiteDatabase db) { | |||
| super(db); | |||
| } | |||
| public static ArcherySetupDao getInstance() { | |||
| if (instance == null) { | |||
| instance = new ArcherySetupDao(); | |||
| @@ -32,18 +37,27 @@ public final class ArcherySetupDao extends DAO<IArcherySetup> { | |||
| return instance; | |||
| } | |||
| public static ArcherySetupDao getInstance(SQLiteDatabase db) { | |||
| if (instance == null) { | |||
| instance = new ArcherySetupDao(db); | |||
| } else { | |||
| instance.setDb(db); | |||
| } | |||
| return instance; | |||
| } | |||
| @Override | |||
| protected IArcherySetup cursorToEntity(final Cursor cursor) { | |||
| ISight sight = SightDao.getInstance().loadById(cursor.getLong(2)); | |||
| IRiser riser = RiserDao.getInstance().loadById(cursor.getLong(3)); | |||
| IArrow arrow = ArrowDao.getInstance().loadById(cursor.getLong(4)); | |||
| 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), cursor.getDouble(16), | |||
| cursor.getDouble(17)); | |||
| IArcherySetup archerySetup = new ArcherySetup(cursor.getLong(0), cursor.getString(1), sight, riser, arrow, 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)); | |||
| return archerySetup; | |||
| } | |||
| @@ -58,10 +72,7 @@ public final class ArcherySetupDao extends DAO<IArcherySetup> { | |||
| 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); | |||
| values.put(TblRBSArcherySetup.COL_ARROWCW, entity.getArrowCw() != null ? entity.getArrowCw() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWWEIGHT, entity.getArrowWeight() != null ? entity.getArrowWeight() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWV0, entity.getArrowV0() != null ? entity.getArrowV0() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROW, entity.getArrow() != null ? entity.getArrow().getId() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWCENTERHEIGHT, entity.getTargetCenterHeight() != null ? entity.getTargetCenterHeight() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_BOWPULLOUT, entity.getBowPullout() != null ? entity.getBowPullout() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWNOCKHEIGHT, entity.getArrowNockHeight() != null ? entity.getArrowNockHeight() : 0d); | |||
| @@ -0,0 +1,85 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.database.dao; | |||
| import android.content.ContentValues; | |||
| import android.database.Cursor; | |||
| import android.database.sqlite.SQLiteDatabase; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSArrow; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| import ch.spherIC.recurvebowsight.model.impl.Arrow; | |||
| /** | |||
| * @author F. Smilari | |||
| */ | |||
| public final class ArrowDao extends DAO<IArrow> { | |||
| private static ArrowDao instance; | |||
| private ArrowDao() { | |||
| super(); | |||
| } | |||
| private ArrowDao(SQLiteDatabase db) { | |||
| super(db); | |||
| } | |||
| public static ArrowDao getInstance() { | |||
| if (instance == null) { | |||
| instance = new ArrowDao(); | |||
| } | |||
| return instance; | |||
| } | |||
| public static ArrowDao getInstance(SQLiteDatabase db) { | |||
| if (instance == null) { | |||
| instance = new ArrowDao(db); | |||
| } else { | |||
| instance.setDb(db); | |||
| } | |||
| return instance; | |||
| } | |||
| @Override | |||
| protected IArrow cursorToEntity(final Cursor cursor) { | |||
| return new Arrow(cursor.getLong(0), cursor.getString(1), cursor.getString(2), cursor.getDouble(3), cursor.getDouble(4), | |||
| cursor.getDouble(5), cursor.getDouble(6), cursor.getString(7)); | |||
| } | |||
| @Override | |||
| protected ContentValues getContentValues(final IArrow entity) { | |||
| ContentValues values = new ContentValues(); | |||
| if (entity.getId() > 0) { | |||
| values.put(TblRBSArrow.COL_ID, entity.getId()); | |||
| } | |||
| values.put(TblRBSArrow.COL_MANUFACTURER, !entity.getManufacturer().isEmpty() ? entity.getManufacturer() : ""); | |||
| values.put(TblRBSArrow.COL_MODEL, !entity.getModel().isEmpty() ? entity.getModel() : ""); | |||
| values.put(TblRBSArrow.COL_DIAMETER, entity.getDiameter() != null ? entity.getDiameter() : 0d); | |||
| values.put(TblRBSArrow.COL_WEIGHT, entity.getWeight() != null ? entity.getWeight() : 0d); | |||
| values.put(TblRBSArrow.COL_CW, entity.getCw() != null ? entity.getCw() : 0d); | |||
| values.put(TblRBSArrow.COL_V0, entity.getV0() != null ? entity.getV0() : 0d); | |||
| values.put(TblRBSArrow.COL_COLORS, entity.getColors() != null ? entity.getColors() : ""); | |||
| return values; | |||
| } | |||
| @Override | |||
| protected String getTableName() { | |||
| return TblRBSArrow.NAME; | |||
| } | |||
| @Override | |||
| protected String getIdColumn() { | |||
| return TblRBSArrow.COL_ID; | |||
| } | |||
| @Override | |||
| protected String getOrderBy() { | |||
| return TblRBSArrow.COL_MANUFACTURER + " asc, " + TblRBSArrow.COL_MODEL + " asc, " + TblRBSArrow.COL_DIAMETER + " asc"; | |||
| } | |||
| } | |||
| @@ -9,6 +9,7 @@ import android.database.sqlite.SQLiteDatabase; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Optional; | |||
| import ch.spherIC.recurvebowsight.database.RBSDatabaseHelper; | |||
| import ch.spherIC.recurvebowsight.model.IEntity; | |||
| @@ -21,6 +22,7 @@ import ch.spherIC.recurvebowsight.model.IEntity; | |||
| */ | |||
| public abstract class DAO<E extends IEntity> { | |||
| private Optional<SQLiteDatabase> db = Optional.empty(); | |||
| /** | |||
| * Konstruktor. | |||
| @@ -29,12 +31,24 @@ public abstract class DAO<E extends IEntity> { | |||
| super(); | |||
| } | |||
| /** | |||
| * Konstruktor. | |||
| */ | |||
| public DAO(SQLiteDatabase db) { | |||
| super(); | |||
| setDb(db); | |||
| } | |||
| /** | |||
| * @return the db | |||
| */ | |||
| protected SQLiteDatabase getDb() { | |||
| return RBSDatabaseHelper.getInstance().getWritableDatabase(); | |||
| return this.db.isPresent() ? db.get() : RBSDatabaseHelper.getInstance().getWritableDatabase(); | |||
| } | |||
| protected void setDb(SQLiteDatabase db) { | |||
| this.db = Optional.of(db); | |||
| } | |||
| protected abstract E cursorToEntity(final Cursor cursor); | |||
| @@ -47,7 +61,26 @@ public abstract class DAO<E extends IEntity> { | |||
| /** | |||
| * Lädt das Entität über eine Id. | |||
| * Lädt die Entität über eine Id. | |||
| * | |||
| * @param id | |||
| * @param db | |||
| * @return E | |||
| */ | |||
| public E loadById(final long id, SQLiteDatabase db) { | |||
| E entity; | |||
| Cursor cursor = db.query(getTableName(), null, getIdColumn() + " = " + id, null, null, null, null); | |||
| if (cursor.getCount() > 0) { | |||
| cursor.moveToFirst(); | |||
| entity = cursorToEntity(cursor); | |||
| cursor.close(); | |||
| return entity; | |||
| } | |||
| return null; | |||
| } | |||
| /** | |||
| * Lädt die Entität über eine Id. | |||
| * | |||
| * @param id | |||
| * @return E | |||
| @@ -55,14 +88,17 @@ public abstract class DAO<E extends IEntity> { | |||
| public E loadById(final long id) { | |||
| E entity; | |||
| Cursor cursor = getDb().query(getTableName(), null, getIdColumn() + " = " + id, null, null, null, null); | |||
| cursor.moveToFirst(); | |||
| entity = cursorToEntity(cursor); | |||
| cursor.close(); | |||
| return entity; | |||
| if (cursor.getCount() > 0) { | |||
| cursor.moveToFirst(); | |||
| entity = cursorToEntity(cursor); | |||
| cursor.close(); | |||
| return entity; | |||
| } | |||
| return null; | |||
| } | |||
| /** | |||
| * L�dt alle Entit�ten. | |||
| * Lädt alle Entitäten. | |||
| * | |||
| * @return | |||
| */ | |||
| @@ -81,6 +117,38 @@ public abstract class DAO<E extends IEntity> { | |||
| return entities; | |||
| } | |||
| /** | |||
| * Lädt alle Entitäten. | |||
| * | |||
| * @return | |||
| */ | |||
| public List<E> loadAll(SQLiteDatabase db) { | |||
| List<E> entities = new ArrayList<E>(); | |||
| Cursor cursor = db.query(getTableName(), null, null, null, null, null, getOrderBy()); | |||
| cursor.moveToFirst(); | |||
| while (!cursor.isAfterLast()) { | |||
| E entity = cursorToEntity(cursor); | |||
| entities.add(entity); | |||
| cursor.moveToNext(); | |||
| } | |||
| cursor.close(); | |||
| return entities; | |||
| } | |||
| /** | |||
| * Fügt eine Entität in die DB ein. | |||
| * | |||
| * @param entity | |||
| * @return | |||
| */ | |||
| public E insert(final E entity, SQLiteDatabase db) { | |||
| ContentValues values = getContentValues(entity); | |||
| long insertId = db.insert(getTableName(), null, values); | |||
| return insertId == -1 ? null : loadById(insertId, db); | |||
| } | |||
| /** | |||
| * Fügt eine Entität in die DB ein. | |||
| * | |||
| @@ -90,11 +158,24 @@ public abstract class DAO<E extends IEntity> { | |||
| public E insert(final E entity) { | |||
| ContentValues values = getContentValues(entity); | |||
| long insertId = getDb().insert(getTableName(), null, values); | |||
| return loadById(insertId); | |||
| return insertId == -1 ? null : loadById(insertId); | |||
| } | |||
| /** | |||
| * Updated eine Entit�t in der DB ein. | |||
| * Updated eine Entität in der DB ein. | |||
| * | |||
| * @param entity | |||
| * @param db | |||
| * @return | |||
| */ | |||
| public E update(final E entity, SQLiteDatabase db) { | |||
| ContentValues values = getContentValues(entity); | |||
| db.update(getTableName(), values, getIdColumn() + " = " + entity.getId(), null); | |||
| return loadById(entity.getId(), db); | |||
| } | |||
| /** | |||
| * Updated eine Entität in der DB ein. | |||
| * | |||
| * @param entity | |||
| * @return | |||
| @@ -106,7 +187,17 @@ public abstract class DAO<E extends IEntity> { | |||
| } | |||
| /** | |||
| * L�schet eine Entit�t aus der DB. | |||
| * Löscht eine Entität aus der DB. | |||
| * | |||
| * @param entity | |||
| * @param db | |||
| */ | |||
| public void delete(final E entity, SQLiteDatabase db) { | |||
| db.delete(getTableName(), getIdColumn() + " = " + entity.getId(), null); | |||
| } | |||
| /** | |||
| * Löscht eine Entität aus der DB. | |||
| * | |||
| * @param entity | |||
| */ | |||
| @@ -5,10 +5,11 @@ package ch.spherIC.recurvebowsight.database.dao; | |||
| import android.content.ContentValues; | |||
| import android.database.Cursor; | |||
| import android.database.sqlite.SQLiteDatabase; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSRiser; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.Riser; | |||
| import ch.spherIC.recurvebowsight.model.impl.Riser; | |||
| /** | |||
| @@ -23,6 +24,10 @@ public final class RiserDao extends DAO<IRiser> { | |||
| super(); | |||
| } | |||
| private RiserDao(SQLiteDatabase db) { | |||
| super(db); | |||
| } | |||
| public static RiserDao getInstance() { | |||
| if (instance == null) { | |||
| instance = new RiserDao(); | |||
| @@ -30,6 +35,14 @@ public final class RiserDao extends DAO<IRiser> { | |||
| return instance; | |||
| } | |||
| public static RiserDao getInstance(SQLiteDatabase db) { | |||
| if (instance == null) { | |||
| instance = new RiserDao(db); | |||
| } else { | |||
| instance.setDb(db); | |||
| } | |||
| return instance; | |||
| } | |||
| @Override | |||
| protected IRiser cursorToEntity(final Cursor cursor) { | |||
| @@ -5,10 +5,11 @@ package ch.spherIC.recurvebowsight.database.dao; | |||
| import android.content.ContentValues; | |||
| import android.database.Cursor; | |||
| import android.database.sqlite.SQLiteDatabase; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSSight; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| import ch.spherIC.recurvebowsight.model.Sight; | |||
| import ch.spherIC.recurvebowsight.model.impl.Sight; | |||
| /** | |||
| @@ -23,6 +24,10 @@ public final class SightDao extends DAO<ISight> { | |||
| super(); | |||
| } | |||
| private SightDao(SQLiteDatabase db) { | |||
| super(db); | |||
| } | |||
| public static SightDao getInstance() { | |||
| if (instance == null) { | |||
| instance = new SightDao(); | |||
| @@ -30,6 +35,15 @@ public final class SightDao extends DAO<ISight> { | |||
| return instance; | |||
| } | |||
| public static SightDao getInstance(SQLiteDatabase db) { | |||
| if (instance == null) { | |||
| instance = new SightDao(db); | |||
| } else { | |||
| instance.setDb(db); | |||
| } | |||
| return instance; | |||
| } | |||
| @Override | |||
| protected ISight cursorToEntity(final Cursor cursor) { | |||
| @@ -3,6 +3,7 @@ | |||
| */ | |||
| package ch.spherIC.recurvebowsight.database.scheme.data; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSArrow; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSRiser; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSSight; | |||
| @@ -10,14 +11,20 @@ import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSSight; | |||
| public final class TblRBSArcherySetup { | |||
| public static final String NAME = "RBS_ARCHERYSETUP"; | |||
| public static final String BACKUP_NAME = "RBS_ARCHERYSETUP_backup"; | |||
| 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_ARROW = "ARCHERYSETUP_ARROW"; | |||
| @Deprecated | |||
| public static final String COL_ARROWDIAMETER = "ARCHERYSETUP_ARROWDIAMETER"; | |||
| @Deprecated | |||
| public static final String COL_ARROWCW = "ARCHERYSETUP_ARROWCW"; | |||
| @Deprecated | |||
| public static final String COL_ARROWWEIGHT = "ARCHERYSETUP_ARROWWEIGHT"; | |||
| @Deprecated | |||
| public static final String COL_ARROWV0 = "ARCHERYSETUP_ARROWV0"; | |||
| public static final String COL_ARROWCENTERHEIGHT = "ARCHERYSETUP_ARROWCENTERHEIGHT"; | |||
| public static final String COL_BOWPULLOUT = "ARCHERYSETUP_BOWPULLOUT"; | |||
| @@ -36,6 +43,31 @@ public final class 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, " | |||
| + COL_RISER + " Integer NOT NULL, " | |||
| + COL_ARROW + " Integer NOT NULL, " | |||
| + COL_ARROWCENTERHEIGHT + " Real NOT NULL, " | |||
| + COL_BOWPULLOUT + " Real NOT NULL, " | |||
| + COL_ARROWNOCKHEIGHT + " Real NOT NULL, " | |||
| + COL_HNA + " Real NOT NULL, " | |||
| + COL_DELTATIME + " Real NOT NULL, " | |||
| + COL_CALCPRECISION + " Real NOT NULL, " | |||
| + COL_SIGHTVERTSKALAMIDDLE + " Real NOT NULL, " | |||
| + COL_SIGHTHORSETTING + " Real NOT NULL, " | |||
| + COL_NOCKRAISING + " Real NOT NULL, " | |||
| + COL_BRACEHEIGHT + " Real NOT NULL, " | |||
| + "constraint UNIQUE_ARCHERYSETUP_NAME UNIQUE (" + COL_NAME + "), " | |||
| + "constraint UNIQUE_ARCHERYSETUP_SIGHT_RISER_ARROW UNIQUE (" + COL_SIGHT + "," + COL_RISER + "," + COL_ARROW + ")," | |||
| + "FOREIGN KEY(" + COL_SIGHT + ") REFERENCES RBS_SIGHT (" + TblRBSSight.COL_ID + "), " | |||
| + "FOREIGN KEY(" + COL_RISER + ") REFERENCES RBS_RISER (" + TblRBSRiser.COL_ID + ")" | |||
| + "FOREIGN KEY(" + COL_ARROW + ") REFERENCES RBS_ARROW (" + TblRBSArrow.COL_ID + ")" | |||
| + ");"; | |||
| } | |||
| public static String getCreateTempTableStatement_Upd2V3() { | |||
| return "create table " + BACKUP_NAME + "(" | |||
| + COL_ID + " Integer primary key autoincrement, " | |||
| + COL_NAME + " Text NOT NULL, " | |||
| + COL_SIGHT + " Integer NOT NULL, " | |||
| @@ -61,4 +93,29 @@ public final class TblRBSArcherySetup { | |||
| + ");"; | |||
| } | |||
| public static String getInsertIntoTempTable_Upd2V3() { | |||
| return "INSERT INTO " + BACKUP_NAME + " SELECT * FROM " + NAME; | |||
| } | |||
| public static String getInsertIntoTable_Upd2V3() { | |||
| return "INSERT INTO " + NAME + " SELECT " | |||
| + COL_ID + ", " | |||
| + COL_NAME + ", " | |||
| + COL_SIGHT + ", " | |||
| + COL_RISER + ", " | |||
| + -999 + ", " | |||
| + COL_ARROWCENTERHEIGHT + ", " | |||
| + COL_BOWPULLOUT + ", " | |||
| + COL_ARROWNOCKHEIGHT + ", " | |||
| + COL_HNA + ", " | |||
| + COL_DELTATIME + ", " | |||
| + COL_CALCPRECISION + ", " | |||
| + COL_SIGHTVERTSKALAMIDDLE + ", " | |||
| + COL_SIGHTHORSETTING + ", " | |||
| + COL_NOCKRAISING + ", " | |||
| + COL_BRACEHEIGHT | |||
| + " FROM " + BACKUP_NAME; | |||
| } | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.database.scheme.masterdata; | |||
| public final class TblRBSArrow { | |||
| public static final String NAME = "RBS_ARROW"; | |||
| public static final String COL_ID = "ARROW_ID"; | |||
| public static final String COL_MANUFACTURER = "ARROW_MANUFACTURER"; | |||
| public static final String COL_MODEL = "ARROW_MODEL"; | |||
| public static final String COL_DIAMETER = "ARROW_DIAMETER"; | |||
| public static final String COL_WEIGHT = "ARROW_WEIGHT"; | |||
| public static final String COL_CW = "ARROW_CW"; | |||
| public static final String COL_V0 = "ARROW_V0"; | |||
| public static final String COL_COLORS = "ARROW_COLORS"; | |||
| private TblRBSArrow() { | |||
| } | |||
| public static String getCreateStatement() { | |||
| return "create table " + NAME + "(" | |||
| + COL_ID + " Integer primary key autoincrement, " | |||
| + COL_MANUFACTURER + " Text NOT NULL, " | |||
| + COL_MODEL + " Text NOT NULL, " | |||
| + COL_DIAMETER + " Real NOT NULL, " | |||
| + COL_WEIGHT + " Real NOT NULL, " | |||
| + COL_CW + " Real NOT NULL, " | |||
| + COL_V0 + " Real NOT NULL, " | |||
| + COL_COLORS + " Text NOT NULL, " | |||
| + "constraint UNIQUE_MF_MODEL_DIAMETER UNIQUE (" + COL_MANUFACTURER + "," + COL_MODEL + "," + COL_DIAMETER + ")" | |||
| + ");"; | |||
| } | |||
| } | |||
| @@ -20,6 +20,12 @@ public interface IArcherySetup extends IEntity, Parcelable { | |||
| String getRiserName(); | |||
| void setArrow(IArrow arrow); | |||
| IArrow getArrow(); | |||
| String getArrowName(); | |||
| void setRiser(IRiser riser); | |||
| Double getArrowDiameter(); | |||
| @@ -0,0 +1,40 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.model; | |||
| /** | |||
| * @author F. Smilari | |||
| */ | |||
| public interface IArrow extends IEntity { | |||
| String getManufacturer(); | |||
| void setManufacturer(String maufacturer); | |||
| String getModel(); | |||
| void setModel(String model); | |||
| Double getDiameter(); | |||
| void setDiameter(Double diameter); | |||
| Double getWeight(); | |||
| void setWeight(Double weight); | |||
| Double getCw(); | |||
| void setCw(Double cw); | |||
| Double getV0(); | |||
| void setV0(Double v0); | |||
| String getColors(); | |||
| void setColors(String colors); | |||
| } | |||
| @@ -1,25 +1,29 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.model; | |||
| package ch.spherIC.recurvebowsight.model.impl; | |||
| import android.annotation.SuppressLint; | |||
| import android.os.Parcel; | |||
| import java.util.Objects; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| /** | |||
| * @author F. Smilari | |||
| */ | |||
| @SuppressLint("ParcelCreator") | |||
| public class ArcherySetup implements IArcherySetup { | |||
| private long id; | |||
| private String name; | |||
| private ISight sight; | |||
| private IRiser riser; | |||
| private Double arrowDiameter; | |||
| private Double arrowCw; | |||
| private Double arrowWeight; | |||
| private Double arrowV0; | |||
| private IArrow arrow; | |||
| private Double targetCenterHeight; | |||
| private Double bowPullout; | |||
| private Double arrowNockHeight; | |||
| @@ -37,10 +41,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| * @param id | |||
| * @param sight | |||
| * @param riser | |||
| * @param arrowDiameter | |||
| * @param arrowCw | |||
| * @param arrowWeight | |||
| * @param arrowV0 | |||
| * @param arrow | |||
| * @param targetCenterHeight | |||
| * @param bowPullout | |||
| * @param arrowNockHeight | |||
| @@ -53,8 +54,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| * @param braceHeight | |||
| */ | |||
| 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 targetCenterHeight, final Double bowPullout, | |||
| final IArrow arrow, final Double targetCenterHeight, final Double bowPullout, | |||
| final Double arrowNockHeight, final Double hNA, final Double deltaTime, | |||
| final Double calcPrecision, final Double sightVertSkalaMiddle, | |||
| final Double sightHorSetting, final Double nockRaising, final Double braceHeight) { | |||
| @@ -63,10 +63,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| this.name = name; | |||
| this.sight = sight; | |||
| this.riser = riser; | |||
| this.arrowDiameter = arrowDiameter; | |||
| this.arrowCw = arrowCw; | |||
| this.arrowWeight = arrowWeight; | |||
| this.arrowV0 = arrowV0; | |||
| this.arrow = arrow; | |||
| this.targetCenterHeight = targetCenterHeight; | |||
| this.bowPullout = bowPullout; | |||
| this.arrowNockHeight = arrowNockHeight; | |||
| @@ -146,6 +143,27 @@ public class ArcherySetup implements IArcherySetup { | |||
| return this.riser != null ? this.riser.getManufacturer() + " " + this.riser.getModel() : ""; | |||
| } | |||
| /** | |||
| * @param arrow the arrow to set | |||
| */ | |||
| @Override | |||
| public void setArrow(final IArrow arrow) { | |||
| this.arrow = arrow; | |||
| } | |||
| /** | |||
| * @return the arrow | |||
| */ | |||
| @Override | |||
| public IArrow getArrow() { | |||
| return this.arrow; | |||
| } | |||
| @Override | |||
| public String getArrowName() { | |||
| return this.arrow != null ? this.arrow.getManufacturer() + " " + this.arrow.getModel() + " (" + this.arrow.getColors() + ")" : ""; | |||
| } | |||
| /** | |||
| * @param riser the riser to set | |||
| */ | |||
| @@ -159,7 +177,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| */ | |||
| @Override | |||
| public Double getArrowDiameter() { | |||
| return this.arrowDiameter; | |||
| return this.arrow != null ? this.arrow.getDiameter() : null; | |||
| } | |||
| /** | |||
| @@ -167,7 +185,9 @@ public class ArcherySetup implements IArcherySetup { | |||
| */ | |||
| @Override | |||
| public void setArrowDiameter(final Double arrowDiameter) { | |||
| this.arrowDiameter = arrowDiameter; | |||
| if (this.arrow != null) { | |||
| this.arrow.setDiameter(arrowDiameter); | |||
| } | |||
| } | |||
| /** | |||
| @@ -175,7 +195,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| */ | |||
| @Override | |||
| public Double getArrowCw() { | |||
| return this.arrowCw; | |||
| return this.arrow != null ? this.arrow.getCw() : null; | |||
| } | |||
| /** | |||
| @@ -183,7 +203,9 @@ public class ArcherySetup implements IArcherySetup { | |||
| */ | |||
| @Override | |||
| public void setArrowCw(final Double arrowCw) { | |||
| this.arrowCw = arrowCw; | |||
| if (this.arrow != null) { | |||
| this.arrow.setCw(arrowCw); | |||
| } | |||
| } | |||
| /** | |||
| @@ -191,7 +213,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| */ | |||
| @Override | |||
| public Double getArrowWeight() { | |||
| return this.arrowWeight; | |||
| return this.arrow != null ? this.arrow.getWeight() : null; | |||
| } | |||
| /** | |||
| @@ -199,7 +221,9 @@ public class ArcherySetup implements IArcherySetup { | |||
| */ | |||
| @Override | |||
| public void setArrowWeight(final Double arrowWeight) { | |||
| this.arrowWeight = arrowWeight; | |||
| if (this.arrow != null) { | |||
| this.arrow.setWeight(arrowWeight); | |||
| } | |||
| } | |||
| /** | |||
| @@ -207,7 +231,7 @@ public class ArcherySetup implements IArcherySetup { | |||
| */ | |||
| @Override | |||
| public Double getArrowV0() { | |||
| return this.arrowV0; | |||
| return this.arrow != null ? this.arrow.getV0() : null; | |||
| } | |||
| /** | |||
| @@ -215,7 +239,9 @@ public class ArcherySetup implements IArcherySetup { | |||
| */ | |||
| @Override | |||
| public void setArrowV0(final Double arrowV0) { | |||
| this.arrowV0 = arrowV0; | |||
| if (this.arrow != null) { | |||
| this.arrow.setV0(arrowV0); | |||
| } | |||
| } | |||
| /** | |||
| @@ -0,0 +1,190 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.model.impl; | |||
| import java.text.DecimalFormat; | |||
| import java.util.Objects; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| /** | |||
| * @author F. Smilari | |||
| */ | |||
| public class Arrow implements IArrow { | |||
| private static final DecimalFormat DF = new DecimalFormat("0.###"); | |||
| private long id; | |||
| private String manufacturer; | |||
| private String model; | |||
| private Double diameter; | |||
| private Double weight; | |||
| private Double cw; | |||
| private Double v0; | |||
| private String colors; | |||
| /** | |||
| * Konstruktor. | |||
| * | |||
| * @param id | |||
| * @param manufacturer | |||
| * @param model | |||
| * @param diameter | |||
| * @param weight | |||
| * @param cw | |||
| * @param v0 | |||
| * @param colors | |||
| */ | |||
| public Arrow(final long id, final String manufacturer, final String model, final Double diameter, | |||
| final Double weight, final Double cw, final Double v0, String colors) { | |||
| super(); | |||
| this.id = id; | |||
| this.manufacturer = manufacturer; | |||
| this.model = model; | |||
| this.diameter = diameter; | |||
| this.weight = weight; | |||
| this.cw = cw; | |||
| this.v0 = v0; | |||
| this.colors = colors; | |||
| } | |||
| /** | |||
| * @return the id | |||
| */ | |||
| @Override | |||
| public long getId() { | |||
| return this.id; | |||
| } | |||
| /** | |||
| * @param id the id to set | |||
| */ | |||
| @Override | |||
| public void setId(final long id) { | |||
| this.id = id; | |||
| } | |||
| /** | |||
| * @return the manufacturer | |||
| */ | |||
| @Override | |||
| public String getManufacturer() { | |||
| return this.manufacturer; | |||
| } | |||
| /** | |||
| * @param maufacturer the maufacturer to set | |||
| */ | |||
| @Override | |||
| public void setManufacturer(final String maufacturer) { | |||
| this.manufacturer = maufacturer; | |||
| } | |||
| /** | |||
| * @return the model | |||
| */ | |||
| @Override | |||
| public String getModel() { | |||
| return this.model; | |||
| } | |||
| /** | |||
| * @param model the model to set | |||
| */ | |||
| @Override | |||
| public void setModel(final String model) { | |||
| this.model = model; | |||
| } | |||
| @Override | |||
| public Double getDiameter() { | |||
| return this.diameter; | |||
| } | |||
| /** | |||
| * @param diameter the diameter to set | |||
| */ | |||
| @Override | |||
| public void setDiameter(Double diameter) { | |||
| this.diameter = diameter; | |||
| } | |||
| @Override | |||
| public Double getWeight() { | |||
| return this.weight; | |||
| } | |||
| /** | |||
| * @param weight the weight to set | |||
| */ | |||
| @Override | |||
| public void setWeight(Double weight) { | |||
| this.weight = weight; | |||
| } | |||
| @Override | |||
| public Double getCw() { | |||
| return this.cw; | |||
| } | |||
| /** | |||
| * @param cw the cw to set | |||
| */ | |||
| @Override | |||
| public void setCw(Double cw) { | |||
| this.cw = cw; | |||
| } | |||
| @Override | |||
| public Double getV0() { | |||
| return this.v0; | |||
| } | |||
| /** | |||
| * @param v0 the v0 to set | |||
| */ | |||
| @Override | |||
| public void setV0(Double v0) { | |||
| this.v0 = v0; | |||
| } | |||
| @Override | |||
| public String getColors() { | |||
| return this.colors; | |||
| } | |||
| /** | |||
| * @param colors the colors to set | |||
| */ | |||
| @Override | |||
| public void setColors(String colors) { | |||
| this.colors = colors; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| if (this.id == -999) { | |||
| return getManufacturer(); | |||
| } | |||
| return getManufacturer() + " " + getModel() + " (" + getColors() + ")"; | |||
| } | |||
| @Override | |||
| public boolean equals(Object o) { | |||
| if (this == o) { | |||
| return true; | |||
| } | |||
| if (o == null || getClass() != o.getClass()) { | |||
| return false; | |||
| } | |||
| Arrow arrow = (Arrow) o; | |||
| return id == arrow.id && manufacturer.equals(arrow.manufacturer) && model.equals(arrow.model); | |||
| } | |||
| @Override | |||
| public int hashCode() { | |||
| return Objects.hash(id, manufacturer, model); | |||
| } | |||
| } | |||
| @@ -1,11 +1,13 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.model; | |||
| package ch.spherIC.recurvebowsight.model.impl; | |||
| import java.text.DecimalFormat; | |||
| import java.util.Objects; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| /** | |||
| * @author F. Smilari | |||
| @@ -1,13 +1,15 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.model; | |||
| package ch.spherIC.recurvebowsight.model.impl; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Objects; | |||
| import java.util.StringTokenizer; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| /** | |||
| * @author F. Smilari | |||
| @@ -21,13 +21,15 @@ import androidx.appcompat.app.AppCompatActivity; | |||
| import androidx.lifecycle.ViewModelProvider; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.database.dao.ArcherySetupDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.ArrowDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.RiserDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.SightDao; | |||
| import ch.spherIC.recurvebowsight.databinding.ActivityEquipmentConfigurationBinding; | |||
| import ch.spherIC.recurvebowsight.model.ArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| import ch.spherIC.recurvebowsight.model.impl.ArcherySetup; | |||
| import ch.spherIC.recurvebowsight.ui.userguide.UserGuideArcherySetupActivity; | |||
| import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter; | |||
| import ch.spherIC.recurvebowsight.utilities.PlatformUtils; | |||
| @@ -51,7 +53,7 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| addObservers(); | |||
| addSpinnerListeners(); | |||
| addButtonListeners(); | |||
| loadSightsAndRisers(); | |||
| loadSightsRisersArrows(); | |||
| loadArcherySetups(); | |||
| } | |||
| @@ -87,10 +89,7 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| this.archerySetupConfigurationViewModel.getName().observe(this, name -> this.binding.asLabelTxt.setText(name)); | |||
| this.archerySetupConfigurationViewModel.getSight().observe(this, sight -> this.binding.asSightSelectionTxt.setText(sight != null ? sight.toString() : "", false)); | |||
| this.archerySetupConfigurationViewModel.getRiser().observe(this, riser -> this.binding.asRiserSelectionTxt.setText(riser != null ? riser.toString() : "", false)); | |||
| this.archerySetupConfigurationViewModel.getArrowDiameter().observe(this, arwDiam -> this.binding.asArrowDiameterTxt.setText(arwDiam != null ? dF.format(arwDiam) : "")); | |||
| this.archerySetupConfigurationViewModel.getArrowCw().observe(this, arwCw -> this.binding.asArrowCWTxt.setText(arwCw != null ? dF.format(arwCw) : "")); | |||
| this.archerySetupConfigurationViewModel.getArrowWeight().observe(this, arwWeight -> this.binding.asArrowWeightTxt.setText(arwWeight != null ? dF.format(arwWeight) : "")); | |||
| this.archerySetupConfigurationViewModel.getArrowV0().observe(this, aV0 -> this.binding.asArrowV0Txt.setText(aV0 != null ? dF.format(aV0) : "")); | |||
| this.archerySetupConfigurationViewModel.getArrow().observe(this, arrow -> this.binding.asArrowSelectionTxt.setText(arrow != null ? arrow.toString() : "", false)); | |||
| this.archerySetupConfigurationViewModel.getArrowNockHeight().observe(this, arwNH -> this.binding.asArrowNockHeightTxt.setText(arwNH != null ? dF2.format(arwNH) : "")); | |||
| this.archerySetupConfigurationViewModel.getTargetCenterHeight().observe(this, arwCH -> this.binding.asTargetCenterHeightTxt.setText(arwCH != null ? dF.format(arwCH) : "")); | |||
| this.archerySetupConfigurationViewModel.getBowPullout().observe(this, bowPlOut -> this.binding.asBowPulloutTxt.setText(bowPlOut != null ? dF.format(bowPlOut) : "")); | |||
| @@ -124,7 +123,7 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| saveButton.setOnClickListener(v -> saveArcherySetupConfiguration()); | |||
| } | |||
| private void loadSightsAndRisers() { | |||
| private void loadSightsRisersArrows() { | |||
| List<ISight> sights = SightDao.getInstance().loadAll(); | |||
| this.archerySetupConfigurationViewModel.setAllSights(sights); | |||
| ArrayAdapter<ISight> sightsAdapter = new NoFilterArrayAdapter<ISight>(this, android.R.layout.simple_dropdown_item_1line, sights); | |||
| @@ -135,9 +134,16 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| List<IRiser> risers = RiserDao.getInstance().loadAll(); | |||
| this.archerySetupConfigurationViewModel.setAllRisers(risers); | |||
| ArrayAdapter<IRiser> riserAdapter = new NoFilterArrayAdapter<IRiser>(this, android.R.layout.simple_dropdown_item_1line, risers); | |||
| AutoCompleteTextView textViewRisers = binding.asRiserSelectionTxt; | |||
| AutoCompleteTextView textViewRisers = this.binding.asRiserSelectionTxt; | |||
| textViewRisers.setAdapter(riserAdapter); | |||
| textViewRisers.invalidate(); | |||
| List<IArrow> arrows = ArrowDao.getInstance().loadAll(); | |||
| this.archerySetupConfigurationViewModel.setAllArrows(arrows); | |||
| ArrayAdapter<IArrow> arrowAdapter = new NoFilterArrayAdapter<IArrow>(this, android.R.layout.simple_dropdown_item_1line, arrows); | |||
| AutoCompleteTextView textViewArrows = this.binding.asArrowSelectionTxt; | |||
| textViewArrows.setAdapter(arrowAdapter); | |||
| textViewArrows.invalidate(); | |||
| } | |||
| private void loadArcherySetups() { | |||
| @@ -149,18 +155,16 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| } | |||
| private void addNewArcherySetup() { | |||
| IArcherySetup newArcherySetup = new ArcherySetup(0, "", null, null, null, null, | |||
| null, null, null, null, null, null, null, | |||
| null, null, null, null, null); | |||
| IArcherySetup newArcherySetup = new ArcherySetup(0, "", null, null, null, null, null, | |||
| null, null, null, null, null, | |||
| null, null, null); | |||
| this.archerySetupConfigurationViewModel.setArcherySetup(newArcherySetup); | |||
| String strMandatory = getString(R.string.caption_mandatory); | |||
| this.binding.asArcherySetupSelectionTxt.setText(null, false); | |||
| this.binding.asLabelTxt.setError(strMandatory); | |||
| this.binding.asRiserSelectionTxt.setError(strMandatory); | |||
| this.binding.asSightSelectionTxt.setError(strMandatory); | |||
| this.binding.asArrowCWTxt.setError(strMandatory); | |||
| this.binding.asArrowWeightTxt.setError(strMandatory); | |||
| this.binding.asArrowV0Txt.setError(strMandatory); | |||
| this.binding.asArrowSelectionTxt.setError(strMandatory); | |||
| this.binding.asArrowNockHeightTxt.setError(strMandatory); | |||
| this.binding.asTargetCenterHeightTxt.setError(strMandatory); | |||
| this.binding.asBowPulloutTxt.setError(strMandatory); | |||
| @@ -208,10 +212,7 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| this.archerySetupConfigurationViewModel.setName(this.binding.asLabelTxt.getText().toString()); | |||
| this.archerySetupConfigurationViewModel.setSight(this.archerySetupConfigurationViewModel.findSightByName(this.binding.asSightSelectionTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setRiser(this.archerySetupConfigurationViewModel.findRiserByName(this.binding.asRiserSelectionTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowDiameter(PlatformUtils.parseDouble(this.binding.asArrowDiameterTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowCw(PlatformUtils.parseDouble(this.binding.asArrowCWTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowWeight(PlatformUtils.parseDouble(this.binding.asArrowWeightTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowV0(PlatformUtils.parseDouble(this.binding.asArrowV0Txt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrow(this.archerySetupConfigurationViewModel.findArrowByName(this.binding.asArrowSelectionTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowNockHeight(PlatformUtils.parseDouble(this.binding.asArrowNockHeightTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setBowPullout(PlatformUtils.parseDouble(this.binding.asBowPulloutTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setHNA(PlatformUtils.parseDouble(this.binding.asHNATxt.getText().toString())); | |||
| @@ -246,22 +247,13 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| if (this.binding.asLabelTxt.getText().toString().isEmpty() || this.binding.asLabelTxt.getText().toString().equals("*")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.asSightSelectionTxt.getText().toString().isEmpty() || this.binding.asSightSelectionTxt.getText().toString().equals("*")) { | |||
| if (this.binding.asSightSelectionTxt.getText() == null || this.binding.asSightSelectionTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.asRiserSelectionTxt.getText() == null || this.binding.asRiserSelectionTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.asArrowDiameterTxt.getText() == null || this.binding.asArrowDiameterTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.asArrowWeightTxt.getText() == null || this.binding.asArrowWeightTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.asArrowWeightTxt.getText() == null || this.binding.asArrowWeightTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.asArrowV0Txt.getText() == null || this.binding.asArrowV0Txt.getText().toString().equals("")) { | |||
| if (this.binding.asArrowSelectionTxt.getText() == null || this.binding.asArrowSelectionTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.asArrowNockHeightTxt.getText() == null || this.binding.asArrowNockHeightTxt.getText().toString().equals("")) { | |||
| @@ -9,6 +9,7 @@ import androidx.lifecycle.LiveData; | |||
| import androidx.lifecycle.MutableLiveData; | |||
| import androidx.lifecycle.ViewModel; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| @@ -16,15 +17,13 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| private List<ISight> allSights; | |||
| private List<IRiser> allRisers; | |||
| private List<IArrow> allArrows; | |||
| private final MutableLiveData<IArcherySetup> mArcherySetup; | |||
| private final MutableLiveData<String> mName; | |||
| private final MutableLiveData<ISight> mSight; | |||
| private final MutableLiveData<IRiser> mRiser; | |||
| private final MutableLiveData<Double> mArrowDiameter; | |||
| private final MutableLiveData<Double> mArrowCw; | |||
| private final MutableLiveData<Double> mArrowWeight; | |||
| private final MutableLiveData<Double> mArrowV0; | |||
| private final MutableLiveData<IArrow> mArrow; | |||
| private final MutableLiveData<Double> mTargetCenterHeight; | |||
| private final MutableLiveData<Double> mArrowNockHeight; | |||
| private final MutableLiveData<Double> mBowPullout; | |||
| @@ -42,10 +41,7 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| this.mName = new MutableLiveData<>(); | |||
| this.mSight = new MutableLiveData<>(); | |||
| this.mRiser = new MutableLiveData<>(); | |||
| this.mArrowDiameter = new MutableLiveData<>(); | |||
| this.mArrowCw = new MutableLiveData<>(); | |||
| this.mArrowWeight = new MutableLiveData<>(); | |||
| this.mArrowV0 = new MutableLiveData<>(); | |||
| this.mArrow = new MutableLiveData<>(); | |||
| this.mTargetCenterHeight = new MutableLiveData<>(); | |||
| this.mArrowNockHeight = new MutableLiveData<>(); | |||
| this.mBowPullout = new MutableLiveData<>(); | |||
| @@ -61,10 +57,7 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| this.mName.setValue(""); | |||
| this.mSight.setValue(null); | |||
| this.mRiser.setValue(null); | |||
| this.mArrowDiameter.setValue(null); | |||
| this.mArrowCw.setValue(null); | |||
| this.mArrowWeight.setValue(null); | |||
| this.mArrowV0.setValue(null); | |||
| this.mArrow.setValue(null); | |||
| this.mTargetCenterHeight.setValue(null); | |||
| this.mArrowNockHeight.setValue(null); | |||
| this.mBowPullout.setValue(null); | |||
| @@ -82,10 +75,7 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| this.mName.setValue(aArcherySetup != null ? aArcherySetup.getName() : ""); | |||
| this.mSight.setValue(aArcherySetup != null ? aArcherySetup.getSight() : null); | |||
| this.mRiser.setValue(aArcherySetup != null ? aArcherySetup.getRiser() : null); | |||
| this.mArrowDiameter.setValue(aArcherySetup != null ? aArcherySetup.getArrowDiameter() : null); | |||
| this.mArrowCw.setValue(aArcherySetup != null ? aArcherySetup.getArrowCw() : null); | |||
| this.mArrowWeight.setValue(aArcherySetup != null ? aArcherySetup.getArrowWeight() : null); | |||
| this.mArrowV0.setValue(aArcherySetup != null ? aArcherySetup.getArrowV0() : null); | |||
| this.mArrow.setValue(aArcherySetup != null ? aArcherySetup.getArrow() : null); | |||
| this.mTargetCenterHeight.setValue(aArcherySetup != null ? aArcherySetup.getTargetCenterHeight() : null); | |||
| this.mArrowNockHeight.setValue(aArcherySetup != null ? aArcherySetup.getArrowNockHeight() : null); | |||
| this.mBowPullout.setValue(aArcherySetup != null ? aArcherySetup.getBowPullout() : null); | |||
| @@ -119,32 +109,11 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| this.mRiser.setValue(aRiser); | |||
| } | |||
| public void setArrowDiameter(Double mArrowDiameter) { | |||
| public void setArrow(IArrow aArrow) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowDiameter(mArrowDiameter); | |||
| this.mArcherySetup.getValue().setArrow(aArrow); | |||
| } | |||
| this.mArrowDiameter.setValue(mArrowDiameter); | |||
| } | |||
| public void setArrowCw(Double mArrowCw) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowCw(mArrowCw); | |||
| } | |||
| this.mArrowCw.setValue(mArrowCw); | |||
| } | |||
| public void setArrowWeight(Double mArrowWeight) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowWeight(mArrowWeight); | |||
| } | |||
| this.mArrowWeight.setValue(mArrowWeight); | |||
| } | |||
| public void setArrowV0(Double mArrowV0) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowV0(mArrowV0); | |||
| } | |||
| this.mArrowV0.setValue(mArrowV0); | |||
| this.mArrow.setValue(aArrow); | |||
| } | |||
| public void setTargetCenterHeight(Double mTargetCenterHeight) { | |||
| @@ -233,20 +202,8 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| return mRiser; | |||
| } | |||
| public LiveData<Double> getArrowDiameter() { | |||
| return mArrowDiameter; | |||
| } | |||
| public LiveData<Double> getArrowCw() { | |||
| return mArrowCw; | |||
| } | |||
| public LiveData<Double> getArrowWeight() { | |||
| return mArrowWeight; | |||
| } | |||
| public LiveData<Double> getArrowV0() { | |||
| return mArrowV0; | |||
| public LiveData<IArrow> getArrow() { | |||
| return mArrow; | |||
| } | |||
| public LiveData<Double> getArrowNockHeight() { | |||
| @@ -273,6 +230,14 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| this.allRisers = allRisers; | |||
| } | |||
| public List<IArrow> getAllArrows() { | |||
| return allArrows; | |||
| } | |||
| public void setAllArrows(List<IArrow> allArrows) { | |||
| this.allArrows = allArrows; | |||
| } | |||
| public LiveData<Double> getBowPullout() { | |||
| return mBowPullout; | |||
| } | |||
| @@ -322,4 +287,13 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| } | |||
| return null; | |||
| } | |||
| public IArrow findArrowByName(String name) { | |||
| for (IArrow arrow : this.allArrows) { | |||
| if (arrow.toString().equals(name)) { | |||
| return arrow; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,216 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.ui.configuration; | |||
| import android.app.AlertDialog; | |||
| import android.content.DialogInterface; | |||
| import android.os.Bundle; | |||
| import android.view.Menu; | |||
| import android.view.MenuItem; | |||
| import android.widget.ArrayAdapter; | |||
| import android.widget.AutoCompleteTextView; | |||
| import android.widget.Button; | |||
| import java.text.DecimalFormat; | |||
| import java.util.List; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.appcompat.app.AppCompatActivity; | |||
| import androidx.lifecycle.ViewModelProvider; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.database.dao.ArrowDao; | |||
| import ch.spherIC.recurvebowsight.databinding.ActivityArrowConfigurationBinding; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| import ch.spherIC.recurvebowsight.model.impl.Arrow; | |||
| import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter; | |||
| import ch.spherIC.recurvebowsight.utilities.PlatformUtils; | |||
| public class ArrowConfigurationActivity extends AppCompatActivity { | |||
| private ActivityArrowConfigurationBinding binding; | |||
| private ArrowConfigurationViewModel arrowConfigurationViewModel; | |||
| @Override | |||
| protected void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.activity_arrow_configuration); | |||
| getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |||
| getSupportActionBar().setTitle(R.string.title_activity_arrow_configuration); | |||
| this.arrowConfigurationViewModel = new ViewModelProvider(this).get(ArrowConfigurationViewModel.class); | |||
| this.binding = ActivityArrowConfigurationBinding.bind(findViewById(R.id.activity_arrow_configuration)); | |||
| addObservers(); | |||
| addArrowSpinnerListener(); | |||
| addButtonListeners(); | |||
| loadArrows(); | |||
| } | |||
| @Override | |||
| public boolean onCreateOptionsMenu(Menu menu) { | |||
| // Inflate the menu; this adds items to the action bar if it is present. | |||
| getMenuInflater().inflate(R.menu.main, menu); | |||
| MenuItem menuItemSettings = menu.findItem(R.id.action_settings); | |||
| MenuItem menuItemHelp = menu.findItem(R.id.action_help); | |||
| menuItemSettings.setEnabled(false); | |||
| menuItemHelp.setEnabled(false); | |||
| return true; | |||
| } | |||
| @Override | |||
| public boolean onOptionsItemSelected(@NonNull MenuItem item) { | |||
| switch (item.getItemId()) { | |||
| case android.R.id.home: | |||
| this.finish(); | |||
| return true; | |||
| case R.id.action_help: | |||
| /* | |||
| Intent userGuideArrowIntent = new Intent(this.binding.getRoot().getContext(), UserGuideArrowActivity.class); | |||
| startActivity(userGuideArrowIntent); | |||
| */ | |||
| return true; | |||
| } | |||
| return super.onOptionsItemSelected(item); | |||
| } | |||
| private void addObservers() { | |||
| DecimalFormat dF = new DecimalFormat("#.#"); | |||
| this.arrowConfigurationViewModel.getManufacturer().observe(this, manufacturer -> this.binding.rcManufacturerTxt.setText(manufacturer)); | |||
| this.arrowConfigurationViewModel.getModel().observe(this, model -> this.binding.rcModelTxt.setText(model)); | |||
| this.arrowConfigurationViewModel.getDiameter().observe(this, diameter -> this.binding.acDiameterTxt.setText(diameter != null ? dF.format(diameter) : "")); | |||
| this.arrowConfigurationViewModel.getCw().observe(this, cw -> this.binding.acCwTxt.setText(cw != null ? dF.format(cw) : "")); | |||
| this.arrowConfigurationViewModel.getWeight().observe(this, weight -> this.binding.acWeigthTxt.setText(weight != null ? dF.format(weight) : "")); | |||
| this.arrowConfigurationViewModel.getV0().observe(this, v0 -> this.binding.acV0Txt.setText(v0 != null ? dF.format(v0) : "")); | |||
| this.arrowConfigurationViewModel.getColors().observe(this, colors -> this.binding.acColorsTxt.setText(colors)); | |||
| } | |||
| private void addArrowSpinnerListener() { | |||
| AutoCompleteTextView textView = findViewById(R.id.arrowSelectionTxt); | |||
| textView.setOnItemClickListener((parent, view, position, id) -> { | |||
| IArrow selectedArrow = (IArrow) textView.getAdapter().getItem(position); | |||
| if (selectedArrow != null) { | |||
| arrowConfigurationViewModel.setArrow(selectedArrow); | |||
| } | |||
| }); | |||
| } | |||
| private void addButtonListeners() { | |||
| Button newButton = findViewById(R.id.arrowcfg_button_new); | |||
| newButton.setOnClickListener(v -> addNewArrow()); | |||
| Button deleteButton = findViewById(R.id.arrowcfg_button_delete); | |||
| deleteButton.setOnClickListener(v -> deleteArrow()); | |||
| Button saveButton = findViewById(R.id.arrowcfg_button_save); | |||
| saveButton.setOnClickListener(v -> saveArrowConfiguration()); | |||
| } | |||
| private void loadArrows() { | |||
| List<IArrow> arrows = ArrowDao.getInstance().loadAll(); | |||
| ArrayAdapter<IArrow> adapter = new NoFilterArrayAdapter<IArrow>(this, android.R.layout.simple_dropdown_item_1line, arrows); | |||
| AutoCompleteTextView textView = this.binding.arrowSelectionTxt; | |||
| textView.setAdapter(adapter); | |||
| textView.invalidate(); | |||
| } | |||
| private void addNewArrow() { | |||
| IArrow newArrow = new Arrow(0, "", "", null, null, null, null, ""); | |||
| this.arrowConfigurationViewModel.setArrow(newArrow); | |||
| String strMandatory = getString(R.string.caption_mandatory); | |||
| this.binding.arrowSelectionTxt.setText(null, false); | |||
| this.binding.rcManufacturerTxt.setError(strMandatory); | |||
| this.binding.rcModelTxt.setError(strMandatory); | |||
| this.binding.acDiameterTxt.setError(strMandatory); | |||
| this.binding.acCwTxt.setError(strMandatory); | |||
| this.binding.acWeigthTxt.setError(strMandatory); | |||
| this.binding.acV0Txt.setError(strMandatory); | |||
| this.binding.acColorsTxt.setError(strMandatory); | |||
| AutoCompleteTextView textView = this.binding.arrowSelectionTxt; | |||
| ((ArrayAdapter<IArrow>) textView.getAdapter()).insert(newArrow, 0); | |||
| textView.setAdapter((ArrayAdapter<IArrow>) textView.getAdapter()); | |||
| textView.setSelection(0); | |||
| } | |||
| private void saveArrowConfiguration() { | |||
| if (!validateInputs()) { | |||
| return; | |||
| } | |||
| this.arrowConfigurationViewModel.setManufacturerText(this.binding.rcManufacturerTxt.getText().toString()); | |||
| this.arrowConfigurationViewModel.setModelText(this.binding.rcModelTxt.getText().toString()); | |||
| this.arrowConfigurationViewModel.setDiameter(PlatformUtils.parseDouble(this.binding.acDiameterTxt.getText().toString())); | |||
| this.arrowConfigurationViewModel.setCW(PlatformUtils.parseDouble(this.binding.acCwTxt.getText().toString())); | |||
| this.arrowConfigurationViewModel.setWeight(PlatformUtils.parseDouble(this.binding.acWeigthTxt.getText().toString())); | |||
| this.arrowConfigurationViewModel.setV0(PlatformUtils.parseDouble(this.binding.acV0Txt.getText().toString())); | |||
| this.arrowConfigurationViewModel.setColors(this.binding.acColorsTxt.getText().toString()); | |||
| IArrow lArrow = this.arrowConfigurationViewModel.getArrow().getValue(); | |||
| if (lArrow.getId() > 0) { | |||
| ArrowDao.getInstance().update(lArrow); | |||
| PlatformUtils.toast(ArrowConfigurationActivity.this, String.format(getString(R.string.caption_Cfg_UpdateSuccessful), lArrow)).show(); | |||
| } else { | |||
| lArrow = ArrowDao.getInstance().insert(lArrow); | |||
| loadArrows(); | |||
| AutoCompleteTextView textView = this.binding.arrowSelectionTxt; | |||
| final int position = ((ArrayAdapter<IArrow>) textView.getAdapter()).getPosition(lArrow); | |||
| textView.setListSelection(position); | |||
| textView.setText(lArrow.toString(), false); | |||
| ((ArrayAdapter<IArrow>) textView.getAdapter()).getFilter().filter(null); | |||
| PlatformUtils.toast(ArrowConfigurationActivity.this, String.format(getString(R.string.caption_Cfg_SaveSuccessful), lArrow)).show(); | |||
| } | |||
| } | |||
| private boolean validateInputs() { | |||
| int invalidFields = 0; | |||
| if (this.binding.rcManufacturerTxt.getText().toString().isEmpty() || this.binding.rcManufacturerTxt.getText().toString().equals("*")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.rcModelTxt.getText().toString().isEmpty() || this.binding.rcModelTxt.getText().toString().equals("*")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.acDiameterTxt.getText() == null || this.binding.acDiameterTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.acCwTxt.getText() == null || this.binding.acCwTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.acWeigthTxt.getText() == null || this.binding.acWeigthTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.acV0Txt.getText() == null || this.binding.acV0Txt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (this.binding.acColorsTxt.getText() == null || this.binding.acColorsTxt.getText().toString().equals("")) { | |||
| invalidFields++; | |||
| } | |||
| if (invalidFields > 0) { | |||
| PlatformUtils.toast(this, getResources().getString(R.string.caption_Cfg_FillAllMandatoryFields)).show(); | |||
| return false; | |||
| } | |||
| return true; | |||
| } | |||
| private void deleteArrow() { | |||
| IArrow lArrow = this.arrowConfigurationViewModel.getArrow().getValue(); | |||
| if (lArrow != null) { | |||
| AlertDialog dlg = PlatformUtils.getDeleteConfirmDialog(this, lArrow.toString(), new DialogInterface.OnClickListener() { | |||
| @Override | |||
| public void onClick(final DialogInterface dialog, final int which) { | |||
| String message = String.format(getString(R.string.caption_Cfg_DeleteSuccessful), lArrow); | |||
| try { | |||
| ArrowDao.getInstance().delete(lArrow); | |||
| loadArrows(); | |||
| arrowConfigurationViewModel.setArrow(null); | |||
| binding.arrowSelectionTxt.setText(null, false); | |||
| } catch (Exception e) { | |||
| message = getString(R.string.caption_Cfg_DeleteNotPossible); | |||
| } | |||
| PlatformUtils.toast(ArrowConfigurationActivity.this, message).show(); | |||
| } | |||
| }); | |||
| dlg.show(); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,135 @@ | |||
| /* | |||
| * Copyright (C) 2022 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.ui.configuration; | |||
| import androidx.lifecycle.LiveData; | |||
| import androidx.lifecycle.MutableLiveData; | |||
| import androidx.lifecycle.ViewModel; | |||
| import ch.spherIC.recurvebowsight.model.IArrow; | |||
| public class ArrowConfigurationViewModel extends ViewModel { | |||
| private final MutableLiveData<IArrow> mArrow; | |||
| private final MutableLiveData<String> mManufacturer; | |||
| private final MutableLiveData<String> mModel; | |||
| private final MutableLiveData<Double> mDiameter; | |||
| private final MutableLiveData<Double> mCW; | |||
| private final MutableLiveData<Double> mWeight; | |||
| private final MutableLiveData<Double> mV0; | |||
| private final MutableLiveData<String> mColors; | |||
| public ArrowConfigurationViewModel() { | |||
| this.mArrow = new MutableLiveData<>(); | |||
| this.mManufacturer = new MutableLiveData<>(); | |||
| this.mModel = new MutableLiveData<>(); | |||
| this.mDiameter = new MutableLiveData<>(); | |||
| this.mCW = new MutableLiveData<>(); | |||
| this.mWeight = new MutableLiveData<>(); | |||
| this.mV0 = new MutableLiveData<>(); | |||
| this.mColors = new MutableLiveData<>(); | |||
| this.mArrow.setValue(null); | |||
| this.mManufacturer.setValue(""); | |||
| this.mModel.setValue(""); | |||
| this.mDiameter.setValue(null); | |||
| this.mCW.setValue(null); | |||
| this.mWeight.setValue(null); | |||
| this.mV0.setValue(null); | |||
| this.mColors.setValue(""); | |||
| } | |||
| public void setArrow(IArrow aArrow) { | |||
| this.mArrow.setValue(aArrow); | |||
| this.mManufacturer.setValue(aArrow != null ? aArrow.getManufacturer() : ""); | |||
| this.mModel.setValue(aArrow != null ? aArrow.getModel() : ""); | |||
| this.mDiameter.setValue(aArrow != null ? aArrow.getDiameter() : null); | |||
| this.mCW.setValue(aArrow != null ? aArrow.getCw() : null); | |||
| this.mWeight.setValue(aArrow != null ? aArrow.getWeight() : null); | |||
| this.mV0.setValue(aArrow != null ? aArrow.getV0() : null); | |||
| this.mColors.setValue(aArrow != null ? aArrow.getColors() : null); | |||
| } | |||
| public void setManufacturerText(String manufacturerText) { | |||
| if (this.mArrow.getValue() != null) { | |||
| this.mArrow.getValue().setManufacturer(manufacturerText); | |||
| } | |||
| this.mManufacturer.setValue(manufacturerText); | |||
| } | |||
| public void setModelText(String modelText) { | |||
| if (this.mArrow.getValue() != null) { | |||
| this.mArrow.getValue().setModel(modelText); | |||
| } | |||
| this.mModel.setValue(modelText); | |||
| } | |||
| public void setDiameter(Double aDiameter) { | |||
| if (this.mArrow.getValue() != null) { | |||
| this.mArrow.getValue().setDiameter(aDiameter); | |||
| } | |||
| this.mDiameter.setValue(aDiameter); | |||
| } | |||
| public void setCW(Double aCW) { | |||
| if (this.mArrow.getValue() != null) { | |||
| this.mArrow.getValue().setCw(aCW); | |||
| } | |||
| this.mCW.setValue(aCW); | |||
| } | |||
| public void setWeight(Double aWeight) { | |||
| if (this.mArrow.getValue() != null) { | |||
| this.mArrow.getValue().setWeight(aWeight); | |||
| } | |||
| this.mWeight.setValue(aWeight); | |||
| } | |||
| public void setV0(Double aV0) { | |||
| if (this.mArrow.getValue() != null) { | |||
| this.mArrow.getValue().setV0(aV0); | |||
| } | |||
| this.mV0.setValue(aV0); | |||
| } | |||
| public void setColors(String aColors) { | |||
| if (this.mArrow.getValue() != null) { | |||
| this.mArrow.getValue().setColors(aColors); | |||
| } | |||
| this.mColors.setValue(aColors); | |||
| } | |||
| public LiveData<IArrow> getArrow() { | |||
| return mArrow; | |||
| } | |||
| public LiveData<String> getManufacturer() { | |||
| return this.mManufacturer; | |||
| } | |||
| public LiveData<String> getModel() { | |||
| return mModel; | |||
| } | |||
| public LiveData<Double> getDiameter() { | |||
| return mDiameter; | |||
| } | |||
| public LiveData<Double> getCw() { | |||
| return mCW; | |||
| } | |||
| public LiveData<Double> getWeight() { | |||
| return mWeight; | |||
| } | |||
| public LiveData<Double> getV0() { | |||
| return mV0; | |||
| } | |||
| public LiveData<String> getColors() { | |||
| return mColors; | |||
| } | |||
| } | |||
| @@ -23,7 +23,7 @@ import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.database.dao.RiserDao; | |||
| import ch.spherIC.recurvebowsight.databinding.ActivityRiserConfigurationBinding; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.Riser; | |||
| import ch.spherIC.recurvebowsight.model.impl.Riser; | |||
| import ch.spherIC.recurvebowsight.ui.userguide.UserGuideRiserActivity; | |||
| import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter; | |||
| import ch.spherIC.recurvebowsight.utilities.PlatformUtils; | |||
| @@ -23,7 +23,7 @@ import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.database.dao.SightDao; | |||
| import ch.spherIC.recurvebowsight.databinding.ActivitySightConfigurationBinding; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| import ch.spherIC.recurvebowsight.model.Sight; | |||
| import ch.spherIC.recurvebowsight.model.impl.Sight; | |||
| import ch.spherIC.recurvebowsight.ui.userguide.UserGuideSightActivity; | |||
| import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter; | |||
| import ch.spherIC.recurvebowsight.utilities.PlatformUtils; | |||
| @@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.databinding.FragmentEquipmentAddListBinding; | |||
| import ch.spherIC.recurvebowsight.ui.configuration.ArcherySetupConfigurationActivity; | |||
| import ch.spherIC.recurvebowsight.ui.configuration.ArrowConfigurationActivity; | |||
| import ch.spherIC.recurvebowsight.ui.configuration.RiserConfigurationActivity; | |||
| import ch.spherIC.recurvebowsight.ui.configuration.SightConfigurationActivity; | |||
| @@ -29,6 +30,7 @@ public class AddEquipmentFragment extends Fragment { | |||
| attachTouchListener(root, R.id.card_view_riser_border, R.id.card_view_riser_setup); | |||
| attachTouchListener(root, R.id.card_view_sight_border, R.id.card_view_sight_setup); | |||
| attachTouchListener(root, R.id.card_view_arrow_border, R.id.card_view_arrow_setup); | |||
| attachTouchListener(root, R.id.card_view_equipment_border, R.id.card_view_equipment_setup); | |||
| return root; | |||
| @@ -69,6 +71,9 @@ public class AddEquipmentFragment extends Fragment { | |||
| } else if (v.getId() == R.id.card_view_sight_border) { | |||
| Intent sightConfigurationIntent = new Intent(v.getContext(), SightConfigurationActivity.class); | |||
| startActivity(sightConfigurationIntent); | |||
| } else if (v.getId() == R.id.card_view_arrow_border) { | |||
| Intent arrowConfigurationIntent = new Intent(v.getContext(), ArrowConfigurationActivity.class); | |||
| startActivity(arrowConfigurationIntent); | |||
| } else if (v.getId() == R.id.card_view_equipment_border) { | |||
| Intent equipmentConfigurationIntent = new Intent(v.getContext(), ArcherySetupConfigurationActivity.class); | |||
| startActivity(equipmentConfigurationIntent); | |||
| @@ -18,8 +18,8 @@ import androidx.recyclerview.widget.LinearLayoutManager; | |||
| import androidx.recyclerview.widget.RecyclerView; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.database.dao.ArcherySetupDao; | |||
| import ch.spherIC.recurvebowsight.model.ArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.impl.ArcherySetup; | |||
| /** | |||
| * A fragment representing a list of Items. | |||
| @@ -77,7 +77,7 @@ public class ChooseEquipmentFragment extends Fragment { | |||
| private List<IArcherySetup> getAllArcherySetups() { | |||
| 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, null, null)); | |||
| setups.add(new ArcherySetup(-999, "", null, null, null, null, null, null, null, null, null, null, null, null, null)); | |||
| setups.addAll(ArcherySetupDao.getInstance().loadAll()); | |||
| return setups; | |||
| @@ -0,0 +1,26 @@ | |||
| <vector android:autoMirrored="true" | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:width="24dp" | |||
| android:height="24dp" | |||
| android:viewportHeight="24" | |||
| android:viewportWidth="24" | |||
| android:tint="#000000"> | |||
| <path | |||
| android:fillColor="@android:color/white" | |||
| android:pathData="M18,11H2v2h16.01v2L22,12l-4,-3z" /> | |||
| <path | |||
| android:pathData="M3,9l3,0l0.948,1.5l-3,0z" | |||
| android:strokeLineJoin="round" | |||
| android:strokeWidth="0.38228208" | |||
| android:fillColor="#000000" | |||
| android:strokeColor="#00000000" | |||
| android:strokeLineCap="butt"/> | |||
| <path | |||
| android:pathData="M3,15l3,0l0.948,-1.5l-3,-0z" | |||
| android:strokeLineJoin="round" | |||
| android:strokeWidth="0.38228208" | |||
| android:fillColor="#000000" | |||
| android:strokeColor="#00000000" | |||
| android:strokeLineCap="butt"/> | |||
| </vector> | |||
| @@ -0,0 +1,250 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| xmlns:app="http://schemas.android.com/apk/res-auto" | |||
| xmlns:tools="http://schemas.android.com/tools" | |||
| android:id="@+id/activity_arrow_configuration" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| tools:context=".ui.configuration.ArrowConfigurationActivity"> | |||
| <ScrollView | |||
| android:layout_width="0dp" | |||
| android:layout_height="0dp" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent"> | |||
| <androidx.constraintlayout.widget.ConstraintLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content"> | |||
| <TextView | |||
| android:id="@+id/configArrowLbl" | |||
| style="@style/Widget.AppCompat.TextView" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="16dp" | |||
| android:background="@color/fita_blue_dark" | |||
| android:padding="4dp" | |||
| android:text="@string/acTitleArrowConfig" | |||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | |||
| android:textColor="@color/white" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintHorizontal_bias="1.0" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu" | |||
| android:id="@+id/arrowSelectionLayout" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/configArrowLbl"> | |||
| <AutoCompleteTextView | |||
| android:id="@+id/arrowSelectionTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:editable="false" | |||
| android:hint="@string/acArrowLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/rcManufacturerLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/arrowSelectionLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/rcManufacturerTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/rcManufacturerLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/rcModelLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/rcManufacturerLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/rcModelTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/rcModelLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/acDiameterLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/rcModelLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/acDiameterTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowDiameterLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/acCwLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/acDiameterLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/acCwTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowCwLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/acWeigthLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/acCwLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/acWeigthTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowWeightLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/acV0Layout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/acWeigthLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/acV0Txt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowV0Lbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/acColorsLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/acV0Layout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/acColorsTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowColorLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <LinearLayout | |||
| android:layout_width="fill_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="24dp" | |||
| android:orientation="horizontal" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/acColorsLayout"> | |||
| <Button | |||
| android:id="@+id/arrowcfg_button_delete" | |||
| android:layout_width="fill_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:paddingLeft="4dp" | |||
| android:paddingRight="4dp" | |||
| android:text="@string/caption_Delete" | |||
| android:textSize="12sp" | |||
| app:icon="@drawable/ic_icon_delete" | |||
| app:iconPadding="-8dp" /> | |||
| <Button | |||
| android:id="@+id/arrowcfg_button_new" | |||
| android:layout_width="fill_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginHorizontal="8dp" | |||
| android:layout_weight="1" | |||
| android:text="@string/caption_New" | |||
| android:textSize="12sp" | |||
| app:icon="@drawable/ic_icon_add" | |||
| app:iconPadding="-8dp" /> | |||
| <Button | |||
| android:id="@+id/arrowcfg_button_save" | |||
| android:layout_width="fill_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:paddingHorizontal="4dp" | |||
| android:text="@string/caption_Save" | |||
| android:textSize="12sp" | |||
| app:icon="@drawable/ic_icon_save" | |||
| app:iconPadding="-8dp" /> | |||
| </LinearLayout> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| </ScrollView> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| @@ -123,8 +123,8 @@ | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/asArrowDiameterLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu" | |||
| android:id="@+id/asArrowSelectionLayout" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| @@ -134,71 +134,12 @@ | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/asSightSelectionLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/asArrowDiameterTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowDiameterLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/asArrowCWLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/asArrowDiameterLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/asArrowCWTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowCwLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/asArrowWeightLayout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/asArrowCWLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/asArrowWeightTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowWeightLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| <com.google.android.material.textfield.TextInputLayout | |||
| android:id="@+id/asArrowV0Layout" | |||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/asArrowWeightLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/asArrowV0Txt" | |||
| <AutoCompleteTextView | |||
| android:id="@+id/asArrowSelectionTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:hint="@string/arrowV0Lbl" | |||
| android:editable="false" | |||
| android:hint="@string/acArrowLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| @@ -212,7 +153,7 @@ | |||
| android:layout_marginTop="8dp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toBottomOf="@+id/asArrowV0Layout"> | |||
| app:layout_constraintTop_toBottomOf="@+id/asArrowSelectionLayout"> | |||
| <com.google.android.material.textfield.TextInputEditText | |||
| android:id="@+id/asBowPulloutTxt" | |||
| @@ -213,11 +213,113 @@ | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| <androidx.constraintlayout.widget.ConstraintLayout | |||
| android:id="@+id/constraintLayout3" | |||
| android:id="@+id/constraintLayout4" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="126dp" | |||
| app:layout_constraintTop_toBottomOf="@+id/constraintLayout2"> | |||
| <androidx.cardview.widget.CardView | |||
| android:id="@+id/card_view_arrow_border" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:layout_marginBottom="8dp" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| android:backgroundTint="@color/black" | |||
| app:cardCornerRadius="8dp" | |||
| app:cardElevation="10dp" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent"> | |||
| <androidx.constraintlayout.widget.ConstraintLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent"> | |||
| <androidx.cardview.widget.CardView | |||
| android:id="@+id/card_view_arrow_setup" | |||
| android:layout_width="fill_parent" | |||
| android:layout_height="fill_parent" | |||
| android:layout_marginBottom="2dp" | |||
| android:layout_marginEnd="2dp" | |||
| android:layout_marginStart="2dp" | |||
| android:layout_marginTop="2dp" | |||
| app:cardCornerRadius="6dp" | |||
| app:cardElevation="0dp" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent"> | |||
| <androidx.constraintlayout.widget.ConstraintLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent"> | |||
| <TextView | |||
| android:id="@+id/new_arrow" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="@dimen/text_margin" | |||
| android:layout_marginStart="16dp" | |||
| android:layout_marginTop="20dp" | |||
| android:text="@string/caption_MainCfg_Arrow_MainText" | |||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | |||
| app:layout_constraintStart_toEndOf="@+id/arrow_image_view" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| <TextView | |||
| android:id="@+id/new_arrow_desc" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="16dp" | |||
| android:layout_marginStart="16dp" | |||
| android:text="@string/caption_MainCfg_Arrow_SubText" | |||
| android:textAppearance="@style/TextAppearance.AppCompat.Medium" | |||
| android:textSize="12sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/arrow_image_view" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toEndOf="@+id/arrow_image_view" /> | |||
| <androidx.cardview.widget.CardView | |||
| android:id="@+id/arrow_image_view" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginBottom="20dp" | |||
| android:layout_marginStart="20dp" | |||
| android:layout_marginTop="20dp" | |||
| android:contentDescription="@string/menu_equipment" | |||
| app:cardCornerRadius="8dp" | |||
| app:cardElevation="0dp" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent"> | |||
| <ImageView | |||
| android:id="@+id/arrow_image" | |||
| android:layout_width="64dp" | |||
| android:layout_height="64dp" | |||
| android:contentDescription="@string/menu_equipment" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" | |||
| app:srcCompat="@drawable/ic_arrow" /> | |||
| </androidx.cardview.widget.CardView> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| </androidx.cardview.widget.CardView> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| </androidx.cardview.widget.CardView> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| <androidx.constraintlayout.widget.ConstraintLayout | |||
| android:id="@+id/constraintLayout3" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="126dp" | |||
| app:layout_constraintTop_toBottomOf="@+id/constraintLayout4"> | |||
| <androidx.cardview.widget.CardView | |||
| android:id="@+id/card_view_equipment_border" | |||
| android:layout_width="match_parent" | |||
| @@ -11,6 +11,7 @@ | |||
| <string name="title_activity_riser_configuration">RBS Konfiguration Griffstück</string> | |||
| <string name="title_activity_sight_configuration">RBS Konfiguration Visier</string> | |||
| <string name="title_activity_archery_setup_configuration">RBS Konfiguration Ausrüstung</string> | |||
| <string name="title_activity_arrow_configuration">RBS Konfiguration Pfeil</string> | |||
| <string name="menu_equipment">Ausrüstung</string> | |||
| <string name="menu_about">Über RBS...</string> | |||
| @@ -52,13 +53,14 @@ | |||
| <string name="caption_MainCfg_Riser_SubText">Hier klicken um ein Griffstück zu Editieren, zu Löschen oder Einzufügen</string> | |||
| <string name="caption_MainCfg_Sight_MainText">Visier</string> | |||
| <string name="caption_MainCfg_Sight_SubText">Hier klicken um ein Visier zu Editieren, zu Löschen oder Einzufügen</string> | |||
| <string name="caption_MainCfg_Arrow_MainText">Pfeil</string> | |||
| <string name="caption_MainCfg_Arrow_SubText">Hier klicken um einen Pfeil zu Editieren, zu Löschen oder Einzufügen</string> | |||
| <string name="caption_MainCfg_ArcerySetup_MainText">Ausrüstung</string> | |||
| <string name="caption_MainCfg_ArcerySetup_SubText">Hier klicken um eine Ausrüstung zu Editieren, zu Löschen oder Einzufügen</string> | |||
| <string name="caption_Userguide_New">Erstellt eine neue, leere Konfiguration</string> | |||
| <string name="caption_Userguide_Save">Speichert eine neue oder geänderte Konfiguration</string> | |||
| <string name="caption_Userguide_Delete">Löscht eine Konfiguration nach Bestätigung</string> | |||
| <string name="rcTitleRiserConfig">Konfiguration Griffstück</string> | |||
| <string name="rcRiserLbl">Griffstück</string> | |||
| <string name="rcManufacturerLbl">Hersteller</string> | |||
| @@ -91,6 +93,9 @@ | |||
| <string name="ashNA">hNA [mm]</string> | |||
| <string name="asNockRaising">Nockpunktüberhöhung [mm]</string> | |||
| <string name="asBraceHeight">Standhöhe [mm]</string> | |||
| <string name="acTitleArrowConfig">Konfiguration Pfeil</string> | |||
| <string name="acArrowLbl">Pfeil</string> | |||
| <string name="arrowColorLbl">Farben Federn</string> | |||
| <string name="caption_Ok">OK</string> | |||
| <string name="caption_Cancel">Abbrechen</string> | |||
| @@ -143,4 +148,5 @@ | |||
| <string name="ug_UserguideASParams_Add6">Wert auf der vertikalen Skala bei welchem die Mittelachse des Visierschlittens befestigt ist (siehe auch Benutzeranleitung Visier)</string> | |||
| <string name="ug_UserguideASParams_Add7">Standardwert der horizontalen Stellung des Visierschlittens</string> | |||
| </resources> | |||
| @@ -10,6 +10,7 @@ | |||
| <string name="title_activity_riser_configuration">RBS Riser Configuration</string> | |||
| <string name="title_activity_sight_configuration">RBS Sight Configuration</string> | |||
| <string name="title_activity_archery_setup_configuration">RBS Archery Setup Configuration</string> | |||
| <string name="title_activity_arrow_configuration">RBS Arrow Configuration</string> | |||
| <string name="menu_equipment">Equipment</string> | |||
| <string name="menu_about">About RBS…</string> | |||
| @@ -52,6 +53,8 @@ | |||
| <string name="caption_MainCfg_Riser_SubText">Tab to edit, delete or insert a riser</string> | |||
| <string name="caption_MainCfg_Sight_MainText">Sight</string> | |||
| <string name="caption_MainCfg_Sight_SubText">Tab to edit, delete or insert a sight</string> | |||
| <string name="caption_MainCfg_Arrow_MainText">Arrow</string> | |||
| <string name="caption_MainCfg_Arrow_SubText">Tab to edit, delete or insert an arrow</string> | |||
| <string name="caption_MainCfg_ArcerySetup_MainText">Equipment</string> | |||
| <string name="caption_MainCfg_ArcerySetup_SubText">Tab to edit, delete or insert a equipment setup</string> | |||
| <string name="caption_Userguide_New">Creates a empty, new configuration</string> | |||
| @@ -90,6 +93,9 @@ | |||
| <string name="ashNA">hNA [mm]</string> | |||
| <string name="asNockRaising">Nock Raising [mm]</string> | |||
| <string name="asBraceHeight">Brace Height [mm]</string> | |||
| <string name="acTitleArrowConfig">Arrow Configuration</string> | |||
| <string name="acArrowLbl">Arrow</string> | |||
| <string name="arrowColorLbl">Vane Colors</string> | |||
| <string name="caption_Ok">OK</string> | |||
| <string name="caption_Cancel">Cancel</string> | |||