Selaa lähdekoodia

transfer values on equipment choosing and calculation routines

master
Flo Smilari 3 vuotta sitten
vanhempi
commit
d159a5dad8
39 muutettua tiedostoa jossa 2145 lisäystä ja 163 poistoa
  1. BIN
      .gradle/7.3.3/checksums/checksums.lock
  2. BIN
      .gradle/7.3.3/checksums/md5-checksums.bin
  3. BIN
      .gradle/7.3.3/checksums/sha1-checksums.bin
  4. BIN
      .gradle/7.3.3/executionHistory/executionHistory.bin
  5. BIN
      .gradle/7.3.3/executionHistory/executionHistory.lock
  6. BIN
      .gradle/7.3.3/fileHashes/fileHashes.bin
  7. BIN
      .gradle/7.3.3/fileHashes/fileHashes.lock
  8. BIN
      .gradle/7.3.3/fileHashes/resourceHashesCache.bin
  9. BIN
      .gradle/buildOutputCleanup/buildOutputCleanup.lock
  10. BIN
      .gradle/buildOutputCleanup/outputFiles.bin
  11. 2
    3
      .idea/assetWizardSettings.xml
  12. 1
    0
      .idea/encodings.xml
  13. 13
    0
      .idea/libraries/Gradle__androidx_databinding_databinding_adapters_7_2_2_aar.xml
  14. 11
    0
      .idea/libraries/Gradle__androidx_databinding_databinding_common_7_2_2.xml
  15. 13
    0
      .idea/libraries/Gradle__androidx_databinding_databinding_runtime_7_2_2_aar.xml
  16. 12
    3
      .idea/misc.xml
  17. 4
    1
      .idea/modules/app/RecurveBowSight.app.androidTest.iml
  18. 7
    1
      .idea/modules/app/RecurveBowSight.app.main.iml
  19. 4
    1
      .idea/modules/app/RecurveBowSight.app.unitTest.iml
  20. 55
    28
      .idea/workspace.xml
  21. 4
    0
      app/build.gradle
  22. 1
    15
      app/src/main/java/ch/spherIC/recurvebowsight/RBSMainActivity.java
  23. 114
    0
      app/src/main/java/ch/spherIC/recurvebowsight/logic/CalculationTask.java
  24. 251
    0
      app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculator.java
  25. 1
    8
      app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightFragment.java
  26. 172
    4
      app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java
  27. 242
    0
      app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersViewModel.java
  28. 0
    38
      app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightViewModel.java
  29. 1144
    0
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  30. 10
    0
      app/src/main/res/drawable/ic_icon_calculate.xml
  31. 15
    13
      app/src/main/res/layout/activity_equipment_configuration.xml
  32. 15
    13
      app/src/main/res/layout/activity_riser_configuration.xml
  33. 15
    13
      app/src/main/res/layout/activity_sight_configuration.xml
  34. 0
    9
      app/src/main/res/layout/app_bar_main.xml
  35. 17
    1
      app/src/main/res/layout/fragment_calcsight_parameters.xml
  36. 3
    3
      app/src/main/res/layout/fragment_equipment_add_list.xml
  37. 16
    8
      app/src/main/res/layout/fragment_equipment_choose.xml
  38. 1
    0
      app/src/main/res/values-de/strings.xml
  39. 2
    1
      app/src/main/res/values/strings.xml

BIN
.gradle/7.3.3/checksums/checksums.lock Näytä tiedosto


BIN
.gradle/7.3.3/checksums/md5-checksums.bin Näytä tiedosto


BIN
.gradle/7.3.3/checksums/sha1-checksums.bin Näytä tiedosto


BIN
.gradle/7.3.3/executionHistory/executionHistory.bin Näytä tiedosto


BIN
.gradle/7.3.3/executionHistory/executionHistory.lock Näytä tiedosto


BIN
.gradle/7.3.3/fileHashes/fileHashes.bin Näytä tiedosto


BIN
.gradle/7.3.3/fileHashes/fileHashes.lock Näytä tiedosto


BIN
.gradle/7.3.3/fileHashes/resourceHashesCache.bin Näytä tiedosto


BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock Näytä tiedosto


BIN
.gradle/buildOutputCleanup/outputFiles.bin Näytä tiedosto


+ 2
- 3
.idea/assetWizardSettings.xml Näytä tiedosto

@@ -320,7 +320,7 @@
<PersistentState>
<option name="values">
<map>
<entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialiconsoutlined/save/outline_save_24.xml" />
<entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialiconsoutlined/calculate/outline_calculate_24.xml" />
</map>
</option>
</PersistentState>
@@ -330,8 +330,7 @@
</option>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="ic_launcher_round" />
<entry key="outputName" value="ic_icon_calculate" />
<entry key="sourceFile" value="Z:\Work\Java Projects\Android\RecurveBowSight\FITA_Target_logo_round.svg" />
</map>
</option>

+ 1
- 0
.idea/encodings.xml Näytä tiedosto

@@ -2,6 +2,7 @@
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/CalculationTask.java" charset="windows-1252" />
<file url="file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/IEntity.java" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>

+ 13
- 0
.idea/libraries/Gradle__androidx_databinding_databinding_adapters_7_2_2_aar.xml Näytä tiedosto

@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Gradle: androidx.databinding:databinding-adapters:7.2.2@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-3/440c60908ac6843fc057231c9516db25/transformed/databinding-adapters-7.2.2/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-3/440c60908ac6843fc057231c9516db25/transformed/databinding-adapters-7.2.2/res" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-3/440c60908ac6843fc057231c9516db25/transformed/databinding-adapters-7.2.2/AndroidManifest.xml" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.databinding/databinding-adapters/7.2.2/2870253f57a0f68f886f6b8c04032fbbc20e1bb1/databinding-adapters-7.2.2-sources.jar!/" />
</SOURCES>
</library>
</component>

+ 11
- 0
.idea/libraries/Gradle__androidx_databinding_databinding_common_7_2_2.xml Näytä tiedosto

@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="Gradle: androidx.databinding:databinding-common:7.2.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.databinding/databinding-common/7.2.2/cb53bd625b7a99cf218f46634d07d1886441288/databinding-common-7.2.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.databinding/databinding-common/7.2.2/11a1cbee1a967c4db030fd5fbf71656ca4dd86c3/databinding-common-7.2.2-sources.jar!/" />
</SOURCES>
</library>
</component>

+ 13
- 0
.idea/libraries/Gradle__androidx_databinding_databinding_runtime_7_2_2_aar.xml Näytä tiedosto

@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Gradle: androidx.databinding:databinding-runtime:7.2.2@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-3/a45f1c66c0764bc7954530610bda7bb4/transformed/databinding-runtime-7.2.2/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-3/a45f1c66c0764bc7954530610bda7bb4/transformed/databinding-runtime-7.2.2/res" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-3/a45f1c66c0764bc7954530610bda7bb4/transformed/databinding-runtime-7.2.2/AndroidManifest.xml" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/androidx.databinding/databinding-runtime/7.2.2/eb4f228c4a638cd4dd87a3b502fe55afe405ee/databinding-runtime-7.2.2-sources.jar!/" />
</SOURCES>
</library>
</component>

+ 12
- 3
.idea/misc.xml Näytä tiedosto

@@ -9,6 +9,8 @@
<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" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_icon_calculate.xml" value="0.25" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_icon_delete.xml" value="0.25" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_launcher.xml" value="0.25" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_launcher_background.xml" value="0.285" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_launcher_foreground.xml" value="0.25" />
@@ -32,11 +34,11 @@
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_main.xml" value="0.28072916666666664" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_riser_configuration.xml" value="0.25" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_sight_configuration.xml" value="0.1994535519125683" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/app_bar_main.xml" value="0.1480978260869565" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/content_main.xml" value="0.3625" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/app_bar_main.xml" value="0.15" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/content_main.xml" value="0.14" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_about.xml" value="0.15812841530054644" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight.xml" value="0.15812841530054644" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight_parameters.xml" value="0.175" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight_parameters.xml" value="0.16" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight_sightsetting.xml" value="0.1840846994535519" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight_trajectory.xml" value="0.1840846994535519" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment.xml" value="0.12361111111111112" />
@@ -63,4 +65,11 @@
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="VisualizationToolProject">
<option name="state">
<ProjectState>
<option name="scale" value="0.175" />
</ProjectState>
</option>
</component>
</project>

+ 4
- 1
.idea/modules/app/RecurveBowSight.app.androidTest.iml Näytä tiedosto

@@ -42,6 +42,7 @@
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.databinding:databinding-common:7.2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.arch.core:core-common:2.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.collection:collection:1.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.6.21" level="project" />
@@ -60,11 +61,13 @@
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.services:storage:1.4.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-idling-resource:3.4.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.databinding:viewbinding:7.2.2@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.databinding:databinding-runtime:7.2.2@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.5.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.databinding:databinding-adapters:7.2.2@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.appcompat:appcompat:1.5.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.activity:activity:1.5.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.core:core:1.8.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.annotation:annotation-experimental:1.1.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.5.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.5.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1@aar" level="project" />

+ 7
- 1
.idea/modules/app/RecurveBowSight.app.main.iml Näytä tiedosto

@@ -24,6 +24,9 @@
<content url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debug/out">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../../app/build/generated/data_binding_trigger/debug">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/data_binding_trigger/debug" isTestSource="false" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../../app/build/generated/renderscript_source_output_dir/debug/out" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" type="java-resource" />
@@ -40,6 +43,7 @@
<orderEntry type="jdk" jdkName="Android API 32 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.3.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.databinding:databinding-common:7.2.2" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.1.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.5.1" level="project" />
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.1.0" level="project" />
@@ -52,11 +56,13 @@
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.collection:collection-ktx:1.1.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.databinding:viewbinding:7.2.2@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.databinding:databinding-runtime:7.2.2@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.5.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.databinding:databinding-adapters:7.2.2@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.5.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.activity:activity:1.5.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.core:core:1.8.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation-experimental:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.5.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.5.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1@aar" level="project" />

+ 4
- 1
.idea/modules/app/RecurveBowSight.app.unitTest.iml Näytä tiedosto

@@ -29,6 +29,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="RecurveBowSight.app.main" scope="TEST" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.annotation:annotation:1.3.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.databinding:databinding-common:7.2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.arch.core:core-common:2.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-common:2.5.1" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.collection:collection:1.1.0" level="project" />
@@ -43,11 +44,13 @@
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.13.2" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.databinding:viewbinding:7.2.2@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.databinding:databinding-runtime:7.2.2@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.5.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.databinding:databinding-adapters:7.2.2@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.appcompat:appcompat:1.5.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.activity:activity:1.5.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.core:core:1.8.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.annotation:annotation-experimental:1.1.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.5.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.5.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1@aar" level="project" />

+ 55
- 28
.idea/workspace.xml Näytä tiedosto

@@ -21,6 +21,13 @@
</component>
<component name="ChangeListManager">
<list default="true" id="41369230-c648-4299-baf3-de5f13bcb18c" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic" afterDir="true" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/CalculationTask.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculator.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_icon_calculate.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.3.3/checksums/checksums.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/checksums/checksums.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.3.3/checksums/md5-checksums.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/checksums/md5-checksums.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.3.3/checksums/sha1-checksums.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/checksums/sha1-checksums.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.3.3/executionHistory/executionHistory.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/executionHistory/executionHistory.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.3.3/executionHistory/executionHistory.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/executionHistory/executionHistory.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.bin" afterDir="false" />
@@ -29,16 +36,26 @@
<change beforePath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gradle/buildOutputCleanup/outputFiles.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/buildOutputCleanup/outputFiles.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.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/modules/app/RecurveBowSight.app.androidTest.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules/app/RecurveBowSight.app.androidTest.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/app/RecurveBowSight.app.main.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules/app/RecurveBowSight.app.main.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/app/RecurveBowSight.app.unitTest.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules/app/RecurveBowSight.app.unitTest.iml" 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/res/drawable-v24/avd_anim.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/drawable/ic_launcher.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_launcher.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/drawable/ic_launcher_background.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/drawable/rbs_anim_splash_logo.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/drawable/rbs_anim_splash_logo.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/nav_header_main.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/nav_header_main.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/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/RBSMainActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/RBSMainActivity.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightFragment.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightViewModel.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersViewModel.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/app_bar_main.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/app_bar_main.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_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/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/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" />
@@ -86,10 +103,16 @@
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.appcompat/appcompat/1.4.2/a0a6b931c735952c318e94c90b0239966c500c52/appcompat-1.4.2-sources.jar!/androidx/appcompat/widget/AppCompatEditText.java_AppCompatEditText_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.appcompat/appcompat/1.4.2/a0a6b931c735952c318e94c90b0239966c500c52/appcompat-1.4.2-sources.jar!/androidx/appcompat/widget/AppCompatEditText.java_SELECTED" value="AppCompatEditText" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.appcompat/appcompat/1.5.0/ffb6d2b7e47daaa4a24b434db111ab9e411c33a0/appcompat-1.5.0-sources.jar!/androidx/appcompat/widget/AppCompatEditText.java_AppCompatEditText_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.appcompat/appcompat/1.5.0/ffb6d2b7e47daaa4a24b434db111ab9e411c33a0/appcompat-1.5.0-sources.jar!/androidx/appcompat/widget/AppCompatEditText.java_SELECTED" value="AppCompatEditText" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.appcompat/appcompat/1.5.0/ffb6d2b7e47daaa4a24b434db111ab9e411c33a0/appcompat-1.5.0-sources.jar!/androidx/appcompat/widget/AppCompatTextView.java_AppCompatTextView_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.appcompat/appcompat/1.5.0/ffb6d2b7e47daaa4a24b434db111ab9e411c33a0/appcompat-1.5.0-sources.jar!/androidx/appcompat/widget/AppCompatTextView.java_SELECTED" value="AppCompatTextView" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.recyclerview/recyclerview/1.2.1/f0f93e67af3f7417bdd560d5142f6dec4fe629c3/recyclerview-1.2.1-sources.jar!/androidx/recyclerview/widget/RecyclerView.java_RecyclerView_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.recyclerview/recyclerview/1.2.1/f0f93e67af3f7417bdd560d5142f6dec4fe629c3/recyclerview-1.2.1-sources.jar!/androidx/recyclerview/widget/RecyclerView.java_SELECTED" value="RecyclerView" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.viewpager2/viewpager2/1.0.0/3c3569044e6969f1ee5c3aa03b08e6717a2d782f/viewpager2-1.0.0-sources.jar!/androidx/viewpager2/widget/ViewPager2.java_SELECTED" value="ViewPager2" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.viewpager2/viewpager2/1.0.0/3c3569044e6969f1ee5c3aa03b08e6717a2d782f/viewpager2-1.0.0-sources.jar!/androidx/viewpager2/widget/ViewPager2.java_ViewPager2_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/com.google.android.material/material/1.6.1/d4d703885d24c61bc0ec39a9a705969e41d773ef/material-1.6.1-sources.jar!/com/google/android/material/textview/MaterialTextView.java_MaterialTextView_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/com.google.android.material/material/1.6.1/d4d703885d24c61bc0ec39a9a705969e41d773ef/material-1.6.1-sources.jar!/com/google/android/material/textview/MaterialTextView.java_SELECTED" value="MaterialTextView" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-29/android/view/View.java_SELECTED" value="View" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-29/android/widget/AutoCompleteTextView.java_SELECTED" value="AutoCompleteTextView" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-29/android/widget/EditText.java_SELECTED" value="EditText" />
@@ -241,26 +264,11 @@
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/about/AboutFragment.java</url>
<line>18</line>
<option name="timeStamp" value="2" />
</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>99</line>
<option name="timeStamp" value="4" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/EquipmentRecyclerViewAdapter.java</url>
<line>51</line>
<option name="timeStamp" value="10" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/EquipmentRecyclerViewAdapter.java</url>
<line>54</line>
<option name="timeStamp" value="13" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/RiserConfigurationActivity.java</url>
<line>99</line>
@@ -316,16 +324,35 @@
<line>190</line>
<option name="timeStamp" value="56" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightFragment.java</url>
<line>53</line>
<option name="timeStamp" value="58" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$USER_HOME$/AppData/Local/Android/Sdk/sources/android-32/android/widget/TextView.java</url>
<line>6178</line>
<option name="timeStamp" value="68" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java</url>
<line>169</line>
<option name="timeStamp" value="74" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java</url>
<line>208</line>
<option name="timeStamp" value="75" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<watches-manager>
<configuration name="app">
<watch expression="this.binding.asRiserSelectionTxt.getAdapter().getCount()" language="JAVA" />
<watch expression="this.binding.asSightSelectionTxt.getAdapter().getCount()" language="JAVA" />
<watch expression="this" />
<watch expression="aArcherySetup.getRiser()" language="JAVA" />
<watch expression="this.mArcherySetup.getValue().getRiserName()" language="JAVA" />
<watch expression="this.binding.asBowPulloutTxt.getText().toString()" language="JAVA" />
<watch expression="getViewLifecycleOwner()" language="JAVA" />
<watch expression="getParentFragment()" language="JAVA" />
<watch expression="getParentFragment().getArguments()" language="JAVA" />
<watch expression="this.binding.arrowDiameterTxt.getText().toString().isEmpty()" language="JAVA" />
</configuration>
</watches-manager>
</component>

+ 4
- 0
app/build.gradle Näytä tiedosto

@@ -28,6 +28,10 @@ android {
buildFeatures {
viewBinding true
}

dataBinding {
enabled = true
}
}

dependencies {

+ 1
- 15
app/src/main/java/ch/spherIC/recurvebowsight/RBSMainActivity.java Näytä tiedosto

@@ -5,10 +5,8 @@ package ch.spherIC.recurvebowsight;

import android.os.Bundle;
import android.view.Menu;
import android.view.View;

import com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.splashscreen.SplashScreen;
@@ -29,23 +27,11 @@ public class RBSMainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
SplashScreen splashScreen = androidx.core.splashscreen.SplashScreen.installSplashScreen(this);

try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());

setSupportActionBar(binding.appBarMain.toolbar);
binding.appBarMain.fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});

DrawerLayout drawer = binding.drawerLayout;
NavigationView navigationView = binding.navView;
// Passing each menu ID as a set of Ids because each

+ 114
- 0
app/src/main/java/ch/spherIC/recurvebowsight/logic/CalculationTask.java Näytä tiedosto

@@ -0,0 +1,114 @@
/**
* Copyright (C) 2022 - Florindo Smilari (spherIC)
*/
package ch.spherIC.recurvebowsight.logic;
import android.os.AsyncTask;
/**
* @author FC Smilari
*/
public class CalculationTask extends AsyncTask<TrajectoryCalculator, Integer, TrajectoryCalculator> {
private static final Double PHI = 1.0;
TrajectoryCalculator calculator;
@Override
protected TrajectoryCalculator doInBackground(final TrajectoryCalculator... params) {
this.calculator = params[0];
boolean exitLoop = false;
Double angleX = 0.0;
Double angleHigh = 0.0;
Double angleLow = this.calculator.getStartAngle() + PHI;
Double[][] results;
Double frictionCoefficient = this.calculator.calculateFrictionCoeficient();
// Startwerte für angleLow und angleHigh berechnen
do {
angleLow -= PHI;
results = this.calculator.calculateTrajectory(angleLow, frictionCoefficient);
} while (results[results.length - 1][TrajectoryCalculator.IDX_Y] - this.calculator.getDeltaHeight() > 0);
angleHigh = angleLow;
do {
angleHigh += PHI;
results = this.calculator.calculateTrajectory(angleHigh, frictionCoefficient);
} while (results[results.length - 1][TrajectoryCalculator.IDX_Y] - this.calculator.getDeltaHeight() < 0);
// Winkel suchen mit Hilfe der Regula Falsi und Flugbahnberechnungsiterationen
do {
angleX = (angleHigh + angleLow) / 2;
results = this.calculator.calculateTrajectory(angleX, frictionCoefficient);
if (Math.abs(this.calculator.getDeltaHeight() - results[results.length - 1][TrajectoryCalculator.IDX_Y])
> this.calculator.getCalculationPrecision()) {
if (results[results.length - 1][TrajectoryCalculator.IDX_Y] - this.calculator.getDeltaHeight() < 0) {
angleLow = angleX;
} else {
angleHigh = angleX;
}
} else {
exitLoop = true;
}
} while (!exitLoop);
this.calculator.setStartAngle(angleX);
this.calculator.setFlightCurve(results);
this.calculator.setMaxHCurve(calculateMaxHeight(results));
publishProgress(0, results.length - 1);
sleep(5);
for (int i = 0; i < results.length; i++) {
publishProgress(1, i);
sleep(5);
}
return this.calculator;
}
public static Double[] calculateMaxHeight(final Double[][] flightCurve) {
Double[] maxHCurve = new Double[]{0d, 0d};
Double maxH = 0.0;
for (int i = 0; i < flightCurve.length; i++) {
if (flightCurve[i][TrajectoryCalculator.IDX_Y] > maxH) {
maxH = flightCurve[i][TrajectoryCalculator.IDX_Y];
maxHCurve[0] = maxH;
maxHCurve[1] = flightCurve[i][TrajectoryCalculator.IDX_T];
}
}
return maxHCurve;
}
@Override
protected void onProgressUpdate(final Integer... values) {
super.onProgressUpdate(values);
this.calculator.getListener().updateTrajectoryTxtFld(values[0], this.calculator.getFlightCurve()[values[1]], this.calculator.getStartAngle(),
this.calculator.getMaxHCurve());
}
@Override
protected void onPostExecute(final TrajectoryCalculator calculator) {
super.onPostExecute(calculator);
calculator.getListener().onCalculationDone(calculator.getFlightCurve(), calculator.getStartAngle(), calculator.getMaxHCurve());
}
private void sleep(final long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

+ 251
- 0
app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculator.java Näytä tiedosto

@@ -0,0 +1,251 @@
/**
* Copyright (C) 2022 - Florindo Smilari (spherIC)
*/
package ch.spherIC.recurvebowsight.logic;
import java.util.ArrayList;
import java.util.List;
import ch.spherIC.recurvebowsight.TrajectoryCalculation;
public class TrajectoryCalculator {
public static final int IDX_T = 0;
public static final int IDX_VX = 1;
public static final int IDX_VY = 2;
public static final int IDX_X = 3;
public static final int IDX_Y = 4;
public static final Double GRAVITY = Double.valueOf(9.81);
private static final Double CELSIUS_TO_KELVIN = 273.15;
private static final Double R_L = 287.058;
private static final Double R_D = 461.0;
private static final Double PRESS_AIR = 101325.0;
private static final Double E_T0 = 611.2;
private static final Double T0 = 17.62;
private static final Double T1 = 243.12;
private final Double arrowDiameter;
private final Double arrowCw;
private final Double arrowWeight;
private final Double v0;
private final Double distance;
private final Double deltaHeight;
private final Double airTemperature;
private final Double relativeHumidity;
private final Double deltaTime;
private final Double calculationPrecision;
private final TrajectoryCalculation listener;
private Double[][] flightCurve;
private Double startAngle;
private Double[] maxHCurve;
/**
* Konstruktor.
*
* @param arrowDiameter
* @param arrowCw
* @param arrowWeight
* @param v0
* @param distance
* @param deltaHeight
* @param airTemperature
* @param relativeHumidity
* @param deltaTime
* @param calculationPrecision
* @param listener
*/
public TrajectoryCalculator(final Double arrowDiameter,
final Double arrowCw,
final Double arrowWeight,
final Double v0,
final Double distance,
final Double deltaHeight,
final Double airTemperature,
final Double relativeHumidity,
final Double deltaTime,
final Double calculationPrecision,
final TrajectoryCalculation listener) {
super();
this.arrowDiameter = arrowDiameter;
this.arrowCw = arrowCw;
this.arrowWeight = arrowWeight;
this.v0 = v0;
this.distance = distance;
this.deltaHeight = deltaHeight;
this.airTemperature = airTemperature;
this.relativeHumidity = relativeHumidity;
this.deltaTime = deltaTime;
this.calculationPrecision = calculationPrecision;
this.listener = listener;
}
public Double[][] calculateTrajectory(final Double startAngle, final Double frictionCoefficient) {
List<Double[]> results = new ArrayList<Double[]>();
Double angle = Math.toRadians(startAngle);
Double vxOld = Math.cos(angle) * this.v0;
Double vyOld = Math.sin(angle) * this.v0;
Double vxNew = 0d;
Double vyNew = 0d;
Double xNew = 0d;
Double yNew = 0d;
Double xOld = 0d;
Double yOld = 0d;
Double totTime = 0d;
Double k = frictionCoefficient; //calculateFrictionCoeficient(this.arrowCw, this.arrowDiameter, this.airTemperature, this.relativeHumidity);
Double m = this.arrowWeight;
Double[] r1 = new Double[5];
r1[TrajectoryCalculator.IDX_T] = totTime;
r1[TrajectoryCalculator.IDX_VX] = vxOld;
r1[TrajectoryCalculator.IDX_VY] = vyOld;
r1[TrajectoryCalculator.IDX_X] = xOld;
r1[TrajectoryCalculator.IDX_Y] = yOld;
results.add(r1);
while (xNew <= this.distance) {
vxNew = vxOld + this.deltaTime * -(k / m) * Math.sqrt(vxOld * vxOld + vyOld * vyOld) * vxOld;
vyNew = vyOld + this.deltaTime * (-(k / m) * Math.sqrt(vxOld * vxOld + vyOld * vyOld) * vyOld - TrajectoryCalculator.GRAVITY);
xNew = xOld + this.deltaTime * ((vxOld + vxNew) / 2);
yNew = yOld + this.deltaTime * ((vyOld + vyNew) / 2);
vxOld = vxNew;
vyOld = vyNew;
xOld = xNew;
yOld = yNew;
totTime += this.deltaTime;
r1 = new Double[5];
r1[TrajectoryCalculator.IDX_T] = totTime;
r1[TrajectoryCalculator.IDX_VX] = vxOld;
r1[TrajectoryCalculator.IDX_VY] = vyOld;
r1[TrajectoryCalculator.IDX_X] = xOld;
r1[TrajectoryCalculator.IDX_Y] = yOld;
results.add(r1);
}
Double[] rLow = results.get(results.size() - 2);
Double[] rHigh = results.get(results.size() - 1);
if (rLow[IDX_X] < this.distance && rHigh[IDX_X] > this.distance) {
Double deltaT1 = rHigh[IDX_T] - rLow[IDX_T];
Double deltaVx1 = rHigh[IDX_VX] - rLow[IDX_VX];
Double deltaVy1 = rHigh[IDX_VY] - rLow[IDX_VY];
Double deltaX1 = rHigh[IDX_X] - rLow[IDX_X];
Double deltaY1 = rHigh[IDX_Y] - rLow[IDX_Y];
Double deltaX2 = this.distance - rLow[IDX_X];
Double deltaY2 = deltaY1 * deltaX2 / deltaX1;
Double deltaVx2 = deltaVx1 / deltaX1 * deltaX2;
Double deltaVy2 = deltaVy1 / deltaY1 * deltaY2;
Double deltaT2 = deltaT1 / deltaX1 * deltaX2;
results.get(results.size() - 1)[IDX_T] = results.get(results.size() - 2)[IDX_T] + deltaT2;
results.get(results.size() - 1)[IDX_VX] = results.get(results.size() - 2)[IDX_VX] + deltaVx2;
results.get(results.size() - 1)[IDX_VY] = results.get(results.size() - 2)[IDX_VY] + deltaVy2;
results.get(results.size() - 1)[IDX_X] = results.get(results.size() - 2)[IDX_X] + deltaX2;
results.get(results.size() - 1)[IDX_Y] = results.get(results.size() - 2)[IDX_Y] + deltaY2;
}
return results.toArray(new Double[][]{});
}
public Double calculateFrictionCoeficient() {
return calculateFrictionCoeficient(this.arrowCw, this.arrowDiameter, this.airTemperature, this.relativeHumidity);
}
public Double calculateFrictionCoeficient(final Double arrowCw, final Double arrowDiameter,
final Double airTemperature, final Double relativeHumidity) {
Double eW = TrajectoryCalculator.E_T0
* Math.pow(Math.E, TrajectoryCalculator.T0 * airTemperature / (TrajectoryCalculator.T1 + airTemperature));
Double rF = TrajectoryCalculator.R_L
/ (1 - relativeHumidity * eW / TrajectoryCalculator.PRESS_AIR * (1 - TrajectoryCalculator.R_L / TrajectoryCalculator.R_D));
Double airDensity = TrajectoryCalculator.PRESS_AIR / (rF * (airTemperature + TrajectoryCalculator.CELSIUS_TO_KELVIN));
Double friction = airDensity * arrowCw * (Math.pow(arrowDiameter, 2) / 4 * Math.PI) / 2;
return friction;
}
public Double getArrowDiameter() {
return this.arrowDiameter;
}
public Double getArrowCw() {
return this.arrowCw;
}
public Double getArrowWeight() {
return this.arrowWeight;
}
public Double getV0() {
return this.v0;
}
public Double getDistance() {
return this.distance;
}
public Double getDeltaHeight() {
return this.deltaHeight;
}
public Double getAirTemperature() {
return this.airTemperature;
}
public Double getRelativeHumidity() {
return this.relativeHumidity;
}
public Double getDeltaTime() {
return this.deltaTime;
}
public Double getCalculationPrecision() {
return this.calculationPrecision;
}
public TrajectoryCalculation getListener() {
return this.listener;
}
public Double[][] getFlightCurve() {
return this.flightCurve;
}
public void setFlightCurve(final Double[][] flightCurve) {
this.flightCurve = flightCurve;
}
public Double[] getMaxHCurve() {
return this.maxHCurve;
}
public void setMaxHCurve(final Double[] maxHCurve) {
this.maxHCurve = maxHCurve;
}
public Double getStartAngle() {
return this.startAngle;
}
public void setStartAngle(final Double startAngle) {
this.startAngle = startAngle;
}
}

+ 1
- 8
app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightFragment.java Näytä tiedosto

@@ -13,11 +13,9 @@ import com.google.android.material.tabs.TabLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.viewpager2.widget.ViewPager2;
import ch.spherIC.recurvebowsight.R;
import ch.spherIC.recurvebowsight.databinding.FragmentCalcsightBinding;
import ch.spherIC.recurvebowsight.model.IArcherySetup;

public class CalculateSightFragment extends Fragment {

@@ -27,14 +25,8 @@ public class CalculateSightFragment extends Fragment {
private ViewPager2.OnPageChangeCallback pageChangeCallback;

public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
CalculateSightViewModel galleryViewModel = new ViewModelProvider(this).get(CalculateSightViewModel.class);
this.binding = FragmentCalcsightBinding.inflate(inflater, container, false);
View root = this.binding.getRoot();

if (getArguments() != null && getArguments().containsKey("setup")) {
IArcherySetup archerySetup = getArguments().getParcelable("setup");
galleryViewModel.setSelectedArcherySetup(archerySetup);
}
return root;
}

@@ -72,6 +64,7 @@ public class CalculateSightFragment extends Fragment {
public void onTabReselected(TabLayout.Tab tab) {
}
});

}

@Override

+ 172
- 4
app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java Näytä tiedosto

@@ -3,49 +3,217 @@
*/
package ch.spherIC.recurvebowsight.ui.calcsight;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Toast;

import java.text.DecimalFormat;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import ch.spherIC.recurvebowsight.R;
import ch.spherIC.recurvebowsight.TrajectoryCalculation;
import ch.spherIC.recurvebowsight.databinding.FragmentCalcsightParametersBinding;
import ch.spherIC.recurvebowsight.logic.CalculationTask;
import ch.spherIC.recurvebowsight.logic.TrajectoryCalculator;
import ch.spherIC.recurvebowsight.model.IArcherySetup;
import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter;
import ch.spherIC.recurvebowsight.utilities.PlatformUtils;

public class CalculateSightParametersFragment extends Fragment implements TrajectoryCalculation {

public class CalculateSightParametersFragment extends Fragment {
private static final double CENTI = 0.01;
private static final double MILLI = 0.001;

private FragmentCalcsightParametersBinding binding;
private CalculateSightParametersViewModel calculateSightViewModel;
private ProgressDialog progressDialog;

public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = FragmentCalcsightParametersBinding.inflate(inflater, container, false);
this.calculateSightViewModel = new ViewModelProvider(this).get(CalculateSightParametersViewModel.class);
this.binding = FragmentCalcsightParametersBinding.inflate(inflater, container, false);
View root = binding.getRoot();

binding.fabCalculate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/*
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
*/
updateModelFromUI();
calculate();
}
});

loadCalculationAccuracies(root);
loadCalculationTimeIntervals(root);
addObservers();

return root;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getParentFragment() != null && getParentFragment().getArguments() != null && getParentFragment().getArguments().containsKey("setup")) {
IArcherySetup archerySetup = getParentFragment().getArguments().getParcelable("setup");
this.calculateSightViewModel.setSelectedArcherySetup(archerySetup);
}
}

@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}

private void addObservers() {
DecimalFormat dF = new DecimalFormat("#.#");
DecimalFormat dF2 = new DecimalFormat("#.##");
DecimalFormat dF3 = new DecimalFormat("#.###");
this.calculateSightViewModel.getArrowDiameter().observe(getViewLifecycleOwner(), arrowDiameter -> this.binding.arrowDiameterTxt.setText(arrowDiameter != null ? dF.format(arrowDiameter) : ""));
this.calculateSightViewModel.getArrowCw().observe(getViewLifecycleOwner(), arrowCw -> this.binding.arrowCwTxt.setText(arrowCw != null ? dF.format(arrowCw) : ""));
this.calculateSightViewModel.getArrowWeight().observe(getViewLifecycleOwner(), arrowWeight -> this.binding.arrowWeightTxt.setText(arrowWeight != null ? dF.format(arrowWeight) : ""));
this.calculateSightViewModel.getBowPullout().observe(getViewLifecycleOwner(), bowPullout -> this.binding.bowPulloutTxt.setText(bowPullout != null ? dF.format(bowPullout) : ""));
this.calculateSightViewModel.getArrowV0().observe(getViewLifecycleOwner(), arrowV0 -> this.binding.arrowV0Txt.setText(arrowV0 != null ? dF.format(arrowV0) : ""));
this.calculateSightViewModel.getHNA().observe(getViewLifecycleOwner(), hNA -> this.binding.hNATxt.setText(hNA != null ? dF.format(hNA) : ""));
this.calculateSightViewModel.getNockRaising().observe(getViewLifecycleOwner(), nockRaising -> this.binding.nockRaisingTxt.setText(nockRaising != null ? dF.format(nockRaising) : ""));
this.calculateSightViewModel.getBraceHeight().observe(getViewLifecycleOwner(), braceHeight -> this.binding.braceHeightTxt.setText(braceHeight != null ? dF.format(braceHeight) : ""));
this.calculateSightViewModel.getAirTemperature().observe(getViewLifecycleOwner(), airTemp -> this.binding.airTemperatureTxt.setText(airTemp != null ? dF.format(airTemp) : ""));
this.calculateSightViewModel.getRelativeAirHumidity().observe(getViewLifecycleOwner(), relAirHumidity -> this.binding.airRelativeHumidityTxt.setText(relAirHumidity != null ? dF.format(relAirHumidity) : ""));
this.calculateSightViewModel.getShootingDistance().observe(getViewLifecycleOwner(), shootingDistance -> this.binding.shootingDistanzTxt.setText(shootingDistance != null ? dF.format(shootingDistance) : ""));
this.calculateSightViewModel.getArrowNockHeight().observe(getViewLifecycleOwner(), arrowNockHeight -> this.binding.arrowNockHeightTxt.setText(arrowNockHeight != null ? dF2.format(arrowNockHeight) : ""));
this.calculateSightViewModel.getTargetCenterHeight().observe(getViewLifecycleOwner(), targetCenterHeight -> this.binding.targetCenterHeightTxt.setText(targetCenterHeight != null ? dF2.format(targetCenterHeight) : ""));
this.calculateSightViewModel.getDeltaTime().observe(getViewLifecycleOwner(), deltaTime -> this.binding.deltaTimeTxt.setText(deltaTime != null ? dF3.format(deltaTime) : ""));
this.calculateSightViewModel.getCalcPrecision().observe(getViewLifecycleOwner(), calcPrecision -> this.binding.calcPrecisionTxt.setText(calcPrecision != null ? dF.format(calcPrecision) : ""));
}

private void updateModelFromUI() {
this.calculateSightViewModel.setArrowDiameter(PlatformUtils.parseDouble(this.binding.arrowDiameterTxt.getText().toString()));
this.calculateSightViewModel.setArrowCw(PlatformUtils.parseDouble(this.binding.arrowCwTxt.getText().toString()));
this.calculateSightViewModel.setArrowWeight(PlatformUtils.parseDouble(this.binding.arrowWeightTxt.getText().toString()));
this.calculateSightViewModel.setArrowV0(PlatformUtils.parseDouble(this.binding.arrowV0Txt.getText().toString()));
this.calculateSightViewModel.setBowPullout(PlatformUtils.parseDouble(this.binding.bowPulloutTxt.getText().toString()));
this.calculateSightViewModel.setHNA(PlatformUtils.parseDouble(this.binding.hNATxt.getText().toString()));
this.calculateSightViewModel.setNockRaising(PlatformUtils.parseDouble(this.binding.nockRaisingTxt.getText().toString()));
this.calculateSightViewModel.setBraceHeight(PlatformUtils.parseDouble(this.binding.braceHeightTxt.getText().toString()));
this.calculateSightViewModel.setAirTemperature(PlatformUtils.parseDouble(this.binding.airTemperatureTxt.getText().toString()));
this.calculateSightViewModel.setRelativeAirHumidity(PlatformUtils.parseDouble(this.binding.airRelativeHumidityTxt.getText().toString()));
this.calculateSightViewModel.setShootingDistance(PlatformUtils.parseDouble(this.binding.shootingDistanzTxt.getText().toString()));
this.calculateSightViewModel.setArrowNockHeight(PlatformUtils.parseDouble(this.binding.arrowNockHeightTxt.getText().toString()));
this.calculateSightViewModel.setTargetCenterHeight(PlatformUtils.parseDouble(this.binding.targetCenterHeightTxt.getText().toString()));
this.calculateSightViewModel.setDeltaTime(PlatformUtils.parseDouble(this.binding.deltaTimeTxt.getText().toString()));
this.calculateSightViewModel.setCalcPrecision(PlatformUtils.parseDouble(this.binding.calcPrecisionTxt.getText().toString()));
}

private void loadCalculationAccuracies(View root) {
String[] accuracies = root.getResources().getStringArray(R.array.CalculationAccuracies);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(root.getContext(), android.R.layout.simple_dropdown_item_1line, accuracies);
ArrayAdapter<String> adapter = new NoFilterArrayAdapter<String>(root.getContext(), android.R.layout.simple_dropdown_item_1line, accuracies);
AutoCompleteTextView textView = root.findViewById(R.id.calcPrecisionTxt);
textView.setAdapter(adapter);
}

private void loadCalculationTimeIntervals(View root) {
String[] timeDeltas = root.getResources().getStringArray(R.array.CalculationTimeIntervals);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(root.getContext(), android.R.layout.simple_dropdown_item_1line, timeDeltas);
ArrayAdapter<String> adapter = new NoFilterArrayAdapter<String>(root.getContext(), android.R.layout.simple_dropdown_item_1line, timeDeltas);
AutoCompleteTextView textView = root.findViewById(R.id.deltaTimeTxt);
textView.setAdapter(adapter);
}

/**
* Startet die Berechnung wenn alle notwendigen Felder gefüllt sind.
*/
private void calculate() {
if (allParamFieldsValid()) {
Context context = this.binding.getRoot().getContext();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(this.binding.getRoot().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

this.progressDialog = ProgressDialog.show(binding.getRoot().getContext(), null, getResources().getString(R.string.caption_Calculating), true, false);

CalculationTask calcTask = new CalculationTask();
TrajectoryCalculator calculator = new TrajectoryCalculator(
Double.valueOf(this.binding.arrowDiameterTxt.getText().toString().trim()) * MILLI,
Double.valueOf(this.binding.arrowCwTxt.getText().toString().trim()),
Double.valueOf(this.binding.arrowWeightTxt.getText().toString().trim()) * MILLI,
Double.valueOf(this.binding.arrowV0Txt.getText().toString().trim()),
Double.valueOf(this.binding.shootingDistanzTxt.getText().toString().trim()),
Double.valueOf(this.binding.targetCenterHeightTxt.getText().toString().trim())
- Double.valueOf(this.binding.arrowNockHeightTxt.getText().toString().trim()),
Double.valueOf(this.binding.airTemperatureTxt.getText().toString().trim()),
Double.valueOf(this.binding.airRelativeHumidityTxt.getText().toString().trim()) * CENTI,
Double.valueOf(this.binding.deltaTimeTxt.getText().toString().trim()),
Double.valueOf(this.binding.calcPrecisionTxt.getText().toString().trim()) * CENTI,
this);
calculator.setStartAngle(0d);
calcTask.execute(calculator);

} else {
Toast toast = Toast.makeText(binding.getRoot().getContext(), getResources().getString(R.string.caption_FillAllMandatoryFields), Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
}

private boolean allParamFieldsValid() {
return !this.binding.arrowDiameterTxt.getText().toString().isEmpty()
&& !this.binding.arrowCwTxt.getText().toString().isEmpty()
&& !this.binding.arrowWeightTxt.getText().toString().isEmpty()
&& !this.binding.bowPulloutTxt.getText().toString().isEmpty()
&& !this.binding.arrowV0Txt.getText().toString().isEmpty()
&& !this.binding.hNATxt.getText().toString().isEmpty()
&& !this.binding.nockRaisingTxt.getText().toString().isEmpty()
&& !this.binding.braceHeightTxt.getText().toString().isEmpty()
&& !this.binding.airTemperatureTxt.getText().toString().isEmpty()
&& !this.binding.airRelativeHumidityTxt.getText().toString().isEmpty()
&& !this.binding.shootingDistanzTxt.getText().toString().isEmpty()
&& !this.binding.arrowNockHeightTxt.getText().toString().isEmpty()
&& !this.binding.targetCenterHeightTxt.getText().toString().isEmpty()
&& !this.binding.deltaTimeTxt.getText().toString().isEmpty()
&& !this.binding.calcPrecisionTxt.getText().toString().isEmpty()
&& allSightParamFieldsValid();
}

private boolean allSightParamFieldsValid() {
/*return !this.scVvisHTxtFld.getText().toString().isEmpty()
&& !this.scVvisVTxtFld.getText().toString().isEmpty()
&& !this.scaHTxtFld.getText().toString().isEmpty()
&& !this.scaVTxtFld.getText().toString().isEmpty()
&& !this.scVertScaleRngTxtFld.getText().toString().isEmpty()
&& !this.scPointerOffsetTxtFld.getText().toString().isEmpty()
&& ((this.scHeVSSpinner.getVisibility() == View.VISIBLE && this.scHeVSSpinner.getSelectedItem() != null)
|| (this.scHeVSTxtFld.getVisibility() == View.VISIBLE && !this.scHeVSTxtFld.getText().toString().isEmpty()))
&& !this.scVertScaleMiddleTxtFld.getText().toString().isEmpty();
*/
return true;
}

@Override
public void updateTrajectoryTxtFld(Integer step, Double[] flightCurveRow, Double startAngle, Double[] maxHCurve) {

}

@Override
public void onCalculationDone(Double[][] flightCurve, Double startAngle, Double[] maxHCurve) {
if (this.progressDialog != null) {
this.progressDialog.dismiss();
}

//TODO: Remove toast when result fragments are done
Toast toast = Toast.makeText(binding.getRoot().getContext(), "Abschusswinkel: " + startAngle, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();

}
}

+ 242
- 0
app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersViewModel.java Näytä tiedosto

@@ -0,0 +1,242 @@
/**
* Copyright (C) 2022 - Florindo Smilari (spherIC)
*/
package ch.spherIC.recurvebowsight.ui.calcsight;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import ch.spherIC.recurvebowsight.model.IArcherySetup;

public class CalculateSightParametersViewModel extends ViewModel {

private final MutableLiveData<IArcherySetup> mSelectedArcherySetup;
private final MutableLiveData<Double> mArrowDiameter;
private final MutableLiveData<Double> mArrowCw;
private final MutableLiveData<Double> mArrowWeight;
private final MutableLiveData<Double> mBowPullout;
private final MutableLiveData<Double> mArrowV0;
private final MutableLiveData<Double> mHNA;
private final MutableLiveData<Double> mNockRaising;
private final MutableLiveData<Double> mBraceHeight;
private final MutableLiveData<Double> mAirTemperature;
private final MutableLiveData<Double> mRelativeAirHumidity;
private final MutableLiveData<Double> mShootingDistance;
private final MutableLiveData<Double> mArrowNockHeight;
private final MutableLiveData<Double> mTargetCenterHeight;
private final MutableLiveData<Double> mDeltaTime;
private final MutableLiveData<Double> mCalcPrecision;

public CalculateSightParametersViewModel() {
this.mSelectedArcherySetup = new MutableLiveData<>();
this.mArrowDiameter = new MutableLiveData<>();
this.mArrowCw = new MutableLiveData<>();
this.mArrowWeight = new MutableLiveData<>();
this.mBowPullout = new MutableLiveData<>();
this.mArrowV0 = new MutableLiveData<>();
this.mHNA = new MutableLiveData<>();
this.mNockRaising = new MutableLiveData<>();
this.mBraceHeight = new MutableLiveData<>();
this.mAirTemperature = new MutableLiveData<>();
this.mRelativeAirHumidity = new MutableLiveData<>();
this.mShootingDistance = new MutableLiveData<>();
this.mArrowNockHeight = new MutableLiveData<>();
this.mTargetCenterHeight = new MutableLiveData<>();
this.mDeltaTime = new MutableLiveData<>();
this.mCalcPrecision = new MutableLiveData<>();

this.mArrowDiameter.setValue(null);
this.mArrowCw.setValue(null);
this.mArrowWeight.setValue(null);
this.mBowPullout.setValue(null);
this.mArrowV0.setValue(null);
this.mHNA.setValue(null);
this.mNockRaising.setValue(null);
this.mBraceHeight.setValue(null);
this.mAirTemperature.setValue(null);
this.mRelativeAirHumidity.setValue(null);
this.mShootingDistance.setValue(null);
this.mArrowNockHeight.setValue(null);
this.mTargetCenterHeight.setValue(null);
this.mDeltaTime.setValue(null);
this.mCalcPrecision.setValue(null);
}

public void setSelectedArcherySetup(IArcherySetup aSelectedArcherySetup) {
this.mSelectedArcherySetup.setValue(aSelectedArcherySetup);
this.mArrowDiameter.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getArrowDiameter() : null);
this.mArrowCw.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getArrowCw() : null);
this.mArrowWeight.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getArrowWeight() : null);
this.mBowPullout.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getBowPullout() : null);
this.mArrowV0.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getArrowV0() : null);
this.mHNA.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getHNA() : null);
this.mNockRaising.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getNockRaising() : null);
this.mBraceHeight.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getBraceHeight() : null);
this.mArrowNockHeight.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getArrowNockHeight() : null);
this.mTargetCenterHeight.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getTargetCenterHeight() : null);
this.mDeltaTime.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getDeltaTime() : null);
this.mCalcPrecision.setValue(aSelectedArcherySetup != null ? aSelectedArcherySetup.getCalcPrecision() : null);
}

public void setArrowDiameter(Double aArrowDiameter) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setArrowDiameter(aArrowDiameter);
}
this.mArrowDiameter.setValue(aArrowDiameter);
}

public void setArrowCw(Double aArrowCw) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setArrowCw(aArrowCw);
}
this.mArrowCw.setValue(aArrowCw);
}

public void setArrowWeight(Double aArrowWeight) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setArrowWeight(aArrowWeight);
}
this.mArrowWeight.setValue(aArrowWeight);
}

public void setBowPullout(Double aBowPullout) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setBowPullout(aBowPullout);
}
this.mBowPullout.setValue(aBowPullout);
}

public void setArrowV0(Double aArrowV0) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setArrowV0(aArrowV0);
}
this.mArrowV0.setValue(aArrowV0);
}

public void setHNA(Double aHNA) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setHNA(aHNA);
}
this.mHNA.setValue(aHNA);
}

public void setNockRaising(Double aNockRaising) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setNockRaising(aNockRaising);
}
this.mNockRaising.setValue(aNockRaising);
}

public void setBraceHeight(Double aBraceHeight) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setBraceHeight(aBraceHeight);
}
this.mBraceHeight.setValue(aBraceHeight);
}

public void setAirTemperature(Double aAirTemperature) {
this.mAirTemperature.setValue(aAirTemperature);
}

public void setRelativeAirHumidity(Double aRelativeAirHumidity) {
this.mRelativeAirHumidity.setValue(aRelativeAirHumidity);
}

public void setShootingDistance(Double aShootingDistance) {
this.mShootingDistance.setValue(aShootingDistance);
}

public void setArrowNockHeight(Double aArrowNockHeight) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setArrowNockHeight(aArrowNockHeight);
}
this.mArrowNockHeight.setValue(aArrowNockHeight);
}

public void setTargetCenterHeight(Double aTargetCenterHeight) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setTargetCenterHeight(aTargetCenterHeight);
}
this.mTargetCenterHeight.setValue(aTargetCenterHeight);
}


public void setDeltaTime(Double aDeltaTime) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setDeltaTime(aDeltaTime);
}
this.mDeltaTime.setValue(aDeltaTime);
}

public void setCalcPrecision(Double aCalcPrecision) {
if (this.mSelectedArcherySetup.getValue() != null) {
this.mSelectedArcherySetup.getValue().setCalcPrecision(aCalcPrecision);
}
this.mCalcPrecision.setValue(aCalcPrecision);
}

public IArcherySetup getSelectedArcherySetup() {
return mSelectedArcherySetup.getValue();
}

public LiveData<Double> getArrowDiameter() {
return this.mArrowDiameter;
}

public LiveData<Double> getArrowCw() {
return this.mArrowCw;
}

public LiveData<Double> getArrowWeight() {
return this.mArrowWeight;
}

public LiveData<Double> getBowPullout() {
return this.mBowPullout;
}

public LiveData<Double> getArrowV0() {
return this.mArrowV0;
}

public LiveData<Double> getHNA() {
return this.mHNA;
}

public LiveData<Double> getNockRaising() {
return this.mNockRaising;
}

public LiveData<Double> getBraceHeight() {
return this.mBraceHeight;
}

public LiveData<Double> getAirTemperature() {
return this.mAirTemperature;
}

public LiveData<Double> getRelativeAirHumidity() {
return this.mRelativeAirHumidity;
}

public LiveData<Double> getShootingDistance() {
return this.mShootingDistance;
}

public LiveData<Double> getArrowNockHeight() {
return this.mArrowNockHeight;
}

public LiveData<Double> getTargetCenterHeight() {
return this.mTargetCenterHeight;
}

public LiveData<Double> getDeltaTime() {
return this.mDeltaTime;
}

public LiveData<Double> getCalcPrecision() {
return this.mCalcPrecision;
}

}

+ 0
- 38
app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightViewModel.java Näytä tiedosto

@@ -1,38 +0,0 @@
/**
* Copyright (C) 2022 - Florindo Smilari (spherIC)
*/
package ch.spherIC.recurvebowsight.ui.calcsight;

import android.text.TextUtils;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import ch.spherIC.recurvebowsight.model.IArcherySetup;

public class CalculateSightViewModel extends ViewModel {

private final MutableLiveData<String> mText;

private IArcherySetup selectedArcherySetup;

public CalculateSightViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is the \"Calc Sight\" fragment for: \n-");
}

public IArcherySetup getSelectedArcherySetup() {
return selectedArcherySetup;
}

public void setSelectedArcherySetup(IArcherySetup selectedArcherySetup) {
this.selectedArcherySetup = selectedArcherySetup;
String setupName = (this.selectedArcherySetup != null && !TextUtils.isEmpty(this.selectedArcherySetup.getName())) ? this.selectedArcherySetup.getName() : "-";
mText.setValue("This is the \"Calc Sight\" fragment for: \n" + setupName);
}


public LiveData<String> getText() {
return mText;
}
}

+ 1144
- 0
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
File diff suppressed because it is too large
Näytä tiedosto


+ 10
- 0
app/src/main/res/drawable/ic_icon_calculate.xml Näytä tiedosto

@@ -0,0 +1,10 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19,3H5C3.9,3 3,3.9 3,5v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5C21,3.9 20.1,3 19,3zM19,19H5V5h14V19z"/>
<path android:fillColor="@android:color/white" android:pathData="M6.25,7.72h5v1.5h-5z"/>
<path android:fillColor="@android:color/white" android:pathData="M13,15.75h5v1.5h-5z"/>
<path android:fillColor="@android:color/white" android:pathData="M13,13.25h5v1.5h-5z"/>
<path android:fillColor="@android:color/white" android:pathData="M8,18l1.5,0l0,-2l2,0l0,-1.5l-2,0l0,-2l-1.5,0l0,2l-2,0l0,1.5l2,0z"/>
<path android:fillColor="@android:color/white" android:pathData="M14.09,10.95l1.41,-1.41l1.41,1.41l1.06,-1.06l-1.41,-1.42l1.41,-1.41l-1.06,-1.06l-1.41,1.41l-1.41,-1.41l-1.06,1.06l1.41,1.41l-1.41,1.42z"/>
</vector>

+ 15
- 13
app/src/main/res/layout/activity_equipment_configuration.xml Näytä tiedosto

@@ -406,6 +406,8 @@
<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"
@@ -413,38 +415,38 @@
app:layout_constraintTop_toBottomOf="@+id/asSightHorzSetting">

<Button
android:id="@+id/archerystpcfg_button_new"
android:id="@+id/archerystpcfg_button_delete"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:text="@string/caption_New"
app:icon="@drawable/ic_icon_add"
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/archerystpcfg_button_delete"
android:id="@+id/archerystpcfg_button_new"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="@string/caption_Delete"
app:icon="@drawable/ic_icon_delete"
android:text="@string/caption_New"
android:textSize="12sp"
app:icon="@drawable/ic_icon_add"
app:iconPadding="-8dp" />

<Button
android:id="@+id/archerystpcfg_button_save"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingHorizontal="4dp"
android:text="@string/caption_Save"
android:textSize="12sp"
app:icon="@drawable/ic_icon_save"
app:iconPadding="0dp" />
app:iconPadding="-8dp" />

</LinearLayout>


+ 15
- 13
app/src/main/res/layout/activity_riser_configuration.xml Näytä tiedosto

@@ -161,6 +161,8 @@
<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"
@@ -168,38 +170,38 @@
app:layout_constraintTop_toBottomOf="@+id/rcVvisVLayout">

<Button
android:id="@+id/risercfg_button_new"
android:id="@+id/risercfg_button_delete"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:text="@string/caption_New"
app:icon="@drawable/ic_icon_add"
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/risercfg_button_delete"
android:id="@+id/risercfg_button_new"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="@string/caption_Delete"
app:icon="@drawable/ic_icon_delete"
android:text="@string/caption_New"
android:textSize="12sp"
app:icon="@drawable/ic_icon_add"
app:iconPadding="-8dp" />

<Button
android:id="@+id/risercfg_button_save"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingHorizontal="4dp"
android:text="@string/caption_Save"
android:textSize="12sp"
app:icon="@drawable/ic_icon_save"
app:iconPadding="0dp" />
app:iconPadding="-8dp" />

</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

+ 15
- 13
app/src/main/res/layout/activity_sight_configuration.xml Näytä tiedosto

@@ -231,6 +231,8 @@
<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"
@@ -238,38 +240,38 @@
app:layout_constraintTop_toBottomOf="@+id/scPointerOffsetLayout">

<Button
android:id="@+id/sightcfg_button_new"
android:id="@+id/sightcfg_button_delete"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:text="@string/caption_New"
app:icon="@drawable/ic_icon_add"
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/sightcfg_button_delete"
android:id="@+id/sightcfg_button_new"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="@string/caption_Delete"
app:icon="@drawable/ic_icon_delete"
android:text="@string/caption_New"
android:textSize="12sp"
app:icon="@drawable/ic_icon_add"
app:iconPadding="-8dp" />

<Button
android:id="@+id/sightcfg_button_save"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingHorizontal="4dp"
android:text="@string/caption_Save"
android:textSize="12sp"
app:icon="@drawable/ic_icon_save"
app:iconPadding="0dp" />
app:iconPadding="-8dp" />

</LinearLayout>


+ 0
- 9
app/src/main/res/layout/app_bar_main.xml Näytä tiedosto

@@ -20,15 +20,6 @@

</com.google.android.material.appbar.AppBarLayout>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="16dp"
android:layout_marginEnd="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />

<include layout="@layout/content_main" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

+ 17
- 1
app/src/main/res/layout/fragment_calcsight_parameters.xml Näytä tiedosto

@@ -2,6 +2,7 @@
<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/fragment_calcsight_parameters"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
@@ -383,6 +384,7 @@
android:nextFocusDown="@id/calcPrecisionTxt"
android:nextFocusForward="@id/calcPrecisionTxt"
android:nextFocusRight="@id/calcPrecisionTxt"
android:editable="false"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>

@@ -408,11 +410,25 @@
android:nextFocusDown="@id/arrowDiameterTxt"
android:nextFocusForward="@id/arrowDiameterTxt"
android:nextFocusRight="@id/arrowDiameterTxt"
android:editable="false"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>


</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_calculate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
app:fabSize="auto"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:maxImageSize="36dp"
app:srcCompat="@drawable/ic_icon_calculate" />


</androidx.constraintlayout.widget.ConstraintLayout>

+ 3
- 3
app/src/main/res/layout/fragment_equipment_add_list.xml Näytä tiedosto

@@ -72,7 +72,7 @@
android:layout_marginStart="16dp"
android:text="@string/caption_MainCfg_Riser_SubText"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="14sp"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/riser_image_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/riser_image_view" />
@@ -174,7 +174,7 @@
android:layout_marginStart="16dp"
android:text="@string/caption_MainCfg_Sight_SubText"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="14sp"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/sight_image_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/sight_image_view" />
@@ -277,7 +277,7 @@
android:layout_marginStart="16dp"
android:text="@string/caption_MainCfg_ArcerySetup_SubText"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="14sp"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/equipment_image_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/equipment_image_view" />

+ 16
- 8
app/src/main/res/layout/fragment_equipment_choose.xml Näytä tiedosto

@@ -51,44 +51,52 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_marginStart="16dp"
android:layout_marginTop="20dp"
android:text="setup_name"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/setup_image_view"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.17000002" />

<TextView
android:id="@+id/riser_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginStart="16dp"
android:text="riser_name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/setup_image_view" />
app:layout_constraintStart_toEndOf="@+id/setup_image_view"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.7" />

<TextView
android:id="@+id/spacer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginStart="10dp"
android:text="●"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/riser_name" />
app:layout_constraintStart_toEndOf="@+id/riser_name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.7" />

<TextView
android:id="@+id/sight_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginStart="10dp"
android:text="sight_name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/spacer" />
app:layout_constraintStart_toEndOf="@+id/spacer"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.7" />

<androidx.cardview.widget.CardView
android:id="@+id/setup_image_view"

+ 1
- 0
app/src/main/res/values-de/strings.xml Näytä tiedosto

@@ -99,6 +99,7 @@
<string name="caption_Cfg_DeleteSuccessful">\'%s\' erfolgreich gelöscht!</string>
<string name="caption_Cfg_SaveSuccessful">\'%s\' erfolgreich gespeichert!</string>
<string name="caption_Cfg_UpdateSuccessful">\'%s\' erfolgreich geändert!</string>
<string name="caption_Calculating">Berechnung läuft&#8230;</string>
</resources>

+ 2
- 1
app/src/main/res/values/strings.xml Näytä tiedosto

@@ -99,5 +99,6 @@
<string name="caption_Cfg_DeleteSuccessful">\'%s\' was successfully deleted!</string>
<string name="caption_Cfg_SaveSuccessful">\'%s\' was saved successfully!</string>
<string name="caption_Cfg_UpdateSuccessful">\'%s\' was updated successfully!</string>

<string name="caption_Calculating">Calculating&#8230;</string>
</resources>

Loading…
Peruuta
Tallenna