| @@ -303,7 +303,7 @@ | |||
| <PersistentState> | |||
| <option name="values"> | |||
| <map> | |||
| <entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialiconsoutlined/my_location/outline_my_location_24.xml" /> | |||
| <entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialicons/terrain/baseline_terrain_24.xml" /> | |||
| </map> | |||
| </option> | |||
| </PersistentState> | |||
| @@ -313,7 +313,7 @@ | |||
| </option> | |||
| <option name="values"> | |||
| <map> | |||
| <entry key="outputName" value="ic_menu_calcsight" /> | |||
| <entry key="outputName" value="ic_calcsight_trajectory" /> | |||
| <entry key="sourceFile" value="Z:\Work\Java Projects\Android\RecurveBowSight\archery_equipment_choose.svg" /> | |||
| </map> | |||
| </option> | |||
| @@ -3,6 +3,9 @@ | |||
| <component name="DesignSurface"> | |||
| <option name="filePathToZoomLevelMap"> | |||
| <map> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_baseline_swipe_right_24.xml" value="0.264" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_calcsight_parameter.xml" value="0.264" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_calcsight_trajectory.xml" value="0.264" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_launcher_background.xml" value="0.285" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_mediation_black_24dp.xml" value="0.285" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/drawable/ic_menu_calcsight.xml" value="0.248" /> | |||
| @@ -20,6 +23,7 @@ | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/content_main.xml" value="0.3625" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_about.xml" value="0.15812841530054644" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight.xml" value="0.15812841530054644" /> | |||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight_parameters.xml" value="0.18194444444444444" /> | |||
| <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_choose.xml" value="0.33" /> | |||
| @@ -0,0 +1,10 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="SaveActionSettings"> | |||
| <option name="actions"> | |||
| <set> | |||
| <option value="activate" /> | |||
| </set> | |||
| </option> | |||
| </component> | |||
| </project> | |||
| @@ -21,22 +21,26 @@ | |||
| </component> | |||
| <component name="ChangeListManager"> | |||
| <list default="true" id="41369230-c648-4299-baf3-de5f13bcb18c" name="Changes" comment=""> | |||
| <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" /> | |||
| <change afterPath="$PROJECT_DIR$/.idea/saveactions_settings.xml" afterDir="false" /> | |||
| <change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightCollectionAdapter.java" afterDir="false" /> | |||
| <change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersFragment.java" afterDir="false" /> | |||
| <change afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightParametersViewModel.java" afterDir="false" /> | |||
| <change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_calcsight_parameter.xml" afterDir="false" /> | |||
| <change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_calcsight_trajectory.xml" afterDir="false" /> | |||
| <change afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight_parameters.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.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 beforePath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/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/about/AboutFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/about/AboutFragment.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightFragment.java" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightViewModel.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightViewModel.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/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_calcsight.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_calcsight.xml" afterDir="false" /> | |||
| <change beforePath="$PROJECT_DIR$/app/src/main/res/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/dimens.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/dimens.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" /> | |||
| @@ -55,6 +59,7 @@ | |||
| <list> | |||
| <option value="resourceFile" /> | |||
| <option value="valueResourceFile" /> | |||
| <option value="Class" /> | |||
| </list> | |||
| </option> | |||
| </component> | |||
| @@ -71,24 +76,28 @@ | |||
| <property name="RunOnceActivity.cidr.known.project.marker" value="true" /> | |||
| <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" /> | |||
| <property name="android-custom-viewC:/Users/FSmilari/.gradle/caches/modules-2/files-2.1/androidx.viewpager2/viewpager2/1.0.0/3c3569044e6969f1ee5c3aa03b08e6717a2d782f/viewpager2-1.0.0-sources.jar!/androidx/viewpager2/widget/ViewPager2.java_ViewPager2_DIMENSIONS" value="1080 1920" /> | |||
| <property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/view/View.java_SELECTED" value="View" /> | |||
| <property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/view/View.java_View_DIMENSIONS" value="1080 1920" /> | |||
| <property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/view/ViewGroup.java_SELECTED" value="ViewGroup" /> | |||
| <property name="android-custom-viewC:/Users/FSmilari/AppData/Local/Android/Sdk/sources/android-32/android/view/ViewGroup.java_ViewGroup_DIMENSIONS" value="1080 1920" /> | |||
| <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 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$/.." /> | |||
| <property name="last_opened_file_path" value="$PROJECT_DIR$/app/src/main/res/layout" /> | |||
| <property name="optimize.imports.on.save" value="true" /> | |||
| <property name="settings.editor.selected.configurable" value="File.Encoding" /> | |||
| <property name="settings.editor.selected.configurable" value="preferences.keymap" /> | |||
| </component> | |||
| <component name="RecentsManager"> | |||
| <key name="CopyFile.RECENT_KEYS"> | |||
| <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" /> | |||
| <recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\java\ch\spherIC\recurvebowsight\database\scheme\masterdata" /> | |||
| <recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\java\ch\spherIC\recurvebowsight\database\scheme\data" /> | |||
| <recent name="Z:\Work\Java Projects\Android\RecurveBowSight\V2\app\src\main\java\ch\spherIC\recurvebowsight\database\dao" /> | |||
| </key> | |||
| <key name="android.template.1093395407"> | |||
| <recent name="ch.spherIC.recurvebowsight" /> | |||
| @@ -97,6 +106,7 @@ | |||
| <recent name="ch.spherIC.recurvebowsight" /> | |||
| </key> | |||
| <key name="CopyClassDialog.RECENTS_KEY"> | |||
| <recent name="ch.spherIC.recurvebowsight.ui.calcsight" /> | |||
| <recent name="ch.spherIC.recurvebowsight.ui.equipment" /> | |||
| </key> | |||
| </component> | |||
| @@ -197,7 +207,7 @@ | |||
| <breakpoints> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/about/AboutFragment.java</url> | |||
| <line>19</line> | |||
| <line>18</line> | |||
| <option name="timeStamp" value="2" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| @@ -210,11 +220,6 @@ | |||
| <line>73</line> | |||
| <option name="timeStamp" value="6" /> | |||
| </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>25</line> | |||
| <option name="timeStamp" value="8" /> | |||
| </line-breakpoint> | |||
| <line-breakpoint enabled="true" suspend="THREAD" type="java-line"> | |||
| <url>file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/ui/calcsight/CalculateSightViewModel.java</url> | |||
| <line>26</line> | |||
| @@ -226,6 +231,7 @@ | |||
| <configuration name="app"> | |||
| <watch expression="getArguments()" /> | |||
| <watch expression="this.selectedArcherySetup.getName()" language="JAVA" /> | |||
| <watch expression="tab.getPosition()" language="JAVA" /> | |||
| </configuration> | |||
| </watches-manager> | |||
| </component> | |||
| @@ -15,8 +15,7 @@ public class AboutFragment extends Fragment { | |||
| private FragmentAboutBinding binding; | |||
| public View onCreateView(@NonNull LayoutInflater inflater, | |||
| ViewGroup container, Bundle savedInstanceState) { | |||
| public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |||
| AboutViewModel galleryViewModel = new ViewModelProvider(this).get(AboutViewModel.class); | |||
| binding = FragmentAboutBinding.inflate(inflater, container, false); | |||
| View root = binding.getRoot(); | |||
| @@ -0,0 +1,33 @@ | |||
| package ch.spherIC.recurvebowsight.ui.calcsight; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.fragment.app.Fragment; | |||
| import androidx.viewpager2.adapter.FragmentStateAdapter; | |||
| public class CalculateSightCollectionAdapter extends FragmentStateAdapter { | |||
| private final int itemsCount; | |||
| public CalculateSightCollectionAdapter(Fragment fragment, int itemsCount) { | |||
| super(fragment); | |||
| this.itemsCount = itemsCount; | |||
| } | |||
| @NonNull | |||
| @Override | |||
| public Fragment createFragment(int position) { | |||
| // Return a NEW fragment instance in createFragment(int) | |||
| Fragment fragment = new CalculateSightParametersFragment(position); | |||
| //Bundle args = new Bundle(); | |||
| // Our object is just an integer :-P | |||
| // args.putInt(DemoObjectFragment.ARG_OBJECT, position + 1); | |||
| // fragment.setArguments(args); | |||
| return fragment; | |||
| } | |||
| @Override | |||
| public int getItemCount() { | |||
| return this.itemsCount; | |||
| } | |||
| } | |||
| @@ -4,37 +4,77 @@ import android.os.Bundle; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.TextView; | |||
| import com.google.android.material.tabs.TabLayout; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.annotation.Nullable; | |||
| import androidx.fragment.app.Fragment; | |||
| import androidx.lifecycle.ViewModelProvider; | |||
| import androidx.viewpager2.widget.ViewPager2; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.databinding.FragmentCalcsightBinding; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| public class CalculateSightFragment extends Fragment { | |||
| private FragmentCalcsightBinding binding; | |||
| private CalculateSightCollectionAdapter calculateSightCollectionAdapter; | |||
| private ViewPager2 viewPager; | |||
| private ViewPager2.OnPageChangeCallback pageChangeCallback; | |||
| public View onCreateView(@NonNull LayoutInflater inflater, | |||
| ViewGroup container, Bundle savedInstanceState) { | |||
| public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |||
| CalculateSightViewModel galleryViewModel = new ViewModelProvider(this).get(CalculateSightViewModel.class); | |||
| binding = FragmentCalcsightBinding.inflate(inflater, container, false); | |||
| View root = binding.getRoot(); | |||
| this.binding = FragmentCalcsightBinding.inflate(inflater, container, false); | |||
| View root = this.binding.getRoot(); | |||
| if (getArguments() != null && getArguments().containsKey("setup")) { | |||
| IArcherySetup archerySetup = getArguments().getParcelable("setup"); | |||
| galleryViewModel.setSelectedArcherySetup(archerySetup); | |||
| } | |||
| final TextView textView = binding.textCalcsight; | |||
| galleryViewModel.getText().observe(getViewLifecycleOwner(), textView::setText); | |||
| return root; | |||
| } | |||
| @Override | |||
| public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
| TabLayout tabLayout = view.findViewById(R.id.calcSight_tabLayout); | |||
| this.calculateSightCollectionAdapter = new CalculateSightCollectionAdapter(this, tabLayout.getTabCount()); | |||
| this.pageChangeCallback = new ViewPager2.OnPageChangeCallback() { | |||
| @Override | |||
| public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
| super.onPageScrolled(position, positionOffset, positionOffsetPixels); | |||
| if (positionOffset == 0.0f) { | |||
| TabLayout tabLayout = view.findViewById(R.id.calcSight_tabLayout); | |||
| tabLayout.getTabAt(position).select(); | |||
| } | |||
| } | |||
| }; | |||
| this.viewPager = view.findViewById(R.id.calcSight_viewPager); | |||
| this.viewPager.setAdapter(this.calculateSightCollectionAdapter); | |||
| this.viewPager.registerOnPageChangeCallback(this.pageChangeCallback); | |||
| tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { | |||
| @Override | |||
| public void onTabSelected(TabLayout.Tab tab) { | |||
| if (viewPager.getCurrentItem() != tab.getPosition()) { | |||
| viewPager.setCurrentItem(tab.getPosition()); | |||
| } | |||
| } | |||
| @Override | |||
| public void onTabUnselected(TabLayout.Tab tab) { | |||
| } | |||
| @Override | |||
| public void onTabReselected(TabLayout.Tab tab) { | |||
| } | |||
| }); | |||
| } | |||
| @Override | |||
| public void onDestroyView() { | |||
| super.onDestroyView(); | |||
| binding = null; | |||
| this.binding = null; | |||
| this.viewPager.unregisterOnPageChangeCallback(this.pageChangeCallback); | |||
| } | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package ch.spherIC.recurvebowsight.ui.calcsight; | |||
| import android.os.Bundle; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.TextView; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.fragment.app.Fragment; | |||
| import androidx.lifecycle.ViewModelProvider; | |||
| import ch.spherIC.recurvebowsight.databinding.FragmentCalcsightParametersBinding; | |||
| public class CalculateSightParametersFragment extends Fragment { | |||
| private final int position; | |||
| private FragmentCalcsightParametersBinding binding; | |||
| public CalculateSightParametersFragment(int position) { | |||
| this.position = position; | |||
| } | |||
| public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |||
| CalculateSightParametersViewModel galleryViewModel = new ViewModelProvider(this).get(CalculateSightParametersViewModel.class); | |||
| binding = FragmentCalcsightParametersBinding.inflate(inflater, container, false); | |||
| View root = binding.getRoot(); | |||
| final TextView textView = binding.textCalcsightParams; | |||
| galleryViewModel.setText(position); | |||
| galleryViewModel.getText().observe(getViewLifecycleOwner(), textView::setText); | |||
| return root; | |||
| } | |||
| @Override | |||
| public void onDestroyView() { | |||
| super.onDestroyView(); | |||
| binding = null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package ch.spherIC.recurvebowsight.ui.calcsight; | |||
| import androidx.lifecycle.LiveData; | |||
| import androidx.lifecycle.MutableLiveData; | |||
| import androidx.lifecycle.ViewModel; | |||
| public class CalculateSightParametersViewModel extends ViewModel { | |||
| private final MutableLiveData<String> mText; | |||
| public CalculateSightParametersViewModel() { | |||
| mText = new MutableLiveData<>(); | |||
| mText.setValue("This is the \"Calculate Sight Params\" fragment"); | |||
| } | |||
| public void setText(int position) { | |||
| mText.setValue(mText.getValue() + position); | |||
| } | |||
| public LiveData<String> getText() { | |||
| return mText; | |||
| } | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:height="24dp" | |||
| android:width="24dp" | |||
| android:viewportHeight="24" | |||
| android:viewportWidth="24" | |||
| android:tint="#000000" | |||
| android:autoMirrored="true"> | |||
| <path | |||
| android:fillColor="@android:color/white" | |||
| android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z" /> | |||
| </vector> | |||
| @@ -0,0 +1,15 @@ | |||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:height="24dp" | |||
| android:tint="#000000" | |||
| android:viewportHeight="24" | |||
| android:viewportWidth="24" | |||
| android:width="24dp"> | |||
| <path | |||
| android:fillColor="@android:color/white" | |||
| android:pathData="M14,6l-3.75,5 2.85,3.8 -1.6,1.2C9.81,13.75 7,10 7,10l-6,8h22L14,6z" /> | |||
| <path | |||
| android:fillColor="@android:color/white" | |||
| android:pathData="M19.91,5.5H17V7h5V2h-1.5v2.02C18.18,2.13 15.22,1 12,1C6.51,1 2.73,4.12 2,7h1.57C4.33,5.02 7.26,2.5 12,2.5C15.03,2.5 17.79,3.64 19.91,5.5z" /> | |||
| </vector> | |||
| @@ -6,17 +6,43 @@ | |||
| android:layout_height="match_parent" | |||
| tools:context=".ui.calcsight.CalculateSightFragment"> | |||
| <TextView | |||
| android:id="@+id/text_calcsight" | |||
| android:layout_width="match_parent" | |||
| <com.google.android.material.tabs.TabLayout | |||
| android:id="@+id/calcSight_tabLayout" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| 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"> | |||
| <com.google.android.material.tabs.TabItem | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:icon="@drawable/ic_calcsight_parameter" | |||
| android:text="@string/viewParams" /> | |||
| <com.google.android.material.tabs.TabItem | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:icon="@drawable/ic_calcsight_trajectory" | |||
| android:text="@string/viewResults" /> | |||
| <com.google.android.material.tabs.TabItem | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:icon="@drawable/ic_menu_calcsight" | |||
| android:text="@string/viewSight" /> | |||
| </com.google.android.material.tabs.TabLayout> | |||
| <androidx.viewpager2.widget.ViewPager2 | |||
| android:id="@+id/calcSight_viewPager" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="0dp" | |||
| android:layout_weight="1" | |||
| app:layout_behavior="@string/appbar_scrolling_view_behavior" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| app:layout_constraintTop_toBottomOf="@+id/calcSight_tabLayout" /> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| @@ -0,0 +1,22 @@ | |||
| <?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:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| tools:context=".ui.calcsight.CalculateSightParametersFragment"> | |||
| <TextView | |||
| android:id="@+id/text_calcsight_params" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:layout_marginStart="8dp" | |||
| android:layout_marginTop="8dp" | |||
| android:textAlignment="center" | |||
| android:textSize="20sp" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| @@ -16,4 +16,8 @@ | |||
| <string name="menu_calculate_sight">Visiereinstellung berechnen</string> | |||
| <string name="caption_NoSelection">Keine Auswahl...</string> | |||
| <string name="caption_setup_choosen">"Gewählte Ausrüstung: "</string> | |||
| <string name="viewParams">Parameter</string> | |||
| <string name="viewResults">Bl. Flugbahn</string> | |||
| <string name="viewSight">Visiereinst.</string> | |||
| </resources> | |||
| @@ -15,5 +15,8 @@ | |||
| <string name="menu_calculate_sight">Calculate Sight</string> | |||
| <string name="caption_NoSelection">No Selection...</string> | |||
| <string name="caption_setup_choosen">"Selected Setup: "</string> | |||
| <!-- TODO: Remove or change this placeholder text --> | |||
| <string name="viewParams">Parameters</string> | |||
| <string name="viewResults">Ball. Trajectory</string> | |||
| <string name="viewSight">Sight Setting</string> | |||
| </resources> | |||