| <PersistentState> | <PersistentState> | ||||
| <option name="values"> | <option name="values"> | ||||
| <map> | <map> | ||||
| <entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialiconsoutlined/calculate/outline_calculate_24.xml" /> | |||||
| <entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialiconsround/settings/round_settings_24.xml" /> | |||||
| </map> | </map> | ||||
| </option> | </option> | ||||
| </PersistentState> | </PersistentState> | ||||
| </option> | </option> | ||||
| <option name="values"> | <option name="values"> | ||||
| <map> | <map> | ||||
| <entry key="outputName" value="ic_icon_calculate" /> | |||||
| <entry key="outputName" value="ic_settings" /> | |||||
| <entry key="sourceFile" value="Z:\Work\Java Projects\Android\RecurveBowSight\FITA_Target_logo_round.svg" /> | <entry key="sourceFile" value="Z:\Work\Java Projects\Android\RecurveBowSight\FITA_Target_logo_round.svg" /> | ||||
| </map> | </map> | ||||
| </option> | </option> |
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_spheric_logo.xml" value="0.2825" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_spheric_logo.xml" value="0.2825" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/rbs_anim_splash_logo.xml" value="0.25" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/rbs_anim_splash_logo.xml" value="0.25" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/side_nav_bar.xml" value="0.285" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/side_nav_bar.xml" value="0.285" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_default_settings.xml" value="0.25" /> | |||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_equipment_configuration.xml" value="0.1994535519125683" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_equipment_configuration.xml" value="0.1994535519125683" /> | ||||
| <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_main.xml" value="0.28072916666666664" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_riser_configuration.xml" value="0.2" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/activity_riser_configuration.xml" value="0.2" /> |
| </component> | </component> | ||||
| <component name="ChangeListManager"> | <component name="ChangeListManager"> | ||||
| <list default="true" id="41369230-c648-4299-baf3-de5f13bcb18c" name="Changes" comment=""> | <list default="true" id="41369230-c648-4299-baf3-de5f13bcb18c" name="Changes" comment=""> | ||||
| <change afterPath="$PROJECT_DIR$/app/src/main/res/layout/simple_spinner_line.xml" afterDir="false" /> | |||||
| <change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/DefaultSettingsActivity.java" afterDir="false" /> | |||||
| <change afterPath="$PROJECT_DIR$/app/src/main/res/layout/activity_default_settings.xml" 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.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/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" /> | <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" /> | ||||
| <change beforePath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.lock" afterDir="false" /> | <change beforePath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.lock" afterDir="false" /> | ||||
| <change beforePath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/resourceHashesCache.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/resourceHashesCache.bin" afterDir="false" /> | <change beforePath="$PROJECT_DIR$/.gradle/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/buildOutputCleanup.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" afterDir="false" /> | ||||
| <change beforePath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" afterDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> | <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> | ||||
| <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | ||||
| <change beforePath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" afterDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/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/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/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/CalculateSightSightSettingFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightSightSettingFragment.java" afterDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightSightSettingViewModel.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightSightSettingViewModel.java" afterDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/utilities/NoFilterArrayAdapter.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/utilities/NoFilterArrayAdapter.java" afterDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_parameters.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_parameters.xml" afterDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_sightsetting.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_sightsetting.xml" afterDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_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/java/ch/spherIC/recurvebowsight/utilities/PlatformUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/utilities/PlatformUtils.java" afterDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/anim" beforeDir="true" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/anim/splashscreenicon.xml" beforeDir="false" /> | |||||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/menu/main.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/menu/main.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-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" /> | <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> | </list> | ||||
| <option name="SHOW_DIALOG" value="false" /> | <option name="SHOW_DIALOG" value="false" /> | ||||
| <key name="android.template.1734690915"> | <key name="android.template.1734690915"> | ||||
| <recent name="ch.spherIC.recurvebowsight.ui.configuration" /> | <recent name="ch.spherIC.recurvebowsight.ui.configuration" /> | ||||
| </key> | </key> | ||||
| <key name="android.template.-1206743600"> | |||||
| <recent name="ch.spherIC.recurvebowsight.ui.configuration" /> | |||||
| </key> | |||||
| <key name="MoveFile.RECENT_KEYS"> | <key name="MoveFile.RECENT_KEYS"> | ||||
| <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\res\drawable" /> | ||||
| <recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\res\anim" /> | <recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\res\anim" /> | ||||
| </line-breakpoint> | </line-breakpoint> | ||||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | <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> | <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java</url> | ||||
| <line>99</line> | |||||
| <line>102</line> | |||||
| <option name="timeStamp" value="116" /> | <option name="timeStamp" value="116" /> | ||||
| </line-breakpoint> | </line-breakpoint> | ||||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | ||||
| <line>96</line> | <line>96</line> | ||||
| <option name="timeStamp" value="122" /> | <option name="timeStamp" value="122" /> | ||||
| </line-breakpoint> | </line-breakpoint> | ||||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/RBSMainActivity.java</url> | |||||
| <line>70</line> | |||||
| <option name="timeStamp" value="125" /> | |||||
| </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>78</line> | |||||
| <option name="timeStamp" value="127" /> | |||||
| </line-breakpoint> | |||||
| </breakpoints> | </breakpoints> | ||||
| </breakpoint-manager> | </breakpoint-manager> | ||||
| <watches-manager> | <watches-manager> | ||||
| <configuration name="app"> | <configuration name="app"> | ||||
| <watch expression="this" /> | <watch expression="this" /> | ||||
| <watch expression="item.getTitle()" language="JAVA" /> | |||||
| <watch expression="sharedPreferences.getFloat(DEFAULT_SETTING_AIRTEMP, 0.0f)" language="JAVA" /> | |||||
| </configuration> | </configuration> | ||||
| </watches-manager> | </watches-manager> | ||||
| </component> | </component> |
| android:supportsRtl="true" | android:supportsRtl="true" | ||||
| android:theme="@style/Theme.RecurveBowSight" | android:theme="@style/Theme.RecurveBowSight" | ||||
| tools:targetApi="31"> | tools:targetApi="31"> | ||||
| <activity | |||||
| android:name=".ui.configuration.DefaultSettingsActivity" | |||||
| android:exported="false" /> | |||||
| <activity | <activity | ||||
| android:name=".ui.configuration.ArcherySetupConfigurationActivity" | android:name=".ui.configuration.ArcherySetupConfigurationActivity" | ||||
| android:exported="false" /> | android:exported="false" /> |
| */ | */ | ||||
| package ch.spherIC.recurvebowsight; | package ch.spherIC.recurvebowsight; | ||||
| import android.content.Intent; | |||||
| import android.os.Bundle; | import android.os.Bundle; | ||||
| import android.view.Menu; | import android.view.Menu; | ||||
| import android.view.MenuItem; | |||||
| import com.google.android.material.navigation.NavigationView; | import com.google.android.material.navigation.NavigationView; | ||||
| import androidx.annotation.NonNull; | |||||
| import androidx.appcompat.app.AppCompatActivity; | import androidx.appcompat.app.AppCompatActivity; | ||||
| import androidx.core.splashscreen.SplashScreen; | import androidx.core.splashscreen.SplashScreen; | ||||
| import androidx.drawerlayout.widget.DrawerLayout; | import androidx.drawerlayout.widget.DrawerLayout; | ||||
| import androidx.navigation.ui.NavigationUI; | import androidx.navigation.ui.NavigationUI; | ||||
| import ch.spherIC.recurvebowsight.database.RBSDatabaseHelper; | import ch.spherIC.recurvebowsight.database.RBSDatabaseHelper; | ||||
| import ch.spherIC.recurvebowsight.databinding.ActivityMainBinding; | import ch.spherIC.recurvebowsight.databinding.ActivityMainBinding; | ||||
| import ch.spherIC.recurvebowsight.ui.configuration.DefaultSettingsActivity; | |||||
| import ch.spherIC.recurvebowsight.utilities.UnitConverter; | import ch.spherIC.recurvebowsight.utilities.UnitConverter; | ||||
| public class RBSMainActivity extends AppCompatActivity { | public class RBSMainActivity extends AppCompatActivity { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @Override | |||||
| public boolean onOptionsItemSelected(@NonNull MenuItem item) { | |||||
| switch (item.getItemId()) { | |||||
| case R.id.action_settings: | |||||
| Intent defaultSettingsActivityIntent = new Intent(this.binding.getRoot().getContext(), DefaultSettingsActivity.class); | |||||
| startActivity(defaultSettingsActivityIntent); | |||||
| return true; | |||||
| default: | |||||
| return super.onOptionsItemSelected(item); | |||||
| } | |||||
| } | |||||
| @Override | @Override | ||||
| public boolean onSupportNavigateUp() { | public boolean onSupportNavigateUp() { | ||||
| NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main); | NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main); |
| import android.app.ProgressDialog; | import android.app.ProgressDialog; | ||||
| import android.content.Context; | import android.content.Context; | ||||
| import android.content.SharedPreferences; | |||||
| import android.os.Bundle; | import android.os.Bundle; | ||||
| import android.text.Editable; | import android.text.Editable; | ||||
| import android.view.Gravity; | import android.view.Gravity; | ||||
| if (getParentFragment() != null && getParentFragment().getArguments() != null && getParentFragment().getArguments().containsKey("setup")) { | if (getParentFragment() != null && getParentFragment().getArguments() != null && getParentFragment().getArguments().containsKey("setup")) { | ||||
| IArcherySetup archerySetup = getParentFragment().getArguments().getParcelable("setup"); | IArcherySetup archerySetup = getParentFragment().getArguments().getParcelable("setup"); | ||||
| this.calculateSightViewModel.setSelectedArcherySetup(archerySetup); | this.calculateSightViewModel.setSelectedArcherySetup(archerySetup); | ||||
| loadDefaultValues(); | |||||
| Bundle bundle = new Bundle(); | Bundle bundle = new Bundle(); | ||||
| bundle.putParcelable("selectedArcherySetup", archerySetup); | bundle.putParcelable("selectedArcherySetup", archerySetup); | ||||
| getParentFragmentManager().setFragmentResult("selectedArcherySetup", bundle); | getParentFragmentManager().setFragmentResult("selectedArcherySetup", bundle); | ||||
| this.binding.deltaTimeTxt.setText(calcAccuracyToSet); | this.binding.deltaTimeTxt.setText(calcAccuracyToSet); | ||||
| } | } | ||||
| private void loadDefaultValues() { | |||||
| SharedPreferences sharedPreferences = this.binding.getRoot().getContext().getSharedPreferences(PlatformUtils.DEFAULT_SETTINGS_PREF, Context.MODE_PRIVATE); | |||||
| if (sharedPreferences != null) { | |||||
| this.calculateSightViewModel.setAirTemperature((double) sharedPreferences.getFloat(PlatformUtils.DEFAULT_SETTING_AIRTEMP, 0.0f)); | |||||
| this.calculateSightViewModel.setRelativeAirHumidity((double) sharedPreferences.getFloat(PlatformUtils.DEFAULT_SETTING_RELAIRHUMIDITY, 0.0f)); | |||||
| this.calculateSightViewModel.setShootingDistance((double) sharedPreferences.getFloat(PlatformUtils.DEFAULT_SETTING_SHOOTINGDIST, 0.0f)); | |||||
| } | |||||
| } | |||||
| } | } |
| package ch.spherIC.recurvebowsight.ui.configuration; | |||||
| import android.content.SharedPreferences; | |||||
| import android.os.Bundle; | |||||
| import android.view.MenuItem; | |||||
| import android.view.View; | |||||
| import android.widget.EditText; | |||||
| import java.text.DecimalFormat; | |||||
| import androidx.annotation.NonNull; | |||||
| import androidx.appcompat.app.AppCompatActivity; | |||||
| import ch.spherIC.recurvebowsight.R; | |||||
| import ch.spherIC.recurvebowsight.databinding.ActivityDefaultSettingsBinding; | |||||
| import ch.spherIC.recurvebowsight.utilities.PlatformUtils; | |||||
| public class DefaultSettingsActivity extends AppCompatActivity { | |||||
| public static final DecimalFormat DF = new DecimalFormat("0.#"); | |||||
| private ActivityDefaultSettingsBinding binding; | |||||
| private EditText defaultAirTemp; | |||||
| private EditText defaultRelAirHumidity; | |||||
| private EditText defaultShootingDistance; | |||||
| @Override | |||||
| protected void onCreate(Bundle savedInstanceState) { | |||||
| super.onCreate(savedInstanceState); | |||||
| setContentView(R.layout.activity_default_settings); | |||||
| getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |||||
| getSupportActionBar().setTitle(R.string.caption_Cfg_DefaultValues_Title); | |||||
| this.binding = ActivityDefaultSettingsBinding.bind(findViewById(R.id.activity_default_settings)); | |||||
| this.binding.defauButtonSave.setOnClickListener(new View.OnClickListener() { | |||||
| @Override | |||||
| public void onClick(View v) { | |||||
| saveDefaultValues(); | |||||
| } | |||||
| }); | |||||
| loadDefaultValues(); | |||||
| } | |||||
| @Override | |||||
| public boolean onOptionsItemSelected(@NonNull MenuItem item) { | |||||
| switch (item.getItemId()) { | |||||
| case android.R.id.home: | |||||
| this.finish(); | |||||
| return true; | |||||
| } | |||||
| return super.onOptionsItemSelected(item); | |||||
| } | |||||
| private void loadDefaultValues() { | |||||
| SharedPreferences sharedPreferences = getSharedPreferences(PlatformUtils.DEFAULT_SETTINGS_PREF, MODE_PRIVATE); | |||||
| if (sharedPreferences != null) { | |||||
| this.binding.airTemperatureTxt.setText(getFloatStingVal(sharedPreferences.getFloat(PlatformUtils.DEFAULT_SETTING_AIRTEMP, 0.0f))); | |||||
| this.binding.airRelativeHumidityTxt.setText(getFloatStingVal(sharedPreferences.getFloat(PlatformUtils.DEFAULT_SETTING_RELAIRHUMIDITY, 0.0f))); | |||||
| this.binding.shootingDistanzTxt.setText(getFloatStingVal(sharedPreferences.getFloat(PlatformUtils.DEFAULT_SETTING_SHOOTINGDIST, 0.0f))); | |||||
| } | |||||
| } | |||||
| private void saveDefaultValues() { | |||||
| SharedPreferences sharedPreferences = getSharedPreferences(PlatformUtils.DEFAULT_SETTINGS_PREF, MODE_PRIVATE); | |||||
| if (sharedPreferences != null) { | |||||
| SharedPreferences.Editor editor = sharedPreferences.edit(); | |||||
| editor.putFloat(PlatformUtils.DEFAULT_SETTING_AIRTEMP, Float.parseFloat(this.binding.airTemperatureTxt.getText().toString())); | |||||
| editor.putFloat(PlatformUtils.DEFAULT_SETTING_RELAIRHUMIDITY, Float.parseFloat(this.binding.airRelativeHumidityTxt.getText().toString())); | |||||
| editor.putFloat(PlatformUtils.DEFAULT_SETTING_SHOOTINGDIST, Float.parseFloat(this.binding.shootingDistanzTxt.getText().toString())); | |||||
| editor.commit(); | |||||
| } | |||||
| } | |||||
| private String getFloatStingVal(float val) { | |||||
| return val == 0.0 ? "" : DF.format(val); | |||||
| } | |||||
| } |
| import android.view.Gravity; | import android.view.Gravity; | ||||
| import android.widget.Toast; | import android.widget.Toast; | ||||
| import java.text.DecimalFormat; | |||||
| import ch.spherIC.recurvebowsight.R; | import ch.spherIC.recurvebowsight.R; | ||||
| */ | */ | ||||
| public class PlatformUtils { | public class PlatformUtils { | ||||
| // public static int platformSelectionColor; | |||||
| /* public static int getPlatformSelectionColor(final Context ctx) { | |||||
| Bitmap bitmap = BitmapFactory.decodeResource(ctx.getResources(), android.R.drawable.list_selector_background); | |||||
| int redBucket = 0; | |||||
| int greenBucket = 0; | |||||
| int blueBucket = 0; | |||||
| int pixelCount = 0; | |||||
| if (bitmap != null) { | |||||
| for (int y = 0; y < bitmap.getHeight(); y++) { | |||||
| for (int x = 0; x < bitmap.getWidth(); x++) { | |||||
| int c = bitmap.getPixel(x, y); | |||||
| pixelCount++; | |||||
| redBucket += Color.red(c); | |||||
| greenBucket += Color.green(c); | |||||
| blueBucket += Color.blue(c); | |||||
| // does alpha matter? | |||||
| } | |||||
| } | |||||
| platformSelectionColor = Color.rgb(redBucket / pixelCount, greenBucket / pixelCount, blueBucket / pixelCount); | |||||
| return platformSelectionColor; | |||||
| } | |||||
| return 0; | |||||
| }*/ | |||||
| public static final String DEFAULT_SETTINGS_PREF = "DefaultSettings"; | |||||
| public static final String DEFAULT_SETTING_AIRTEMP = "airTemperature"; | |||||
| public static final String DEFAULT_SETTING_RELAIRHUMIDITY = "relAirHumidity"; | |||||
| public static final String DEFAULT_SETTING_SHOOTINGDIST = "shootingDistance"; | |||||
| private static final DecimalFormat DF_1 = new DecimalFormat("0.#"); | |||||
| public static Double parseDouble(String doubleVal) { | public static Double parseDouble(String doubleVal) { | ||||
| if (!TextUtils.isEmpty(doubleVal)) { | if (!TextUtils.isEmpty(doubleVal)) { | ||||
| return toast; | return toast; | ||||
| } | } | ||||
| } | } |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <set> | |||||
| </set> |
| <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.5,12c0,-0.23 -0.01,-0.45 -0.03,-0.68l1.86,-1.41c0.4,-0.3 0.51,-0.86 0.26,-1.3l-1.87,-3.23c-0.25,-0.44 -0.79,-0.62 -1.25,-0.42l-2.15,0.91c-0.37,-0.26 -0.76,-0.49 -1.17,-0.68l-0.29,-2.31C14.8,2.38 14.37,2 13.87,2h-3.73C9.63,2 9.2,2.38 9.14,2.88L8.85,5.19c-0.41,0.19 -0.8,0.42 -1.17,0.68L5.53,4.96c-0.46,-0.2 -1,-0.02 -1.25,0.42L2.41,8.62c-0.25,0.44 -0.14,0.99 0.26,1.3l1.86,1.41C4.51,11.55 4.5,11.77 4.5,12s0.01,0.45 0.03,0.68l-1.86,1.41c-0.4,0.3 -0.51,0.86 -0.26,1.3l1.87,3.23c0.25,0.44 0.79,0.62 1.25,0.42l2.15,-0.91c0.37,0.26 0.76,0.49 1.17,0.68l0.29,2.31C9.2,21.62 9.63,22 10.13,22h3.73c0.5,0 0.93,-0.38 0.99,-0.88l0.29,-2.31c0.41,-0.19 0.8,-0.42 1.17,-0.68l2.15,0.91c0.46,0.2 1,0.02 1.25,-0.42l1.87,-3.23c0.25,-0.44 0.14,-0.99 -0.26,-1.3l-1.86,-1.41C19.49,12.45 19.5,12.23 19.5,12zM12.04,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5s3.5,1.57 3.5,3.5S13.97,15.5 12.04,15.5z"/> | |||||
| </vector> |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
| xmlns:tools="http://schemas.android.com/tools" | |||||
| android:id="@+id/activity_default_settings" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent" | |||||
| tools:context=".ui.configuration.DefaultSettingsActivity"> | |||||
| <Button | |||||
| android:id="@+id/defau_button_save" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginEnd="8dp" | |||||
| android:layout_marginTop="24dp" | |||||
| android:layout_weight="1" | |||||
| android:text="@string/caption_Save" | |||||
| android:textSize="12sp" | |||||
| app:icon="@drawable/ic_icon_save" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintTop_toBottomOf="@+id/shootingDistanzLayout" /> | |||||
| <TextView | |||||
| android:id="@+id/defaultSettingsTitle" | |||||
| android:layout_width="0dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginEnd="8dp" | |||||
| android:layout_marginStart="8dp" | |||||
| android:layout_marginTop="16dp" | |||||
| android:text="@string/caption_Cfg_DefaultValues_Title" | |||||
| android:textSize="20sp" | |||||
| android:textStyle="bold" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent" /> | |||||
| <com.google.android.material.textfield.TextInputLayout | |||||
| android:id="@+id/airRelativeHumidityLayout" | |||||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||||
| android:layout_width="0dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginEnd="8dp" | |||||
| android:layout_marginStart="8dp" | |||||
| android:layout_marginTop="8dp" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toBottomOf="@+id/airTemperatureLayout"> | |||||
| <com.google.android.material.textfield.TextInputEditText | |||||
| android:id="@+id/airRelativeHumidityTxt" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:hint="@string/airRelativeHumidityLbl" | |||||
| android:singleLine="true" /> | |||||
| </com.google.android.material.textfield.TextInputLayout> | |||||
| <com.google.android.material.textfield.TextInputLayout | |||||
| android:id="@+id/shootingDistanzLayout" | |||||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||||
| android:layout_width="0dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginEnd="8dp" | |||||
| android:layout_marginStart="8dp" | |||||
| android:layout_marginTop="8dp" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toBottomOf="@+id/airRelativeHumidityLayout"> | |||||
| <com.google.android.material.textfield.TextInputEditText | |||||
| android:id="@+id/shootingDistanzTxt" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:hint="@string/shootingDistanzLbl" | |||||
| android:singleLine="true" /> | |||||
| </com.google.android.material.textfield.TextInputLayout> | |||||
| <com.google.android.material.textfield.TextInputLayout | |||||
| android:id="@+id/airTemperatureLayout" | |||||
| style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | |||||
| android:layout_width="0dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginEnd="8dp" | |||||
| android:layout_marginStart="8dp" | |||||
| android:layout_marginTop="8dp" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toBottomOf="@+id/defaultSettingsTitle"> | |||||
| <com.google.android.material.textfield.TextInputEditText | |||||
| android:id="@+id/airTemperatureTxt" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:hint="@string/airTemperatureLbl" | |||||
| android:singleLine="true" /> | |||||
| </com.google.android.material.textfield.TextInputLayout> | |||||
| </androidx.constraintlayout.widget.ConstraintLayout> |
| xmlns:app="http://schemas.android.com/apk/res-auto"> | xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||
| <item | <item | ||||
| android:id="@+id/action_settings" | android:id="@+id/action_settings" | ||||
| android:icon="@drawable/ic_settings" | |||||
| android:orderInCategory="100" | android:orderInCategory="100" | ||||
| android:title="@string/action_settings" | android:title="@string/action_settings" | ||||
| app:showAsAction="never" /> | app:showAsAction="never" /> |
| <string name="caption_Cfg_SaveSuccessful">\'%s\' erfolgreich gespeichert!</string> | <string name="caption_Cfg_SaveSuccessful">\'%s\' erfolgreich gespeichert!</string> | ||||
| <string name="caption_Cfg_UpdateSuccessful">\'%s\' erfolgreich geändert!</string> | <string name="caption_Cfg_UpdateSuccessful">\'%s\' erfolgreich geändert!</string> | ||||
| <string name="caption_Calculating">Berechnung läuft…</string> | <string name="caption_Calculating">Berechnung läuft…</string> | ||||
| <string name="caption_Cfg_DefaultValues_Title">Standardwerte</string> | |||||
| <string name="fcChart_StartAngle">Abschusswinkel:\n</string> | <string name="fcChart_StartAngle">Abschusswinkel:\n</string> | ||||
| <string name="fcChart_MaxHeight">Max. Höhe der Flugbahn:\n</string> | <string name="fcChart_MaxHeight">Max. Höhe der Flugbahn:\n</string> | ||||
| <string name="fcChart_TitleXAxis">Distanz [m]</string> | <string name="fcChart_TitleXAxis">Distanz [m]</string> | ||||
| <string name="fcChart_TitleYAxis">Höhe [m]</string> | <string name="fcChart_TitleYAxis">Höhe [m]</string> | ||||
| </resources> | </resources> |
| <string name="caption_Cfg_SaveSuccessful">\'%s\' was saved successfully!</string> | <string name="caption_Cfg_SaveSuccessful">\'%s\' was saved successfully!</string> | ||||
| <string name="caption_Cfg_UpdateSuccessful">\'%s\' was updated successfully!</string> | <string name="caption_Cfg_UpdateSuccessful">\'%s\' was updated successfully!</string> | ||||
| <string name="caption_Calculating">Calculating…</string> | <string name="caption_Calculating">Calculating…</string> | ||||
| <string name="caption_Cfg_DefaultValues_Title">Default values</string> | |||||
| <string name="fcChart_StartAngle">Elevation Angle:\n</string> | <string name="fcChart_StartAngle">Elevation Angle:\n</string> | ||||
| <string name="fcChart_MaxHeight">Max. Height of Trajectory:\n</string> | <string name="fcChart_MaxHeight">Max. Height of Trajectory:\n</string> |