ソースを参照

Calculation and results display

master
Flo Smilari 3年前
コミット
cbe6f029b8
31個のファイルの変更749行の追加77行の削除
  1. バイナリ
      .gradle/7.3.3/checksums/checksums.lock
  2. バイナリ
      .gradle/7.3.3/checksums/sha1-checksums.bin
  3. バイナリ
      .gradle/7.3.3/executionHistory/executionHistory.bin
  4. バイナリ
      .gradle/7.3.3/executionHistory/executionHistory.lock
  5. バイナリ
      .gradle/7.3.3/fileHashes/fileHashes.bin
  6. バイナリ
      .gradle/7.3.3/fileHashes/fileHashes.lock
  7. バイナリ
      .gradle/7.3.3/fileHashes/resourceHashesCache.bin
  8. バイナリ
      .gradle/buildOutputCleanup/buildOutputCleanup.lock
  9. バイナリ
      .gradle/buildOutputCleanup/outputFiles.bin
  10. 9
    0
      .idea/libraries/Gradle__Z.xml
  11. 1
    1
      .idea/misc.xml
  12. 1
    0
      .idea/modules/app/RecurveBowSight.app.androidTest.iml
  13. 1
    0
      .idea/modules/app/RecurveBowSight.app.main.iml
  14. 1
    0
      .idea/modules/app/RecurveBowSight.app.unitTest.iml
  15. 51
    31
      .idea/workspace.xml
  16. 1
    0
      app/build.gradle
  17. バイナリ
      app/libs/achartengine-1.1.0.jar
  18. 171
    0
      app/src/main/java/ch/spherIC/recurvebowsight/components/FlightCurveChart.java
  19. 63
    0
      app/src/main/java/ch/spherIC/recurvebowsight/components/FontTextView.java
  20. 171
    0
      app/src/main/java/ch/spherIC/recurvebowsight/components/XTextView.java
  21. 67
    0
      app/src/main/java/ch/spherIC/recurvebowsight/logic/BallisticResults.java
  22. 3
    3
      app/src/main/java/ch/spherIC/recurvebowsight/logic/CalculationTask.java
  23. 2
    2
      app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculation.java
  24. 0
    2
      app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculator.java
  25. 16
    10
      app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java
  26. 131
    2
      app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java
  27. 28
    22
      app/src/main/res/layout/fragment_calcsight_trajectory.xml
  28. 7
    1
      app/src/main/res/values-de/strings.xml
  29. 14
    0
      app/src/main/res/values/attr.xml
  30. 2
    0
      app/src/main/res/values/colors.xml
  31. 9
    3
      app/src/main/res/values/strings.xml

バイナリ
.gradle/7.3.3/checksums/checksums.lock ファイルの表示


バイナリ
.gradle/7.3.3/checksums/sha1-checksums.bin ファイルの表示


バイナリ
.gradle/7.3.3/executionHistory/executionHistory.bin ファイルの表示


バイナリ
.gradle/7.3.3/executionHistory/executionHistory.lock ファイルの表示


バイナリ
.gradle/7.3.3/fileHashes/fileHashes.bin ファイルの表示


バイナリ
.gradle/7.3.3/fileHashes/fileHashes.lock ファイルの表示


バイナリ
.gradle/7.3.3/fileHashes/resourceHashesCache.bin ファイルの表示


バイナリ
.gradle/buildOutputCleanup/buildOutputCleanup.lock ファイルの表示


バイナリ
.gradle/buildOutputCleanup/outputFiles.bin ファイルの表示


+ 9
- 0
.idea/libraries/Gradle__Z.xml ファイルの表示

@@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="Gradle: Z">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/libs/achartengine-1.1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

+ 1
- 1
.idea/misc.xml ファイルの表示

@@ -40,7 +40,7 @@
<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.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_calcsight_trajectory.xml" value="0.15" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment.xml" value="0.12361111111111112" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment_add.xml" value="0.15812841530054644" />
<entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment_add_list.xml" value="0.33" />

+ 1
- 0
.idea/modules/app/RecurveBowSight.app.androidTest.iml ファイルの表示

@@ -53,6 +53,7 @@
<orderEntry type="library" scope="TEST" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.collection:collection-ktx:1.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: Z" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.ext:junit:1.1.3@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:core:1.4.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:monitor:1.4.0@aar" level="project" />

+ 1
- 0
.idea/modules/app/RecurveBowSight.app.main.iml ファイルの表示

@@ -55,6 +55,7 @@
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0" level="project" />
<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: Z" 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" />

+ 1
- 0
.idea/modules/app/RecurveBowSight.app.unitTest.iml ファイルの表示

@@ -43,6 +43,7 @@
<orderEntry type="library" scope="TEST" name="Gradle: androidx.collection:collection-ktx:1.1.0" level="project" />
<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: Z" 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" />

+ 51
- 31
.idea/workspace.xml ファイルの表示

@@ -21,12 +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 afterPath="$PROJECT_DIR$/app/libs/achartengine-1.1.0.jar" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/components" afterDir="true" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/components/FlightCurveChart.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/components/FontTextView.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/components/XTextView.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/BallisticResults.java" 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" />
@@ -35,26 +36,20 @@
<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$/.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/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/TrajectoryCalculation.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculation.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/CalculationTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/CalculationTask.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculator.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculator.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/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_trajectory.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_trajectory.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/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/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@@ -71,8 +66,8 @@
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
<option value="resourceFile" />
<option value="Class" />
<option value="valueResourceFile" />
</list>
</option>
@@ -125,12 +120,18 @@
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/widget/AutoCompleteTextView.java_SELECTED" value="AutoCompleteTextView" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/widget/EditText.java_EditText_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/widget/EditText.java_SELECTED" value="EditText" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/widget/LinearLayout.java_LinearLayout_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/widget/LinearLayout.java_SELECTED" value="LinearLayout" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/widget/TextView.java_SELECTED" value="TextView" />
<property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/widget/TextView.java_TextView_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewZ:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/java/ch/spherIC/recurvebowsight/components/FontTextView.java_FontTextView_DIMENSIONS" value="1080&#10;1920" />
<property name="android-custom-viewZ:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/java/ch/spherIC/recurvebowsight/components/FontTextView.java_SELECTED" value="FontTextView" />
<property name="android-custom-viewZ:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/java/ch/spherIC/recurvebowsight/components/XTextView.java_SELECTED" value="XTextView" />
<property name="android-custom-viewZ:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/java/ch/spherIC/recurvebowsight/components/XTextView.java_XTextView_DIMENSIONS" value="1080&#10;1920" />
<property name="cidr.known.project.marker" value="true" />
<property name="code.cleanup.on.save" value="true" />
<property name="format.on.save" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/app/src/main/res/drawable" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/components" />
<property name="optimize.imports.on.save" value="true" />
<property name="settings.editor.selected.configurable" value="preferences.editor.code.editing" />
</component>
@@ -139,11 +140,11 @@
<recent name="ch.spherIC.recurvebowsight.ui.configuration" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\java\ch\spherIC\recurvebowsight\components" />
<recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\res\drawable" />
<recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\java\ch\spherIC\recurvebowsight\ui\calcsight" />
<recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\res\layout" />
<recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\java\ch\spherIC\recurvebowsight\utilities" />
<recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\java\ch\spherIC\recurvebowsight\database" />
</key>
<key name="android.template.1093395407">
<recent name="ch.spherIC.recurvebowsight" />
@@ -324,11 +325,6 @@
<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>
@@ -336,13 +332,33 @@
</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>211</line>
<option name="timeStamp" value="75" />
</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" />
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java</url>
<line>52</line>
<option name="timeStamp" value="76" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java</url>
<line>67</line>
<option name="timeStamp" value="79" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java</url>
<line>122</line>
<option name="timeStamp" value="80" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java</url>
<line>79</line>
<option name="timeStamp" value="81" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java</url>
<line>48</line>
<option name="timeStamp" value="83" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
@@ -352,7 +368,11 @@
<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" />
<watch expression="getParentFragmentManager().getFragments().get(1).get" language="JAVA" />
<watch expression="getParentFragment().getView().findViewById(R.id.arrowNockHeightTxt)" language="JAVA" />
<watch expression="this.calculator.getListener()" language="JAVA" />
<watch expression="this.calculator.getFlightCurve()[values[1]]" language="JAVA" />
<watch expression="(values[0]" language="JAVA" />
</configuration>
</watches-manager>
</component>

+ 1
- 0
app/build.gradle ファイルの表示

@@ -45,6 +45,7 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation files('libs\\achartengine-1.1.0.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

バイナリ
app/libs/achartengine-1.1.0.jar ファイルの表示


+ 171
- 0
app/src/main/java/ch/spherIC/recurvebowsight/components/FlightCurveChart.java ファイルの表示

@@ -0,0 +1,171 @@
/**
* Copyright (C) 2005-2012 XELOG AG
*/
package ch.spherIC.recurvebowsight.components;
import android.content.Context;
import android.graphics.Color;
import ch.spherIC.recurvebowsight.R;
import ch.spherIC.recurvebowsight.logic.TrajectoryCalculator;
import org.achartengine.ChartFactory;
import org.achartengine.GraphicalView;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.model.XYSeries;
import org.achartengine.renderer.XYMultipleSeriesRenderer;
import org.achartengine.renderer.XYSeriesRenderer;
import java.text.DecimalFormat;
/**
* @author FC Smilari
*/
public class FlightCurveChart {
private XYMultipleSeriesDataset dataSet;
private XYMultipleSeriesRenderer mRenderer;
public GraphicalView getView(final Context context) {
XYSeries series = new XYSeries(context.getResources().getString(R.string.fcChart_TitleLable));
this.dataSet = new XYMultipleSeriesDataset(); // collection of series under one object.,there could any
this.dataSet.addSeries(series); // number of series
//customization of the chart
XYSeriesRenderer renderer = new XYSeriesRenderer(); // one renderer for one series
renderer.setColor(Color.RED);
renderer.setDisplayChartValues(false);
renderer.setLineWidth(2f);
this.mRenderer = new XYMultipleSeriesRenderer();
this.mRenderer.addSeriesRenderer(renderer);
this.mRenderer.setMargins(new int[] { 60, 80, 60, 60 }); // top, left, bottom, right
this.mRenderer.setShowLegend(true);
this.mRenderer.setAntialiasing(true);
this.mRenderer.setLabelsColor(Color.BLACK);
// Beschriftungen
this.mRenderer.setChartTitle(context.getResources().getString(R.string.fcChart_Title));
this.mRenderer.setChartTitleTextSize(30);
this.mRenderer.setAxisTitleTextSize(30);
this.mRenderer.setLegendTextSize(30);
this.mRenderer.setLabelFormat(new DecimalFormat("0.##"));
this.mRenderer.setLabelsTextSize(15);
this.mRenderer.setXTitle(context.getResources().getString(R.string.fcChart_TitleXAxis));
this.mRenderer.setXLabelsColor(Color.DKGRAY);
this.mRenderer.setYTitle(context.getResources().getString(R.string.fcChart_TitleYAxis));
this.mRenderer.setYLabelsPadding(20);
this.mRenderer.setYLabelsVerticalPadding(-5);
this.mRenderer.setYLabelsColor(0, Color.DKGRAY);
// Zoom ausschalten
this.mRenderer.setZoomEnabled(false, false);
this.mRenderer.setZoomButtonsVisible(false);
// Grid
this.mRenderer.setShowGridX(true);
this.mRenderer.setShowGridY(true);
this.mRenderer.setGridColor(Color.DKGRAY);
// X/Y-Achsen
this.mRenderer.setShowAxes(true);
this.mRenderer.setAxesColor(Color.DKGRAY);
// Hintergrundfarbe
this.mRenderer.setApplyBackgroundColor(true);
this.mRenderer.setBackgroundColor(context.getResources().getColor(R.color.qrt_translucent_white));
this.mRenderer.setMarginsColor(Color.WHITE);
// Verschiebungen ausschalten
this.mRenderer.setPanEnabled(false, false);
GraphicalView v = ChartFactory.getLineChartView(context, this.dataSet, this.mRenderer);
return v;
}
/**
* @return the dataSet
*/
public XYMultipleSeriesDataset getDataSet() {
return this.dataSet;
}
/**
* @return the mRenderer
*/
public XYMultipleSeriesRenderer getMultiRenderer() {
return this.mRenderer;
}
public void updateRendererAfterCalculation(final Double shootingDistance, final Double[][] flightCurve) {
Double deltaH;
Double dy;
Double rangeY;
int xLbls = 1;
int yLbls = 1;
Double minH = 0.0;
Double maxH = 0.0;
// X-Achse
if (shootingDistance <= 18d) {
xLbls = (int) Math.round(shootingDistance);
} else if (shootingDistance <= 30d) {
xLbls = (int) Math.round(shootingDistance) / 2;
} else if (shootingDistance <= 90d) {
xLbls = (int) Math.round(shootingDistance) / 5;
} else {
xLbls = (int) Math.round(shootingDistance) / 10;
}
this.mRenderer.setXLabels(xLbls);
// Y-Achse
for (int i = 0; i < flightCurve.length; i++) {
if (flightCurve[i][TrajectoryCalculator.IDX_Y] > maxH) {
maxH = flightCurve[i][TrajectoryCalculator.IDX_Y];
}
}
minH = maxH;
for (int i = 0; i < flightCurve.length; i++) {
if (flightCurve[i][TrajectoryCalculator.IDX_Y] < minH) {
minH = flightCurve[i][TrajectoryCalculator.IDX_Y];
}
}
deltaH = maxH - minH;
if (deltaH <= shootingDistance / 10) {
dy = (shootingDistance / 10 - deltaH) / 2;
rangeY = shootingDistance / 10;
} else if (deltaH <= shootingDistance / 5) {
dy = (shootingDistance / 5 - deltaH) / 2;
rangeY = shootingDistance / 5;
} else {
dy = (deltaH + shootingDistance * 0.1) / 2;
rangeY = deltaH + shootingDistance * 0.1;
}
if (rangeY <= 3d) {
yLbls = 10;
} else if (rangeY <= 6d) {
yLbls = 12;
} else if (rangeY <= 9d) {
yLbls = 18;
} else {
yLbls = 20;
}
this.mRenderer.setYLabels(yLbls);
this.mRenderer.setYAxisMin(minH - dy);
this.mRenderer.setYAxisMax(maxH + dy);
}
}

+ 63
- 0
app/src/main/java/ch/spherIC/recurvebowsight/components/FontTextView.java ファイルの表示

@@ -0,0 +1,63 @@
/**
* Copyright (C) 2012 - Florindo Smilari (spherIC)
*/
package ch.spherIC.recurvebowsight.components;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.TextView;
/**
* Siehe http://stackoverflow.com/questions/2376250/custom-fonts-and-xml-layouts-android.
*
* @author FC Smilari
*/
@SuppressLint("AppCompatCustomView")
public class FontTextView extends TextView {
private static final String TAG = "TextView";
public FontTextView(final Context context) {
super(context);
}
public FontTextView(final Context context, final AttributeSet attrs) {
super(context, attrs);
setFont(context, attrs);
}
public FontTextView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
setFont(context, attrs);
}
private void setFont(final Context ctx, final AttributeSet attrs) {
/*if (!isInEditMode()) {
TypedArray a = ctx.obtainStyledAttributes(attrs, R.styleable.FontTextView);
String font = a.getString(R.styleable.FontTextView_font);
if (font != null && !font.isEmpty()) {
setFont(ctx, font);
}
a.recycle();
}*/
}
public boolean setFont(final Context ctx, final String font) {
Typeface tf = null;
try {
tf = Typeface.createFromAsset(ctx.getAssets(), font);
} catch (final Exception e) {
Log.e(TAG, "Could not get typeface: " + e.getMessage());
return false;
}
setTypeface(tf);
return true;
}
}

+ 171
- 0
app/src/main/java/ch/spherIC/recurvebowsight/components/XTextView.java ファイルの表示

@@ -0,0 +1,171 @@
/*
* $URL$
* $Revision$
* $LastChangedBy$
* $LastChangedDate$
*
* Copyright (c) 2011 spherIC, Switzerland
* All rights reserved.
*
* This software is the confidential and proprietary information
* of spherIC. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only
* in accordance with the terms of the license agreement you
* entered into with spherIC.
*/
package ch.spherIC.recurvebowsight.components;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.view.MotionEvent;
import ch.spherIC.recurvebowsight.R;
/**
* DOCUMENT ME!
*
* @author $author$
* @version $Revision$, $Date$
*/
public class XTextView extends FontTextView {
private boolean drawborder;
private int drawborderColor;
private int drawborderWidth;
/**
* Creates a new XTextView object.
*
* @param context DOCUMENT ME!
*/
public XTextView(final Context context) {
super(context);
}
/**
* Creates a new $class.name$ object.
*
* @param context DOCUMENT ME!
* @param attrs DOCUMENT ME!
* @param defStyle DOCUMENT ME!
*/
public XTextView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
init(attrs);
}
/**
* Creates a new $class.name$ object.
*
* @param context DOCUMENT ME!
* @param attrs DOCUMENT ME!
*/
public XTextView(final Context context, final AttributeSet attrs) {
super(context, attrs);
init(attrs);
}
/**
* DOCUMENT ME!
*
* @param attrs DOCUMENT ME!
*/
private void init(final AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.XTextView);
this.drawborder = a.getBoolean(R.styleable.XTextView_drawBorder, false);
this.drawborderColor = a.getColor(R.styleable.XTextView_drawBorderColor, 0xffff0000);
this.drawborderWidth = a.getDimensionPixelSize(R.styleable.XTextView_drawBorderWidth, 1);
if (this.drawborder) {
setPadding(getPaddingLeft() + this.drawborderWidth, getPaddingTop() + this.drawborderWidth, getPaddingRight() + this.drawborderWidth,
getPaddingBottom() + this.drawborderWidth);
}
a.recycle();
}
/**
* @see android.widget.TextView#onDraw(Canvas)
*/
@Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
if (this.drawborder) {
Rect rect = new Rect();
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setColor(this.drawborderColor);
paint.setStrokeWidth(this.drawborderWidth);
getLocalVisibleRect(rect);
rect.bottom -= 1;
rect.right -= 1;
canvas.drawRect(rect, paint);
}
}
/**
* @param drawborderColor the drawborderColor to set
*/
public void setDrawborderColor(final int drawborderColor) {
this.drawborderColor = drawborderColor;
invalidate();
}
/**
* @return the drawborder
*/
public boolean isDrawborder() {
return this.drawborder;
}
/**
* @param drawborder the drawborder to set
*/
public void setDrawborder(final boolean drawborder) {
this.drawborder = drawborder;
invalidate();
}
/**
* @return the drawborderWidth
*/
public int getDrawborderWidth() {
return this.drawborderWidth;
}
/**
* @param drawborderWidth the drawborderWidth to set
*/
public void setDrawborderWidth(final int drawborderWidth) {
this.drawborderWidth = drawborderWidth;
invalidate();
}
/**
* @return the drawborderColor
*/
public int getDrawborderColor() {
return this.drawborderColor;
}
public void doSingleTouch() {
long now = SystemClock.uptimeMillis();
MotionEvent evtDwn = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, 0, 0, 0);
MotionEvent evtUp = MotionEvent.obtain(now, now + 1, MotionEvent.ACTION_UP, 0, 0, 0);
dispatchTouchEvent(evtDwn);
dispatchTouchEvent(evtUp);
evtDwn.recycle();
evtUp.recycle();
}
}

+ 67
- 0
app/src/main/java/ch/spherIC/recurvebowsight/logic/BallisticResults.java ファイルの表示

@@ -0,0 +1,67 @@
package ch.spherIC.recurvebowsight.logic;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
@SuppressLint("ParcelCreator")
public class BallisticResults implements Parcelable {
private Double[][] flightCurve;
private Double startAngle;
/**
* Constructor for ballistic results.
*
* @param flightCurve flight curve values array
* @param startAngle flight curve start angle
* @param maxHCurve max height of flight curve
*/
public BallisticResults(Double[][] flightCurve, Double startAngle, Double[] maxHCurve) {
this.flightCurve = flightCurve;
this.startAngle = startAngle;
this.maxHCurve = maxHCurve;
}
public Double[][] getFlightCurve() {
return flightCurve;
}
public void setFlightCurve(Double[][] flightCurve) {
this.flightCurve = flightCurve;
}
public Double getStartAngle() {
return startAngle;
}
public void setStartAngle(Double startAngle) {
this.startAngle = startAngle;
}
public Double[] getMaxHCurve() {
return maxHCurve;
}
public void setMaxHCurve(Double[] maxHCurve) {
this.maxHCurve = maxHCurve;
}
private Double[] maxHCurve;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
if (startAngle == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeDouble(startAngle);
}
}
}

+ 3
- 3
app/src/main/java/ch/spherIC/recurvebowsight/logic/CalculationTask.java ファイルの表示

@@ -26,7 +26,7 @@ public class CalculationTask extends AsyncTask<TrajectoryCalculator, Integer, Tr
Double[][] results;
Double frictionCoefficient = this.calculator.calculateFrictionCoeficient();
// Startwerte für angleLow und angleHigh berechnen
// Startwerte fuer angleLow und angleHigh berechnen
do {
angleLow -= PHI;
results = this.calculator.calculateTrajectory(angleLow, frictionCoefficient);
@@ -42,7 +42,6 @@ public class CalculationTask extends AsyncTask<TrajectoryCalculator, Integer, Tr
// Winkel suchen mit Hilfe der Regula Falsi und Flugbahnberechnungsiterationen
do {
angleX = (angleHigh + angleLow) / 2;
results = this.calculator.calculateTrajectory(angleX, frictionCoefficient);
@@ -101,7 +100,8 @@ public class CalculationTask extends AsyncTask<TrajectoryCalculator, Integer, Tr
@Override
protected void onPostExecute(final TrajectoryCalculator calculator) {
super.onPostExecute(calculator);
calculator.getListener().onCalculationDone(calculator.getFlightCurve(), calculator.getStartAngle(), calculator.getMaxHCurve());
BallisticResults ballisticResults = new BallisticResults(calculator.getFlightCurve(), calculator.getStartAngle(), calculator.getMaxHCurve());
calculator.getListener().onCalculationDone(ballisticResults);
}
private void sleep(final long millis) {

app/src/main/java/ch/spherIC/recurvebowsight/TrajectoryCalculation.java → app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculation.java ファイルの表示

@@ -1,12 +1,12 @@
/**
* Copyright (C) 2022 - Florindo Smilari (spherIC)
*/
package ch.spherIC.recurvebowsight;
package ch.spherIC.recurvebowsight.logic;
public interface TrajectoryCalculation {
void updateTrajectoryTxtFld(Integer step, Double[] flightCurveRow, Double startAngle, Double[] maxHCurve);
void onCalculationDone(Double[][] flightCurve, Double startAngle, Double[] maxHCurve);
void onCalculationDone(BallisticResults ballisticResults);
}

+ 0
- 2
app/src/main/java/ch/spherIC/recurvebowsight/logic/TrajectoryCalculator.java ファイルの表示

@@ -6,8 +6,6 @@ package ch.spherIC.recurvebowsight.logic;
import java.util.ArrayList;
import java.util.List;
import ch.spherIC.recurvebowsight.TrajectoryCalculation;
public class TrajectoryCalculator {

+ 16
- 10
app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java ファイルの表示

@@ -16,15 +16,17 @@ import android.widget.AutoCompleteTextView;
import android.widget.Toast;

import java.text.DecimalFormat;
import java.util.stream.Stream;

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.BallisticResults;
import ch.spherIC.recurvebowsight.logic.CalculationTask;
import ch.spherIC.recurvebowsight.logic.TrajectoryCalculation;
import ch.spherIC.recurvebowsight.logic.TrajectoryCalculator;
import ch.spherIC.recurvebowsight.model.IArcherySetup;
import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter;
@@ -44,13 +46,9 @@ public class CalculateSightParametersFragment extends Fragment implements Trajec
this.binding = FragmentCalcsightParametersBinding.inflate(inflater, container, false);
View root = binding.getRoot();

binding.fabCalculate.setOnClickListener(new View.OnClickListener() {
this.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();
}
@@ -201,19 +199,27 @@ public class CalculateSightParametersFragment extends Fragment implements Trajec

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

Bundle bundle = new Bundle();
bundle.putInt("step", step);
bundle.putDoubleArray("flightCurveRow", Stream.of(flightCurveRow).mapToDouble(Double::doubleValue).toArray());
bundle.putDouble("startAngle", startAngle);
bundle.putDoubleArray("maxHCurve", Stream.of(maxHCurve).mapToDouble(Double::doubleValue).toArray());
getParentFragmentManager().setFragmentResult("updateTrajectory", bundle);
}

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

Bundle bundle = new Bundle();
bundle.putParcelable("ballisticResults", ballisticResults);
getParentFragmentManager().setFragmentResult("ballisticResults", bundle);

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

}
}

+ 131
- 2
app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightTrajectoryFragment.java ファイルの表示

@@ -4,27 +4,83 @@
package ch.spherIC.recurvebowsight.ui.calcsight;

import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.TabStopSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import org.achartengine.GraphicalView;
import org.achartengine.model.XYSeries;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentResultListener;
import androidx.lifecycle.ViewModelProvider;
import ch.spherIC.recurvebowsight.R;
import ch.spherIC.recurvebowsight.components.FlightCurveChart;
import ch.spherIC.recurvebowsight.components.XTextView;
import ch.spherIC.recurvebowsight.databinding.FragmentCalcsightTrajectoryBinding;
import ch.spherIC.recurvebowsight.logic.BallisticResults;
import ch.spherIC.recurvebowsight.logic.TrajectoryCalculator;

public class CalculateSightTrajectoryFragment extends Fragment {

public static final DecimalFormat DF = new DecimalFormat("0.##");
public static final DecimalFormat DF_FC = new DecimalFormat("0.000");
public static final DecimalFormat DF_1 = new DecimalFormat("0.00");
public static final DecimalFormat DF_EVS = new DecimalFormat("0.#");

private FragmentCalcsightTrajectoryBinding binding;
private FlightCurveChart flightCurveChart;
private XTextView flightCurveTxtFld;

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}

public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
CalculateSightTrajectoryViewModel calculateSightTrajectoryViewModel = new ViewModelProvider(this).get(CalculateSightTrajectoryViewModel.class);
binding = FragmentCalcsightTrajectoryBinding.inflate(inflater, container, false);
View root = binding.getRoot();
this.flightCurveTxtFld = (XTextView) root.findViewById(R.id.flightCurveTxtFld);

GraphicalView flightCurveChartView;
LinearLayout layout;
this.flightCurveChart = new FlightCurveChart();
flightCurveChartView = this.flightCurveChart.getView(root.getContext());
layout = (LinearLayout) root.findViewById(R.id.ballisticResults);
layout.addView(flightCurveChartView, 0, new LinearLayout.LayoutParams(ViewGroup.MarginLayoutParams.MATCH_PARENT, 0, 1f));

getParentFragmentManager().setFragmentResultListener("ballisticResults", this, new FragmentResultListener() {
@Override
public void onFragmentResult(@NonNull String requestKey, @NonNull Bundle bundle) {
BallisticResults ballisticResults = bundle.getParcelable("ballisticResults");
updateFlightCurveChart(ballisticResults.getFlightCurve());
}
});

getParentFragmentManager().setFragmentResultListener("updateTrajectory", this, new FragmentResultListener() {
@Override
public void onFragmentResult(@NonNull String requestKey, @NonNull Bundle bundle) {
int step = bundle.getInt("step");
double[] flightCurveRow = bundle.getDoubleArray("flightCurveRow");
double startAngle = bundle.getDouble("startAngle");
double[] maxHCurve = bundle.getDoubleArray("maxHCurve");
updateTrajectoryTxtFld(step, convert(flightCurveRow), startAngle, convert(maxHCurve));
}
});

final TextView textView = binding.textCalcsightTrajectory;
calculateSightTrajectoryViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
return root;
}

@@ -33,4 +89,77 @@ public class CalculateSightTrajectoryFragment extends Fragment {
super.onDestroyView();
binding = null;
}

private Double[] convert(double[] values) {
return Arrays.stream(values).boxed().collect(Collectors.toCollection(ArrayList::new)).toArray(new Double[]{});
}

/**
* Updates the graph.
*
* @param flightCurve values to draw the flight curve
*/
private void updateFlightCurveChart(final Double[][] flightCurve) {

XYSeries series = new XYSeries(this.binding.getRoot().getResources().getString(R.string.fcChart_TitleLable));

for (int i = 0; i < flightCurve.length; i++) {
series.add(flightCurve[i][TrajectoryCalculator.IDX_X], flightCurve[i][TrajectoryCalculator.IDX_Y]);
}

this.flightCurveChart.getDataSet().removeSeries(0);
this.flightCurveChart.getDataSet().addSeries(0, series);
this.flightCurveChart.updateRendererAfterCalculation(flightCurve[flightCurve.length - 1][TrajectoryCalculator.IDX_X], flightCurve);
}

/**
* Updates the text table field.
*
* @param flightCurveRow values to text one flight curve row
* @param startAngle the start angle to display
* @param maxHCurve max values of the flight curve
*/
private void updateTrajectoryTxtFld(final Integer step, final Double[] flightCurveRow, final Double startAngle, final Double[] maxHCurve) {
int width = this.flightCurveTxtFld.getMeasuredWidth();
Double[] r1 = flightCurveRow;

switch (step) {
case 0:
TextView arrowNockHeightTxtFld = (TextView) getParentFragment().getView().findViewById(R.id.arrowNockHeightTxt);
this.flightCurveTxtFld.setText("");
this.flightCurveTxtFld.append(getResources().getString(R.string.fcChart_StartAngle) + DF_FC.format(startAngle) + " °\n\n");
this.flightCurveTxtFld.append(getResources().getString(R.string.fcChart_MaxHeight) + DF_FC.format(maxHCurve[0])
+ " m / "
+ DF_FC.format(maxHCurve[0] + Double.valueOf(arrowNockHeightTxtFld.getText().toString().trim()))
+ " m, [t = " + DF_FC.format(maxHCurve[1]) + " s]\n\n");
this.flightCurveTxtFld.append(getResources().getString(R.string.fcChart_FlightDuration)
+ DF_FC.format(r1[TrajectoryCalculator.IDX_T])
+ " sec\n\n");


SpannableString line = new SpannableString("t [sec]\tVx [m/s]\tVy [m/s]\tx [m]\ty [m]\n\n");
line.setSpan(new TabStopSpan.Standard(width / 5), 0, line.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
line.setSpan(new TabStopSpan.Standard(width / 5 * 2), 0, line.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
line.setSpan(new TabStopSpan.Standard(width / 5 * 3), 0, line.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
line.setSpan(new TabStopSpan.Standard(width / 5 * 4), 0, line.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
this.flightCurveTxtFld.append(line);
break;

case 1:
line = new SpannableString(DF_FC.format(r1[TrajectoryCalculator.IDX_T]) + '\t'
+ DF_FC.format(r1[TrajectoryCalculator.IDX_VX]) + '\t'
+ DF_FC.format(r1[TrajectoryCalculator.IDX_VY]) + '\t'
+ DF_FC.format(r1[TrajectoryCalculator.IDX_X]) + '\t'
+ DF_FC.format(r1[TrajectoryCalculator.IDX_Y]) + "\n");
line.setSpan(new TabStopSpan.Standard(width / 5), 0, line.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
line.setSpan(new TabStopSpan.Standard(width / 5 * 2), 0, line.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
line.setSpan(new TabStopSpan.Standard(width / 5 * 3), 0, line.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
line.setSpan(new TabStopSpan.Standard(width / 5 * 4), 0, line.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
this.flightCurveTxtFld.append(line);
break;

default:
break;
}
}
}

+ 28
- 22
app/src/main/res/layout/fragment_calcsight_trajectory.xml ファイルの表示

@@ -1,32 +1,38 @@
<?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"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ballisticResults"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.calcsight.CalculateSightParametersFragment">

<TextView
android:id="@+id/text_calcsight_trajectory"
<ScrollView
android:id="@+id/flightCurveScrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_marginTop="4dp"
android:layout_weight="1"
android:scrollbars="vertical">

<ch.spherIC.recurvebowsight.components.XTextView
android:id="@+id/flightCurveTxtFld"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="8dp"
android:background="@color/white"
android:ems="10"
android:inputType="textMultiLine"
android:padding="4dp"
android:textColor="@color/black"
android:textSize="14sp"
app:drawBorder="false"
app:drawBorderColor="@color/semi_translucent_black"
app:drawBorderWidth="2dp" />

</ScrollView>

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_calcsight_trajectory" />

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

+ 7
- 1
app/src/main/res/values-de/strings.xml ファイルの表示

@@ -82,7 +82,6 @@
<string name="asNockRaising">Nockpunktüberhöhung [mm]</string>
<string name="asBraceHeight">Standhöhe [mm]</string>
<string name="caption_Ok">OK</string>
<string name="caption_Cancel">Abbrechen</string>
<string name="caption_New">Neu</string>
@@ -101,5 +100,12 @@
<string name="caption_Cfg_UpdateSuccessful">\'%s\' erfolgreich geändert!</string>
<string name="caption_Calculating">Berechnung läuft&#8230;</string>
<string name="fcChart_StartAngle">Abschusswinkel:\n</string>
<string name="fcChart_MaxHeight">Max. Höhe der Flugbahn:\n</string>
<string name="fcChart_FlightDuration">Flugzeit:\n</string>
<string name="fcChart_Title">Ballistische Flugbahn</string>
<string name="fcChart_TitleLable">Flugbahn</string>
<string name="fcChart_TitleXAxis">Distanz [m]</string>
<string name="fcChart_TitleYAxis">Höhe [m]</string>
</resources>

+ 14
- 0
app/src/main/res/values/attr.xml ファイルの表示

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="XTextView">
<attr name="drawBorder" format="boolean" />
<attr name="drawBorderWidth" format="dimension" />
<attr name="drawBorderColor" format="color" />
</declare-styleable>
<declare-styleable name="FontTextView">
<!-- <attr name="font" format="string" />-->
</declare-styleable>
</resources>

+ 2
- 0
app/src/main/res/values/colors.xml ファイルの表示

@@ -7,4 +7,6 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="qrt_translucent_white">#BDFFFFFF</color>
<color name="semi_translucent_black">#80000000</color>
</resources>

+ 9
- 3
app/src/main/res/values/strings.xml ファイルの表示

@@ -12,7 +12,7 @@
<string name="title_activity_archery_setup_configuration">RBS Archery Setup Configuration</string>

<string name="menu_equipment">Equipment</string>
<string name="menu_about">About RBS...</string>
<string name="menu_about">About RBS&#8230;</string>
<string name="menu_userguide">User Guide</string>
<string name="menu_equipment_add">Manage Equipment</string>
<string name="menu_equipment_choose">Choose Equipment</string>
@@ -82,7 +82,6 @@
<string name="asNockRaising">Nock Raising [mm]</string>
<string name="asBraceHeight">Brace Height [mm]</string>


<string name="caption_Ok">OK</string>
<string name="caption_Cancel">Cancel</string>
<string name="caption_New">New</string>
@@ -100,5 +99,12 @@
<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>

<string name="fcChart_StartAngle">Elevation Angle:\n</string>
<string name="fcChart_MaxHeight">Max. Height of Trajectory:\n</string>
<string name="fcChart_FlightDuration">Flight Duration:\n</string>
<string name="fcChart_Title">Ballistic Trajectory</string>
<string name="fcChart_TitleLable">Trajectory</string>
<string name="fcChart_TitleXAxis">Distance [m]</string>
<string name="fcChart_TitleYAxis">Height [m]</string>
</resources>

読み込み中…
キャンセル
保存