diff --git a/app/src/main/java/de/psekochbuch/exzellenzkoch/userinterfacelayer/view/DisplaySearchListFragment.kt b/app/src/main/java/de/psekochbuch/exzellenzkoch/userinterfacelayer/view/DisplaySearchListFragment.kt index 85a1d7b7..7f830bac 100644 --- a/app/src/main/java/de/psekochbuch/exzellenzkoch/userinterfacelayer/view/DisplaySearchListFragment.kt +++ b/app/src/main/java/de/psekochbuch/exzellenzkoch/userinterfacelayer/view/DisplaySearchListFragment.kt @@ -64,46 +64,6 @@ class DisplaySearchListFragment : Fragment(){ binding.radioButtonVegan.setOnClickListener { viewModel.recipes.postValue(viewModel.recipesSortedTitle.value!!) } - /* - // Radio button logic - binding.radioButtonVegan.setOnClickListener{ - var sortedRecipes = viewModel.sortByVegan() - val adapter = DisplaySearchListAdaper(sortedRecipes,viewModel, requireContext()) - binding.recyclerViewSearchlistFragment.adapter = adapter - val observer = Observer> { items -> - exampleAdapter.setNewItems(items) - } - viewModel.recipes.observe(this.viewLifecycleOwner, observer) - - } - binding.radioButtonVegetarian.setOnClickListener{ - var sortedRecipesVegetarian = viewModel.sortByVegetarian() - val adapterVegetarian = DisplaySearchListAdaper(sortedRecipesVegetarian,viewModel, requireContext()) - binding.recyclerViewSearchlistFragment.adapter = adapterVegetarian - val observer = Observer> { items -> - exampleAdapter.setNewItems(items) - } - viewModel.recipes.observe(this.viewLifecycleOwner, observer) - - } - binding.radioButtonDate.setOnClickListener{ - viewModel.sortByDate() - - var sortedRecipesDate = viewModel.recipes.value!! - val adapterDate = DisplaySearchListAdaper(sortedRecipesDate,viewModel, requireContext()) - binding.recyclerViewSearchlistFragment.adapter = adapterDate - val observer = Observer> { items -> - exampleAdapter.setNewItems(items) - } - viewModel.recipes.observe(this.viewLifecycleOwner, observer) - - } - */ - - - //ERROR - - return binding.root } diff --git a/app/src/main/java/de/psekochbuch/exzellenzkoch/userinterfacelayer/viewmodel/DisplaySearchListViewmodel.kt b/app/src/main/java/de/psekochbuch/exzellenzkoch/userinterfacelayer/viewmodel/DisplaySearchListViewmodel.kt index 0af7b684..45cc6668 100644 --- a/app/src/main/java/de/psekochbuch/exzellenzkoch/userinterfacelayer/viewmodel/DisplaySearchListViewmodel.kt +++ b/app/src/main/java/de/psekochbuch/exzellenzkoch/userinterfacelayer/viewmodel/DisplaySearchListViewmodel.kt @@ -60,35 +60,5 @@ class DisplaySearchListViewmodel(repo:PublicRecipeRepository) : ViewModel() { } })) } - - } - - - fun sortByVegan(): List{ - var sortedList = mutableListOf() - if(recipes.value != null) { - for (recipe in recipes.value!!) { - if(recipe.tags.contains("vegan")) { - sortedList.add(recipe) - } - } - } - return sortedList - - - } - fun sortByVegetarian() : List{ - var sortedList = mutableListOf() - if(recipes.value != null) { - for (recipe in recipes.value!!) { - if(recipe.tags.contains("vegetarisch")) { - sortedList.add(recipe) - } - } - } - return sortedList - } - fun sortByDate() { - } } \ No newline at end of file diff --git a/app/src/main/res/layout/display_searchlist_fragment.xml b/app/src/main/res/layout/display_searchlist_fragment.xml index 7392f84b..9b99743b 100644 --- a/app/src/main/res/layout/display_searchlist_fragment.xml +++ b/app/src/main/res/layout/display_searchlist_fragment.xml @@ -44,13 +44,7 @@ android:id="@+id/radioButton_vegan" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/vegan" /> - - + android:text="@string/titel" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ce62cafc..fd208b3d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -93,6 +93,7 @@ Zubereitungszeit: Teilen Ausloggen + Titel vegan