diff --git a/app/src/main/java/it/danieleverducci/subitobeers/MainActivity.kt b/app/src/main/java/it/danieleverducci/subitobeers/MainActivity.kt index 177eb0d..866a7c7 100644 --- a/app/src/main/java/it/danieleverducci/subitobeers/MainActivity.kt +++ b/app/src/main/java/it/danieleverducci/subitobeers/MainActivity.kt @@ -1,6 +1,8 @@ package it.danieleverducci.subitobeers import android.os.Bundle +import android.view.Menu +import android.view.MenuInflater import androidx.appcompat.app.AppCompatActivity import it.danieleverducci.subitobeers.entities.Beer import it.danieleverducci.subitobeers.ui.BeerDetailFragment diff --git a/app/src/main/java/it/danieleverducci/subitobeers/ui/BeersFragment.kt b/app/src/main/java/it/danieleverducci/subitobeers/ui/BeersFragment.kt index 2b3b42c..67fd1f9 100644 --- a/app/src/main/java/it/danieleverducci/subitobeers/ui/BeersFragment.kt +++ b/app/src/main/java/it/danieleverducci/subitobeers/ui/BeersFragment.kt @@ -1,12 +1,10 @@ package it.danieleverducci.subitobeers.ui import android.os.Bundle +import android.view.* import androidx.fragment.app.Fragment import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup import android.widget.Toast import it.danieleverducci.subitobeers.BeerNavigation import it.danieleverducci.subitobeers.BeersRepository @@ -26,6 +24,8 @@ class BeersFragment : Fragment(), BeersRepository.Listener, BeerRecyclerAdapter. inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { + setHasOptionsMenu(true); + val view = inflater.inflate(R.layout.fragment_beers_list, container, false) // Set the adapter @@ -53,6 +53,11 @@ class BeersFragment : Fragment(), BeersRepository.Listener, BeerRecyclerAdapter. repo.getBeers(page) } + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { + super.onCreateOptionsMenu(menu, inflater) + requireActivity().menuInflater.inflate(R.menu.list_menu, menu) + } + override fun onBeersObtained(beers: List) { rvAdapter.addItems(beers) } diff --git a/app/src/main/res/drawable/ic_action_filter.xml b/app/src/main/res/drawable/ic_action_filter.xml new file mode 100644 index 0000000..ccb8fd2 --- /dev/null +++ b/app/src/main/res/drawable/ic_action_filter.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/fragment_beers_list.xml b/app/src/main/res/layout/fragment_beers_list.xml index bab864d..29470f0 100644 --- a/app/src/main/res/layout/fragment_beers_list.xml +++ b/app/src/main/res/layout/fragment_beers_list.xml @@ -1,13 +1,26 @@ - \ No newline at end of file + android:layout_height="match_parent"> + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/list_menu.xml b/app/src/main/res/menu/list_menu.xml new file mode 100644 index 0000000..f48ebb7 --- /dev/null +++ b/app/src/main/res/menu/list_menu.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fc2a888..68b316a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -12,4 +12,6 @@ 00/0000 Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tristique consectetur felis vel pretium. Praesent tincidunt vestibulum lacus, molestie rhoncus lacus fermentum vel. Morbi vel pulvinar sapien, sed ultrices arcu. Vivamus gravida nulla vel ex varius, vel consequat dolor tincidunt. Fusce maximus quis mi eget tristique. Aenean sed facilisis libero. Aliquam volutpat posuere fringilla. Praesent in lorem at elit ornare congue et quis quam. Maecenas tempus et purus ac rhoncus. Donec in pulvinar ex. Aliquam ac vehicula dolor. Nam vitae tortor id nibh congue sollicitudin id in nisi. Proin lorem eros, congue at euismod et, malesuada porta nunc. Proin laoreet massa ac mi lacinia, eget tincidunt odio vestibulum. Vestibulum fermentum nunc nunc, eget ultrices nisi tempor non. Curabitur lorem leo, fringilla et pellentesque a, pharetra id magna. + + Filter \ No newline at end of file