| @@ -21,27 +21,19 @@ | |||
| </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/ui/configuration/ArcherySetupConfigurationViewModel.java" 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" /> | |||
| <change beforePath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/fileHashes.lock" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/resourceHashesCache.bin" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/7.3.3/fileHashes/resourceHashesCache.bin" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" beforeDir="false" afterPath="$PROJECT_DIR$/.gradle/buildOutputCleanup/buildOutputCleanup.lock" afterDir="false" /> | |||
| <change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/utilities/NoFilterArrayAdapter.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/ArcherySetupDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/dao/ArcherySetupDao.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/ArcherySetup.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/ArcherySetup.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/IArcherySetup.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/IArcherySetup.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/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/CalculateSightParametersViewModel.java" beforeDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/EquipmentConfigurationActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationViewModel.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationViewModel.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/RiserConfigurationActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/RiserConfigurationActivity.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/SightConfigurationActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/SightConfigurationActivity.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/AddEquipmentFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/AddEquipmentFragment.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/EquipmentRecyclerViewAdapter.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/equipment/EquipmentRecyclerViewAdapter.java" 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/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/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_choose.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_equipment_choose.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_equipment_choose_list.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_equipment_choose_list.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/values-de/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-de/strings.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" /> | |||
| </list> | |||
| @@ -60,8 +52,8 @@ | |||
| <option name="RECENT_TEMPLATES"> | |||
| <list> | |||
| <option value="resourceFile" /> | |||
| <option value="Class" /> | |||
| <option value="valueResourceFile" /> | |||
| <option value="Class" /> | |||
| </list> | |||
| </option> | |||
| </component> | |||
| @@ -84,6 +76,8 @@ | |||
| <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> | |||
| <property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> | |||
| <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 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.recyclerview/recyclerview/1.2.1/f0f93e67af3f7417bdd560d5142f6dec4fe629c3/recyclerview-1.2.1-sources.jar!/androidx/recyclerview/widget/RecyclerView.java_RecyclerView_DIMENSIONS" value="1080 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" /> | |||
| @@ -256,22 +250,22 @@ | |||
| </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>98</line> | |||
| <line>99</line> | |||
| <option name="timeStamp" value="37" /> | |||
| </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>172</line> | |||
| <line>173</line> | |||
| <option name="timeStamp" value="40" /> | |||
| </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>128</line> | |||
| <line>129</line> | |||
| <option name="timeStamp" value="42" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/SightConfigurationActivity.java</url> | |||
| <line>73</line> | |||
| <line>74</line> | |||
| <option name="timeStamp" value="43" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| @@ -281,12 +275,7 @@ | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java</url> | |||
| <line>94</line> | |||
| <option name="timeStamp" value="48" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java</url> | |||
| <line>88</line> | |||
| <line>92</line> | |||
| <option name="timeStamp" value="50" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| @@ -296,14 +285,24 @@ | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java</url> | |||
| <line>149</line> | |||
| <line>186</line> | |||
| <option name="timeStamp" value="53" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java</url> | |||
| <line>156</line> | |||
| <line>208</line> | |||
| <option name="timeStamp" value="54" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/SightConfigurationActivity.java</url> | |||
| <line>120</line> | |||
| <option name="timeStamp" value="55" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/configuration/ArcherySetupConfigurationActivity.java</url> | |||
| <line>190</line> | |||
| <option name="timeStamp" value="56" /> | |||
| </line-breakpoint> | |||
| </breakpoints> | |||
| </breakpoint-manager> | |||
| <watches-manager> | |||
| @@ -313,6 +312,7 @@ | |||
| <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" /> | |||
| </configuration> | |||
| </watches-manager> | |||
| </component> | |||
| @@ -3,6 +3,8 @@ | |||
| */ | |||
| package ch.spherIC.recurvebowsight.ui.configuration; | |||
| import android.app.AlertDialog; | |||
| import android.content.DialogInterface; | |||
| import android.os.Bundle; | |||
| import android.view.MenuItem; | |||
| import android.widget.ArrayAdapter; | |||
| @@ -20,9 +22,11 @@ import ch.spherIC.recurvebowsight.database.dao.ArcherySetupDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.RiserDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.SightDao; | |||
| import ch.spherIC.recurvebowsight.databinding.ActivityEquipmentConfigurationBinding; | |||
| import ch.spherIC.recurvebowsight.model.ArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter; | |||
| import ch.spherIC.recurvebowsight.utilities.PlatformUtils; | |||
| public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| @@ -63,8 +67,8 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| DecimalFormat dF2 = new DecimalFormat("#.##"); | |||
| DecimalFormat dF3 = new DecimalFormat("#.###"); | |||
| this.archerySetupConfigurationViewModel.getName().observe(this, name -> this.binding.asLabelTxt.setText(name)); | |||
| this.archerySetupConfigurationViewModel.getSight().observe(this, sight -> this.binding.asSightSelectionTxt.setText(sight != null ? sight.toString() : "")); | |||
| this.archerySetupConfigurationViewModel.getRiser().observe(this, riser -> this.binding.asRiserSelectionTxt.setText(riser != null ? riser.toString() : "")); | |||
| this.archerySetupConfigurationViewModel.getSight().observe(this, sight -> this.binding.asSightSelectionTxt.setText(sight != null ? sight.toString() : "", false)); | |||
| this.archerySetupConfigurationViewModel.getRiser().observe(this, riser -> this.binding.asRiserSelectionTxt.setText(riser != null ? riser.toString() : "", false)); | |||
| this.archerySetupConfigurationViewModel.getArrowDiameter().observe(this, arwDiam -> this.binding.asArrowDiameterTxt.setText(arwDiam != null ? dF.format(arwDiam) : "")); | |||
| this.archerySetupConfigurationViewModel.getArrowCw().observe(this, arwCw -> this.binding.asArrowCWTxt.setText(arwCw != null ? dF.format(arwCw) : "")); | |||
| this.archerySetupConfigurationViewModel.getArrowWeight().observe(this, arwWeight -> this.binding.asArrowWeightTxt.setText(arwWeight != null ? dF.format(arwWeight) : "")); | |||
| @@ -86,47 +90,33 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| textViewAS.setOnItemClickListener((parent, view, position, id) -> { | |||
| IArcherySetup selectedArcherySetup = (IArcherySetup) textViewAS.getAdapter().getItem(position); | |||
| if (selectedArcherySetup != null) { | |||
| archerySetupConfigurationViewModel.setEquipment(selectedArcherySetup); | |||
| archerySetupConfigurationViewModel.setArcherySetup(selectedArcherySetup); | |||
| } | |||
| }); | |||
| /* AutoCompleteTextView textViewSight = findViewById(R.id.asSightSelectionTxt); | |||
| textViewAS.setOnItemClickListener((parent, view, position, id) -> { | |||
| ISight selectedSight = (ISight) textViewSight.getAdapter().getItem(position); | |||
| archerySetupConfigurationViewModel.setSight(selectedSight); | |||
| }); | |||
| AutoCompleteTextView textViewRiser = findViewById(R.id.asRiserSelectionTxt); | |||
| textViewAS.setOnItemClickListener((parent, view, position, id) -> { | |||
| IRiser selectedRiser = (IRiser) textViewRiser.getAdapter().getItem(position); | |||
| if (selectedRiser != null) { | |||
| // sightConfigurationViewModel.setSight(selectedRiser); | |||
| } | |||
| });*/ | |||
| } | |||
| private void addButtonListeners() { | |||
| Button newButton = findViewById(R.id.archerystpcfg_button_new); | |||
| newButton.setOnClickListener(v -> addNewSight()); | |||
| newButton.setOnClickListener(v -> addNewArcherySetup()); | |||
| Button deleteButton = findViewById(R.id.archerystpcfg_button_delete); | |||
| deleteButton.setOnClickListener(v -> deleteSight()); | |||
| deleteButton.setOnClickListener(v -> deleteArcherySetup()); | |||
| Button saveButton = findViewById(R.id.archerystpcfg_button_save); | |||
| saveButton.setOnClickListener(v -> saveSightConfiguration()); | |||
| saveButton.setOnClickListener(v -> saveArcherySetupConfiguration()); | |||
| } | |||
| private void loadSightsAndRisers() { | |||
| List<ISight> sights = SightDao.getInstance().loadAll(); | |||
| this.archerySetupConfigurationViewModel.setAllSights(sights); | |||
| ArrayAdapter<ISight> sightsAdapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, sights); | |||
| ArrayAdapter<ISight> sightsAdapter = new NoFilterArrayAdapter<ISight>(this, android.R.layout.simple_dropdown_item_1line, sights); | |||
| AutoCompleteTextView textViewSights = this.binding.asSightSelectionTxt; | |||
| textViewSights.setAdapter(sightsAdapter); | |||
| textViewSights.invalidate(); | |||
| List<IRiser> risers = RiserDao.getInstance().loadAll(); | |||
| this.archerySetupConfigurationViewModel.setAllRisers(risers); | |||
| ArrayAdapter<IRiser> riserAdapter = new ArrayAdapter<IRiser>(this, android.R.layout.simple_dropdown_item_1line, risers); | |||
| ArrayAdapter<IRiser> riserAdapter = new NoFilterArrayAdapter<IRiser>(this, android.R.layout.simple_dropdown_item_1line, risers); | |||
| AutoCompleteTextView textViewRisers = binding.asRiserSelectionTxt; | |||
| textViewRisers.setAdapter(riserAdapter); | |||
| textViewRisers.invalidate(); | |||
| @@ -134,30 +124,92 @@ public class ArcherySetupConfigurationActivity extends AppCompatActivity { | |||
| private void loadArcherySetups() { | |||
| List<IArcherySetup> archerySetups = ArcherySetupDao.getInstance().loadAll(); | |||
| ArrayAdapter<IArcherySetup> archerySetupsAdapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, archerySetups); | |||
| ArrayAdapter<IArcherySetup> archerySetupsAdapter = new NoFilterArrayAdapter<IArcherySetup>(this, android.R.layout.simple_dropdown_item_1line, archerySetups); | |||
| AutoCompleteTextView textViewASs = this.binding.asArcherySetupSelectionTxt; | |||
| textViewASs.setAdapter(archerySetupsAdapter); | |||
| textViewASs.invalidate(); | |||
| } | |||
| private void addNewSight() { | |||
| private void addNewArcherySetup() { | |||
| IArcherySetup newArcherySetup = new ArcherySetup(0, "", null, null, null, null, | |||
| null, null, null, null, null, null, null, | |||
| null, null, null, null, null); | |||
| this.archerySetupConfigurationViewModel.setArcherySetup(newArcherySetup); | |||
| String strMandatory = getString(R.string.caption_mandatory); | |||
| this.binding.asArcherySetupSelectionTxt.setText(null, false); | |||
| this.binding.asLabelTxt.setError(strMandatory); | |||
| this.binding.asRiserSelectionTxt.setError(strMandatory); | |||
| this.binding.asSightSelectionTxt.setError(strMandatory); | |||
| this.binding.asArrowCWTxt.setError(strMandatory); | |||
| this.binding.asArrowWeightTxt.setError(strMandatory); | |||
| this.binding.asArrowV0Txt.setError(strMandatory); | |||
| this.binding.asArrowNockHeightTxt.setError(strMandatory); | |||
| this.binding.asTargetCenterHeightTxt.setError(strMandatory); | |||
| this.binding.asBowPulloutTxt.setError(strMandatory); | |||
| this.binding.asHNATxt.setError(strMandatory); | |||
| this.binding.asNockRaisingTxt.setError(strMandatory); | |||
| this.binding.asBraceHeightTxt.setError(strMandatory); | |||
| this.binding.asDeltaTimeTxt.setError(strMandatory); | |||
| this.binding.asCalcPrecisionTxt.setError(strMandatory); | |||
| this.binding.asSightVertScaleMiddleTxt.setError(strMandatory); | |||
| this.binding.asSightHorzSettingTxt.setError(strMandatory); | |||
| AutoCompleteTextView textView = binding.asArcherySetupSelectionTxt; | |||
| ((ArrayAdapter<IArcherySetup>) textView.getAdapter()).insert(newArcherySetup, 0); | |||
| textView.setAdapter((ArrayAdapter<IRiser>) textView.getAdapter()); | |||
| textView.setSelection(0); | |||
| } | |||
| private void deleteSight() { | |||
| private void deleteArcherySetup() { | |||
| IArcherySetup lArcherySetup = this.archerySetupConfigurationViewModel.getArcherySetup().getValue(); | |||
| if (lArcherySetup != null) { | |||
| AlertDialog dlg = PlatformUtils.getDeleteConfirmDialog(this, lArcherySetup.toString(), new DialogInterface.OnClickListener() { | |||
| @Override | |||
| public void onClick(final DialogInterface dialog, final int which) { | |||
| String message = String.format(getString(R.string.caption_Cfg_DeleteSuccessful), lArcherySetup); | |||
| try { | |||
| ArcherySetupDao.getInstance().delete(lArcherySetup); | |||
| loadArcherySetups(); | |||
| archerySetupConfigurationViewModel.setArcherySetup(null); | |||
| binding.asArcherySetupSelectionTxt.setText(null, false); | |||
| } catch (Exception e) { | |||
| message = getString(R.string.caption_Cfg_DeleteNotPossible); | |||
| } | |||
| PlatformUtils.toast(ArcherySetupConfigurationActivity.this, message).show(); | |||
| } | |||
| }); | |||
| dlg.show(); | |||
| } | |||
| } | |||
| private void saveSightConfiguration() { | |||
| private void saveArcherySetupConfiguration() { | |||
| if (!validateInputs()) { | |||
| return; | |||
| } | |||
| this.archerySetupConfigurationViewModel.setName(this.binding.asLabelTxt.getText().toString()); | |||
| this.archerySetupConfigurationViewModel.setSight(this.archerySetupConfigurationViewModel.findSightByName(this.binding.asSightSelectionTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setRiser(this.archerySetupConfigurationViewModel.findRiserByName(this.binding.asRiserSelectionTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowDiameter(PlatformUtils.parseDouble(this.binding.asArrowDiameterTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowCw(PlatformUtils.parseDouble(this.binding.asArrowCWTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowWeight(PlatformUtils.parseDouble(this.binding.asArrowWeightTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowV0(PlatformUtils.parseDouble(this.binding.asArrowV0Txt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setArrowNockHeight(PlatformUtils.parseDouble(this.binding.asArrowNockHeightTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setBowPullout(PlatformUtils.parseDouble(this.binding.asBowPulloutTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setHNA(PlatformUtils.parseDouble(this.binding.asHNATxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setNockRaising(PlatformUtils.parseDouble(this.binding.asNockRaisingTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setBraceHeight(PlatformUtils.parseDouble(this.binding.asBraceHeightTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setTargetCenterHeight(PlatformUtils.parseDouble(this.binding.asTargetCenterHeightTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setDeltaTime(PlatformUtils.parseDouble(this.binding.asDeltaTimeTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setCalcPrecision(PlatformUtils.parseDouble(this.binding.asCalcPrecisionTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setSightVertSkalaMiddle(PlatformUtils.parseDouble(this.binding.asSightVertScaleMiddleTxt.getText().toString())); | |||
| this.archerySetupConfigurationViewModel.setSightHorzSetting(PlatformUtils.parseDouble(this.binding.asSightHorzSettingTxt.getText().toString())); | |||
| IArcherySetup lArcherySetup = this.archerySetupConfigurationViewModel.getArcherySetup().getValue(); | |||
| if (lArcherySetup.getId() > 0) { | |||
| ArcherySetupDao.getInstance().update(lArcherySetup); | |||
| //TODO: SHOW UPDATE INFO TOAST | |||
| PlatformUtils.toast(ArcherySetupConfigurationActivity.this, String.format(getString(R.string.caption_Cfg_UpdateSuccessful), lArcherySetup)).show(); | |||
| } else { | |||
| lArcherySetup = ArcherySetupDao.getInstance().insert(lArcherySetup); | |||
| loadArcherySetups(); | |||
| @@ -77,7 +77,7 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| this.mBraceHeight.setValue(null); | |||
| } | |||
| public void setEquipment(IArcherySetup aArcherySetup) { | |||
| public void setArcherySetup(IArcherySetup aArcherySetup) { | |||
| this.mArcherySetup.setValue(aArcherySetup); | |||
| this.mName.setValue(aArcherySetup != null ? aArcherySetup.getName() : ""); | |||
| this.mSight.setValue(aArcherySetup != null ? aArcherySetup.getSight() : null); | |||
| @@ -99,119 +99,119 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| } | |||
| public void setName(String nameText) { | |||
| if (this.mName.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setName(nameText); | |||
| } | |||
| this.mName.setValue(nameText); | |||
| } | |||
| public void setSight(ISight aSight) { | |||
| if (this.mSight.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setSight(aSight); | |||
| } | |||
| this.mSight.setValue(aSight); | |||
| } | |||
| public void setRiser(IRiser aRiser) { | |||
| if (this.mRiser.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setRiser(aRiser); | |||
| } | |||
| this.mRiser.setValue(aRiser); | |||
| } | |||
| public void setArrowDiameter(Double mArrowDiameter) { | |||
| if (this.mArrowDiameter.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowDiameter(mArrowDiameter); | |||
| } | |||
| this.mArrowDiameter.setValue(mArrowDiameter); | |||
| } | |||
| public void setArrowCw(Double mArrowCw) { | |||
| if (this.mArrowCw.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowCw(mArrowCw); | |||
| } | |||
| this.mArrowCw.setValue(mArrowCw); | |||
| } | |||
| public void setArrowWeight(Double mArrowWeight) { | |||
| if (this.mArrowWeight.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowWeight(mArrowWeight); | |||
| } | |||
| this.mArrowWeight.setValue(mArrowWeight); | |||
| } | |||
| public void setArrowV0(Double mArrowV0) { | |||
| if (this.mArrowV0.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowV0(mArrowV0); | |||
| } | |||
| this.mArrowV0.setValue(mArrowV0); | |||
| } | |||
| public void setTargetCenterHeight(Double mTargetCenterHeight) { | |||
| if (this.mTargetCenterHeight.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setTargetCenterHeight(mTargetCenterHeight); | |||
| } | |||
| this.mTargetCenterHeight.setValue(mTargetCenterHeight); | |||
| } | |||
| public void setArrowNockHeight(Double mArrowNockHeight) { | |||
| if (this.mArrowNockHeight.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setArrowNockHeight(mArrowNockHeight); | |||
| } | |||
| this.mArrowNockHeight.setValue(mArrowNockHeight); | |||
| } | |||
| public void setBowPullout(Double mBowPullout) { | |||
| if (this.mBowPullout.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setBowPullout(mBowPullout); | |||
| } | |||
| this.mBowPullout.setValue(mBowPullout); | |||
| } | |||
| public void setHNA(Double mHNA) { | |||
| if (this.mHNA.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setHNA(mHNA); | |||
| } | |||
| this.mHNA.setValue(mHNA); | |||
| } | |||
| public void setDeltaTime(Double mDeltaTime) { | |||
| if (this.mDeltaTime.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setDeltaTime(mDeltaTime); | |||
| } | |||
| this.mDeltaTime.setValue(mDeltaTime); | |||
| } | |||
| public void setCalcPrecision(Double mCalcPrecision) { | |||
| if (this.mCalcPrecision.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setCalcPrecision(mCalcPrecision); | |||
| } | |||
| this.mCalcPrecision.setValue(mCalcPrecision); | |||
| } | |||
| public void setSightVertSkalaMiddle(Double mSightVertSkalaMiddle) { | |||
| if (this.mSightVertSkalaMiddle.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setSightVertSkalaMiddle(mSightVertSkalaMiddle); | |||
| } | |||
| this.mSightVertSkalaMiddle.setValue(mSightVertSkalaMiddle); | |||
| } | |||
| public void setSightHorzSetting(Double mSightHorzSetting) { | |||
| if (this.mSightHorzSetting.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setSightHorzSetting(mSightHorzSetting); | |||
| } | |||
| this.mSightHorzSetting.setValue(mSightHorzSetting); | |||
| } | |||
| public void setNockRaising(Double mNockRaising) { | |||
| if (this.mNockRaising.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setNockRaising(mNockRaising); | |||
| } | |||
| this.mNockRaising.setValue(mNockRaising); | |||
| } | |||
| public void setBraceHeight(Double mBraceHeight) { | |||
| if (this.mBraceHeight.getValue() != null) { | |||
| if (this.mArcherySetup.getValue() != null) { | |||
| this.mArcherySetup.getValue().setBraceHeight(mBraceHeight); | |||
| } | |||
| this.mBraceHeight.setValue(mBraceHeight); | |||
| @@ -273,25 +273,6 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| this.allRisers = allRisers; | |||
| } | |||
| public IRiser findRiserByName(String name) { | |||
| for (IRiser riser : this.allRisers) { | |||
| if (riser.toString().equals(name)) { | |||
| return riser; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| public ISight findSightByName(String name) { | |||
| for (ISight sight : this.allSights) { | |||
| if (sight.toString().equals(name)) { | |||
| return sight; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| public LiveData<Double> getBowPullout() { | |||
| return mBowPullout; | |||
| } | |||
| @@ -323,4 +304,22 @@ public class ArcherySetupConfigurationViewModel extends ViewModel { | |||
| public LiveData<Double> getBraceHeight() { | |||
| return mBraceHeight; | |||
| } | |||
| } | |||
| public IRiser findRiserByName(String name) { | |||
| for (IRiser riser : this.allRisers) { | |||
| if (riser.toString().equals(name)) { | |||
| return riser; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| public ISight findSightByName(String name) { | |||
| for (ISight sight : this.allSights) { | |||
| if (sight.toString().equals(name)) { | |||
| return sight; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -22,6 +22,7 @@ import ch.spherIC.recurvebowsight.database.dao.RiserDao; | |||
| import ch.spherIC.recurvebowsight.databinding.ActivityRiserConfigurationBinding; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.Riser; | |||
| import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter; | |||
| import ch.spherIC.recurvebowsight.utilities.PlatformUtils; | |||
| public class RiserConfigurationActivity extends AppCompatActivity { | |||
| @@ -89,7 +90,7 @@ public class RiserConfigurationActivity extends AppCompatActivity { | |||
| private void loadRisers() { | |||
| List<IRiser> risers = RiserDao.getInstance().loadAll(); | |||
| ArrayAdapter<IRiser> adapter = new ArrayAdapter<IRiser>(this, android.R.layout.simple_dropdown_item_1line, risers); | |||
| ArrayAdapter<IRiser> adapter = new NoFilterArrayAdapter<IRiser>(this, android.R.layout.simple_dropdown_item_1line, risers); | |||
| AutoCompleteTextView textView = binding.riserSelectionTxt; | |||
| textView.setAdapter(adapter); | |||
| textView.invalidate(); | |||
| @@ -99,7 +100,7 @@ public class RiserConfigurationActivity extends AppCompatActivity { | |||
| IRiser newRiser = new Riser(0, "", "", null, null, null); | |||
| this.riserConfigurationViewModel.setRiser(newRiser); | |||
| String strMandatory = getString(R.string.caption_mandatory); | |||
| this.binding.riserSelectionTxt.setText(null); | |||
| this.binding.riserSelectionTxt.setText(null, false); | |||
| this.binding.rcManufacturerTxt.setError(strMandatory); | |||
| this.binding.rcModelTxt.setError(strMandatory); | |||
| this.binding.rcSizeTxt.setError(strMandatory); | |||
| @@ -117,21 +118,21 @@ public class RiserConfigurationActivity extends AppCompatActivity { | |||
| } | |||
| this.riserConfigurationViewModel.setManufacturerText(this.binding.rcManufacturerTxt.getText().toString()); | |||
| this.riserConfigurationViewModel.setModelText(this.binding.rcModelTxt.getText().toString()); | |||
| this.riserConfigurationViewModel.setSize(Double.parseDouble(this.binding.rcSizeTxt.getText().toString())); | |||
| this.riserConfigurationViewModel.setVVisH(Double.parseDouble(this.binding.rcVvisHTxt.getText().toString())); | |||
| this.riserConfigurationViewModel.setVVisV(Double.parseDouble(this.binding.rcVvisVTxt.getText().toString())); | |||
| this.riserConfigurationViewModel.setSize(PlatformUtils.parseDouble(this.binding.rcSizeTxt.getText().toString())); | |||
| this.riserConfigurationViewModel.setVVisH(PlatformUtils.parseDouble(this.binding.rcVvisHTxt.getText().toString())); | |||
| this.riserConfigurationViewModel.setVVisV(PlatformUtils.parseDouble(this.binding.rcVvisVTxt.getText().toString())); | |||
| IRiser lRiser = this.riserConfigurationViewModel.getRiser().getValue(); | |||
| if (lRiser.getId() > 0) { | |||
| RiserDao.getInstance().update(lRiser); | |||
| //TODO: SHOW UPDATE INFO TOAST | |||
| PlatformUtils.toast(RiserConfigurationActivity.this, String.format(getString(R.string.caption_Cfg_UpdateSuccessful), lRiser)).show(); | |||
| } else { | |||
| lRiser = RiserDao.getInstance().insert(lRiser); | |||
| loadRisers(); | |||
| AutoCompleteTextView textView = this.binding.riserSelectionTxt; | |||
| final int position = ((ArrayAdapter<IRiser>) textView.getAdapter()).getPosition(lRiser); | |||
| textView.setListSelection(position); | |||
| textView.setText(lRiser.toString()); | |||
| textView.setText(lRiser.toString(), false); | |||
| ((ArrayAdapter<IRiser>) textView.getAdapter()).getFilter().filter(null); | |||
| PlatformUtils.toast(RiserConfigurationActivity.this, String.format(getString(R.string.caption_Cfg_SaveSuccessful), lRiser)).show(); | |||
| } | |||
| @@ -173,7 +174,7 @@ public class RiserConfigurationActivity extends AppCompatActivity { | |||
| RiserDao.getInstance().delete(lRiser); | |||
| loadRisers(); | |||
| riserConfigurationViewModel.setRiser(null); | |||
| binding.riserSelectionTxt.setText(null); | |||
| binding.riserSelectionTxt.setText(null, false); | |||
| } catch (Exception e) { | |||
| message = getString(R.string.caption_Cfg_DeleteNotPossible); | |||
| } | |||
| @@ -22,6 +22,7 @@ import ch.spherIC.recurvebowsight.database.dao.SightDao; | |||
| import ch.spherIC.recurvebowsight.databinding.ActivitySightConfigurationBinding; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| import ch.spherIC.recurvebowsight.model.Sight; | |||
| import ch.spherIC.recurvebowsight.utilities.NoFilterArrayAdapter; | |||
| import ch.spherIC.recurvebowsight.utilities.PlatformUtils; | |||
| public class SightConfigurationActivity extends AppCompatActivity { | |||
| @@ -91,7 +92,7 @@ public class SightConfigurationActivity extends AppCompatActivity { | |||
| private void loadSights() { | |||
| List<ISight> sights = SightDao.getInstance().loadAll(); | |||
| ArrayAdapter<ISight> adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, sights); | |||
| ArrayAdapter<ISight> adapter = new NoFilterArrayAdapter<ISight>(this, android.R.layout.simple_dropdown_item_1line, sights); | |||
| AutoCompleteTextView textView = this.binding.sightSelectionTxt; | |||
| textView.setAdapter(adapter); | |||
| textView.invalidate(); | |||
| @@ -101,7 +102,7 @@ public class SightConfigurationActivity extends AppCompatActivity { | |||
| ISight newSight = new Sight(0, "", "", null, null, null, null, null, null); | |||
| this.sightConfigurationViewModel.setSight(newSight); | |||
| String strMandatory = getString(R.string.caption_mandatory); | |||
| this.binding.sightSelectionTxt.setText(null); | |||
| this.binding.sightSelectionTxt.setText(null, false); | |||
| this.binding.scManufacturerTxt.setError(strMandatory); | |||
| this.binding.scModelTxt.setError(strMandatory); | |||
| this.binding.scaVTxt.setError(strMandatory); | |||
| @@ -122,24 +123,25 @@ public class SightConfigurationActivity extends AppCompatActivity { | |||
| } | |||
| this.sightConfigurationViewModel.setManufacturerText(this.binding.scManufacturerTxt.getText().toString()); | |||
| this.sightConfigurationViewModel.setModelText(this.binding.scModelTxt.getText().toString()); | |||
| this.sightConfigurationViewModel.setAH(Double.parseDouble(this.binding.scaHTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setAV(Double.parseDouble(this.binding.scaVTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setAH(PlatformUtils.parseDouble(this.binding.scaHTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setAV(PlatformUtils.parseDouble(this.binding.scaVTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setHeVis(this.binding.sccHeVSTxt.getText().toString()); | |||
| this.sightConfigurationViewModel.setVertSkalaRangMin(Double.parseDouble(this.binding.scVertScaleRngMinTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setVertSkalaRangMax(Double.parseDouble(this.binding.scVertScaleRngMaxTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setPointerOffset(Double.parseDouble(this.binding.scPointerOffsetTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setVertSkalaRangMin(PlatformUtils.parseDouble(this.binding.scVertScaleRngMinTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setVertSkalaRangMax(PlatformUtils.parseDouble(this.binding.scVertScaleRngMaxTxt.getText().toString())); | |||
| this.sightConfigurationViewModel.setPointerOffset(PlatformUtils.parseDouble(this.binding.scPointerOffsetTxt.getText().toString())); | |||
| ISight lSight = this.sightConfigurationViewModel.getRiser().getValue(); | |||
| if (lSight.getId() > 0) { | |||
| SightDao.getInstance().update(lSight); | |||
| //TODO: SHOW UPDATE INFO TOAST | |||
| PlatformUtils.toast(SightConfigurationActivity.this, String.format(getString(R.string.caption_Cfg_UpdateSuccessful), lSight)).show(); | |||
| } else { | |||
| lSight = SightDao.getInstance().insert(lSight); | |||
| loadSights(); | |||
| AutoCompleteTextView textView = this.binding.sightSelectionTxt; | |||
| final int position = ((ArrayAdapter<ISight>) textView.getAdapter()).getPosition(lSight); | |||
| textView.setListSelection(position); | |||
| textView.setText(lSight.toString()); | |||
| textView.setText(lSight.toString(), false); | |||
| ((ArrayAdapter<ISight>) textView.getAdapter()).getFilter().filter(null); | |||
| PlatformUtils.toast(SightConfigurationActivity.this, String.format(getString(R.string.caption_Cfg_SaveSuccessful), lSight)).show(); | |||
| } | |||
| @@ -190,7 +192,7 @@ public class SightConfigurationActivity extends AppCompatActivity { | |||
| SightDao.getInstance().delete(lSight); | |||
| loadSights(); | |||
| sightConfigurationViewModel.setSight(null); | |||
| binding.sightSelectionTxt.setText(null); | |||
| binding.sightSelectionTxt.setText(null, false); | |||
| } catch (Exception e) { | |||
| message = getString(R.string.caption_Cfg_DeleteNotPossible); | |||
| } | |||
| @@ -53,12 +53,12 @@ public class EquipmentRecyclerViewAdapter extends RecyclerView.Adapter<Equipment | |||
| @Override | |||
| public boolean onTouch(View v, MotionEvent event) { | |||
| float alpha = 1.0f; | |||
| int horzMargin = v.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin); | |||
| int vertMargin = v.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin); | |||
| int horzMargin = v.getResources().getDimensionPixelSize(R.dimen.nav_header_horizontal_spacing); | |||
| int vertMargin = v.getResources().getDimensionPixelSize(R.dimen.nav_header_vertical_spacing); | |||
| if (event.getAction() == MotionEvent.ACTION_DOWN) { | |||
| alpha = 0.5f; | |||
| horzMargin = v.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin_onclick); | |||
| vertMargin = v.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin_onclick); | |||
| alpha = 0.75f; | |||
| horzMargin = v.getResources().getDimensionPixelSize(R.dimen.nav_header_horizontal_spacing_onclick); | |||
| vertMargin = v.getResources().getDimensionPixelSize(R.dimen.nav_header_vertical_spacing_onclick); | |||
| } | |||
| View setupCardView = v.findViewById(R.id.card_view_setup); | |||
| setupCardView.setAlpha(alpha); | |||
| @@ -0,0 +1,71 @@ | |||
| package ch.spherIC.recurvebowsight.utilities; | |||
| import android.content.Context; | |||
| import android.widget.ArrayAdapter; | |||
| import android.widget.Filter; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import androidx.annotation.NonNull; | |||
| /** | |||
| * Almost unbelievably, if we want to create a Material Spinner, | |||
| * we're forced to subclass ArrayAdapter. That statement alone | |||
| * is maddening. The issue is that there's no such thing as a Material | |||
| * Spinner. Instead, there's an Exposed Dropdown Menu, which is really | |||
| * an AutoCompleteTextView wrapped in a TextInputLayout, which replaces a | |||
| * Spinner. The reason we have to subclass ArrayAdapter is because we need | |||
| * the AutoCompleteTextView to act like a proper Spinner. Thus we have to | |||
| * override the AutoCompleteTextView's Filter so that it NEVER performs | |||
| * filtering of the dropdown menu items. | |||
| */ | |||
| public class NoFilterArrayAdapter<T extends Object> extends ArrayAdapter<T> { | |||
| private final List<T> objects; | |||
| private final Filter filter_that_does_nothing = new Filter() { | |||
| @Override | |||
| protected FilterResults performFiltering(CharSequence constraint) { | |||
| FilterResults results = new FilterResults(); | |||
| results.values = NoFilterArrayAdapter.this.objects; | |||
| results.count = NoFilterArrayAdapter.this.objects.size(); | |||
| return results; | |||
| } | |||
| @Override | |||
| protected void publishResults(CharSequence constraint, FilterResults results) { | |||
| notifyDataSetChanged(); | |||
| } | |||
| }; | |||
| /** | |||
| * Constructor | |||
| * | |||
| * @param context the context | |||
| * @param resource the resource | |||
| * @param objects the list of objects | |||
| */ | |||
| public NoFilterArrayAdapter(@NonNull Context context, int resource, @NonNull List<T> objects) { | |||
| super(context, resource, objects); | |||
| this.objects = objects; | |||
| } | |||
| /** | |||
| * Constructor | |||
| * | |||
| * @param context the context | |||
| * @param resource the resource | |||
| * @param objects the list of objects | |||
| */ | |||
| public NoFilterArrayAdapter(@NonNull Context context, int resource, @NonNull T[] objects) { | |||
| super(context, resource, objects); | |||
| this.objects = Arrays.asList(objects); | |||
| } | |||
| @NonNull | |||
| @Override | |||
| public Filter getFilter() { | |||
| return filter_that_does_nothing; | |||
| } | |||
| } | |||
| @@ -6,6 +6,7 @@ package ch.spherIC.recurvebowsight.utilities; | |||
| import android.app.AlertDialog; | |||
| import android.content.Context; | |||
| import android.content.DialogInterface; | |||
| import android.text.TextUtils; | |||
| import android.view.Gravity; | |||
| import android.widget.Toast; | |||
| @@ -48,6 +49,17 @@ public class PlatformUtils { | |||
| return 0; | |||
| }*/ | |||
| public static Double parseDouble(String doubleVal) { | |||
| if (!TextUtils.isEmpty(doubleVal)) { | |||
| try { | |||
| return Double.parseDouble(doubleVal); | |||
| } catch (NumberFormatException e) { | |||
| return null; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| public static AlertDialog getDeleteConfirmDialog(final Context context, final String itemToDelete, | |||
| final DialogInterface.OnClickListener okListener) { | |||
| @@ -54,6 +54,7 @@ | |||
| android:id="@+id/asArcherySetupSelectionTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:editable="false" | |||
| android:hint="@string/asArcherySetupLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| @@ -95,6 +96,7 @@ | |||
| android:id="@+id/asRiserSelectionTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:editable="false" | |||
| android:hint="@string/rcRiserLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| @@ -115,6 +117,7 @@ | |||
| android:id="@+id/asSightSelectionTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:editable="false" | |||
| android:hint="@string/rcSightLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| @@ -53,6 +53,7 @@ | |||
| android:id="@+id/riserSelectionTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:editable="false" | |||
| android:hint="@string/rcRiserLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| @@ -53,6 +53,7 @@ | |||
| android:id="@+id/sightSelectionTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:editable="false" | |||
| android:hint="@string/rcSightLbl" | |||
| android:singleLine="true" /> | |||
| </com.google.android.material.textfield.TextInputLayout> | |||
| @@ -9,10 +9,10 @@ | |||
| android:id="@+id/card_view_border" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:layout_marginBottom="@dimen/activity_horizontal_margin" | |||
| android:layout_marginLeft="@dimen/activity_horizontal_margin" | |||
| android:layout_marginRight="@dimen/activity_horizontal_margin" | |||
| android:layout_marginTop="@dimen/activity_horizontal_margin" | |||
| android:layout_marginBottom="8dp" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| android:backgroundTint="#54AAD1" | |||
| app:cardCornerRadius="20dp" | |||
| app:cardElevation="10dp" | |||
| @@ -6,8 +6,9 @@ | |||
| android:name="ch.spherIC.recurvebowsight.EquipmentFragment" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:layout_marginLeft="16dp" | |||
| android:layout_marginRight="16dp" | |||
| android:layout_marginLeft="8dp" | |||
| android:layout_marginRight="8dp" | |||
| android:layout_marginTop="8dp" | |||
| app:layoutManager="LinearLayoutManager" | |||
| tools:context=".ui.equipment.ChooseEquipmentFragment" | |||
| tools:listitem="@layout/fragment_equipment_choose" /> | |||
| @@ -98,6 +98,7 @@ | |||
| <string name="caption_mandatory">Erforderlich</string> | |||
| <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> | |||
| </resources> | |||
| @@ -98,5 +98,6 @@ | |||
| <string name="caption_mandatory">Mandatory</string> | |||
| <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> | |||
| </resources> | |||